浏览代码

add field indexes

tags/v0.1.6
Jonathan Cobb 5 年前
父节点
当前提交
9c4570b733
共有 30 个文件被更改,包括 277 次插入274 次删除
  1. +8
    -8
      bubble-server/src/main/java/bubble/model/account/Account.java
  2. +7
    -6
      bubble-server/src/main/java/bubble/model/account/AccountPolicy.java
  3. +9
    -9
      bubble-server/src/main/java/bubble/model/account/message/AccountMessage.java
  4. +6
    -6
      bubble-server/src/main/java/bubble/model/app/AppData.java
  5. +10
    -10
      bubble-server/src/main/java/bubble/model/app/AppMatcher.java
  6. +8
    -8
      bubble-server/src/main/java/bubble/model/app/AppRule.java
  7. +10
    -10
      bubble-server/src/main/java/bubble/model/app/AppSite.java
  8. +11
    -11
      bubble-server/src/main/java/bubble/model/app/BubbleApp.java
  9. +13
    -13
      bubble-server/src/main/java/bubble/model/app/RuleDriver.java
  10. +23
    -22
      bubble-server/src/main/java/bubble/model/bill/AccountPayment.java
  11. +5
    -5
      bubble-server/src/main/java/bubble/model/bill/AccountPaymentMethod.java
  12. +12
    -12
      bubble-server/src/main/java/bubble/model/bill/AccountPlan.java
  13. +12
    -12
      bubble-server/src/main/java/bubble/model/bill/Bill.java
  14. +18
    -18
      bubble-server/src/main/java/bubble/model/bill/BubblePlan.java
  15. +12
    -12
      bubble-server/src/main/java/bubble/model/cloud/AnsibleRole.java
  16. +6
    -6
      bubble-server/src/main/java/bubble/model/cloud/BubbleBackup.java
  17. +11
    -11
      bubble-server/src/main/java/bubble/model/cloud/BubbleDomain.java
  18. +10
    -10
      bubble-server/src/main/java/bubble/model/cloud/BubbleFootprint.java
  19. +14
    -14
      bubble-server/src/main/java/bubble/model/cloud/BubbleNetwork.java
  20. +17
    -17
      bubble-server/src/main/java/bubble/model/cloud/BubbleNode.java
  21. +7
    -9
      bubble-server/src/main/java/bubble/model/cloud/BubbleNodeKey.java
  22. +14
    -14
      bubble-server/src/main/java/bubble/model/cloud/CloudService.java
  23. +10
    -10
      bubble-server/src/main/java/bubble/model/cloud/CloudServiceData.java
  24. +11
    -8
      bubble-server/src/main/java/bubble/model/cloud/notify/NotificationBase.java
  25. +1
    -1
      bubble-server/src/main/java/bubble/model/cloud/notify/ReceivedNotification.java
  26. +1
    -1
      bubble-server/src/main/java/bubble/model/cloud/notify/SentNotification.java
  27. +8
    -8
      bubble-server/src/main/java/bubble/model/device/Device.java
  28. +1
    -1
      bubble-web
  29. +1
    -1
      utils/cobbzilla-utils
  30. +1
    -1
      utils/cobbzilla-wizard

+ 8
- 8
bubble-server/src/main/java/bubble/model/account/Account.java 查看文件

@@ -80,7 +80,7 @@ public class Account extends IdentifiableBase implements TokenPrincipal, SqlView

public static String accountField(String table) { return table.equalsIgnoreCase("account") ? "uuid" : "account"; }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.name.required")
@ECIndex(unique=true) @Column(nullable=false, updatable=false, length=100)
@Getter @Setter private String name;
@@ -97,34 +97,34 @@ public class Account extends IdentifiableBase implements TokenPrincipal, SqlView

// make this updatable if we ever want accounts to be able to change parents
// there might be a lot more involved in that action though (read-only parent objects that will no longer be visible, must be copied in?)
@ECIndex @Column(length=UUID_MAXLEN, updatable=false)
@ECIndex @Column(length=UUID_MAXLEN, updatable=false) @ECField(index=20)
@Getter @Setter private String parent;
public boolean hasParent () { return parent != null; }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=30)
@Size(max=1024, message="err.url.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(1024+ENC_PAD)+")")
@Getter @Setter private String url;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=40)
@Size(max=10000, message="err.description.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(10000+ENC_PAD)+")")
@Getter @Setter private String description;

@ECSearchable @ECField(type=EntityFieldType.locale)
@ECSearchable @ECField(type=EntityFieldType.locale, index=50)
@Size(max=20, message="err.locale.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(20+ENC_PAD)+") NOT NULL")
@Getter @Setter private String locale = DEFAULT_LOCALE;

@ECSearchable
@ECSearchable @ECField(index=60)
@Getter @Setter private Boolean admin = false;
public boolean admin () { return admin != null && admin; }

@ECSearchable
@ECSearchable @ECField(index=70)
@Getter @Setter private Boolean suspended = false;
public boolean suspended () { return suspended != null && suspended; }

@ECSearchable
@ECSearchable @ECField(index=80)
@Getter @Setter private Boolean locked = false;
public boolean locked () { return locked != null && locked; }



+ 7
- 6
bubble-server/src/main/java/bubble/model/account/AccountPolicy.java 查看文件

@@ -13,6 +13,7 @@ import lombok.experimental.Accessors;
import org.cobbzilla.wizard.model.Identifiable;
import org.cobbzilla.wizard.model.IdentifiableBase;
import org.cobbzilla.wizard.model.entityconfig.EntityFieldType;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECField;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECForeignKey;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECSearchable;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECType;
@@ -51,29 +52,29 @@ public class AccountPolicy extends IdentifiableBase implements HasAccount {

@Override public Identifiable update(Identifiable thing) { copy(this, thing, UPDATE_FIELDS); return this; }

@ECSearchable
@ECSearchable @ECField(index=10)
@ECForeignKey(entity=Account.class)
@Column(length=UUID_MAXLEN, nullable=false, updatable=false)
@Getter @Setter private String account;

@JsonIgnore @Override public String getName() { return getAccount(); }

@ECSearchable(type=EntityFieldType.expiration_time)
@ECSearchable(type=EntityFieldType.expiration_time) @ECField(index=20)
@Type(type=ENCRYPTED_LONG) @Column(columnDefinition="varchar("+ENC_LONG+") NOT NULL")
@Getter @Setter private Long nodeOperationTimeout = MINUTES.toMillis(30);

@ECSearchable(type=EntityFieldType.expiration_time)
@ECSearchable(type=EntityFieldType.expiration_time) @ECField(index=30)
@Type(type=ENCRYPTED_LONG) @Column(columnDefinition="varchar("+ENC_LONG+") NOT NULL")
@Getter @Setter private Long accountOperationTimeout = MINUTES.toMillis(10);

@ECSearchable
@Enumerated(EnumType.STRING) @Column(length=20, nullable=false)
@ECSearchable @ECField(index=40)
@Enumerated(EnumType.STRING) @Column(length=40, nullable=false)
@Getter @Setter private AccountDeletionPolicy deletionPolicy = AccountDeletionPolicy.block_delete;

@JsonIgnore @Transient public boolean isFullDelete () { return deletionPolicy == AccountDeletionPolicy.full_delete; }
@JsonIgnore @Transient public boolean isBlockDelete () { return deletionPolicy == AccountDeletionPolicy.block_delete; }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=50)
@Size(max=100000, message="err.accountContactsJson.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(100000+ENC_PAD)+")")
@JsonIgnore @Getter @Setter private String accountContactsJson;


+ 9
- 9
bubble-server/src/main/java/bubble/model/account/message/AccountMessage.java 查看文件

@@ -34,43 +34,43 @@ public class AccountMessage extends IdentifiableBase implements HasAccount {

public AccountMessage (AccountMessage other) { copy(this, other); setUuid(null); }

@ECForeignKey(entity=Account.class)
@ECForeignKey(entity=Account.class) @ECField(index=10)
@Column(length=UUID_MAXLEN, nullable=false, updatable=false)
@Getter @Setter private String account;

@ECIndex @Column(length=UUID_MAXLEN, nullable=false, updatable=false)
@ECIndex @ECField(index=20) @Column(length=UUID_MAXLEN, nullable=false, updatable=false)
@Getter @Setter private String requestId = randomUUID().toString();

@ECIndex @Column(length=UUID_MAXLEN, updatable=false)
@ECIndex @ECField(index=30) @Column(length=UUID_MAXLEN, updatable=false)
@Getter @Setter private String contact;
public boolean hasContact () { return !empty(contact); }
public boolean isSameContact (String uuid) { return hasContact() && contact.equals(uuid); }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=40)
@ECIndex @Column(length=UUID_MAXLEN, nullable=false, updatable=false)
@Getter @Setter private String name;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=50)
@Size(max=100, message="err.remoteHost.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(100+ENC_PAD)+")")
@Getter @Setter private String remoteHost;

@ECSearchable
@ECSearchable @ECField(index=60)
@Enumerated(EnumType.STRING)
@ECIndex @Column(length=20, nullable=false, updatable=false)
@Getter @Setter private AccountMessageType messageType;

@ECSearchable
@ECSearchable @ECField(index=70)
@Enumerated(EnumType.STRING)
@ECIndex @Column(length=20, nullable=false, updatable=false)
@Getter @Setter private AccountAction action;

@ECSearchable
@ECSearchable @ECField(index=80)
@Enumerated(EnumType.STRING)
@ECIndex @Column(length=20, nullable=false, updatable=false)
@Getter @Setter private ActionTarget target;

@Size(max=100000, message="err.data.length")
@Size(max=100000, message="err.data.length") @ECField(index=90)
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(100000+ENC_PAD)+")")
@Getter @Setter private String data;



+ 6
- 6
bubble-server/src/main/java/bubble/model/app/AppData.java 查看文件

@@ -46,36 +46,36 @@ public class AppData extends IdentifiableBase implements AppTemplateEntity {
@Override @Transient public String getName() { return getKey(); }
public AppData setName(String n) { return setKey(n); }

@ECSearchable
@ECSearchable @ECField(index=10)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=BubbleApp.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String app;
public boolean hasApp () { return app != null; }

@ECSearchable
@ECSearchable @ECField(index=30)
@ECForeignKey(entity=AppMatcher.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String matcher;
public boolean hasMatcher() { return matcher != null; }

@ECSearchable
@ECSearchable @ECField(index=40)
@ECForeignKey(entity=AppSite.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String site;
public boolean hasSite() { return site != null; }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=50)
@HasValue(message="err.key.required")
@ECIndex @Column(nullable=false, updatable=false, length=5000)
@Getter @Setter private String key;
public boolean hasKey () { return key != null; }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=60)
@Size(max=100000, message="err.data.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(100000+ENC_PAD)+")")
@Getter @Setter private String data;


+ 10
- 10
bubble-server/src/main/java/bubble/model/app/AppMatcher.java 查看文件

@@ -39,32 +39,32 @@ public class AppMatcher extends IdentifiableBase implements AppTemplateEntity {
public static final String[] VALUE_FIELDS = {"fqdn", "urlRegex", "rule", "template", "enabled"};
public static final String[] CREATE_FIELDS = ArrayUtil.append(VALUE_FIELDS, "name", "site");

@ECSearchable
@ECSearchable @ECField(index=10)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=20)
@ECIndex @Column(nullable=false, updatable=false, length=200)
@Getter @Setter private String name;

@ECSearchable
@ECSearchable @ECField(index=30)
@ECForeignKey(entity=BubbleApp.class)
@Column(nullable=false, length=UUID_MAXLEN)
@Getter @Setter private String app;

@ECSearchable
@ECSearchable @ECField(index=40)
@ECForeignKey(entity=AppSite.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String site;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=50)
@HasValue(message="err.fqdn.required")
@Size(max=1024, message="err.fqdn.length")
@ECIndex @Column(nullable=false, length=1024)
@Getter @Setter private String fqdn;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=60)
@HasValue(message="err.urlRegex.required")
@Size(max=1024, message="err.urlRegex.length")
@Type(type=ENCRYPTED_STRING) @Column(nullable=false, columnDefinition="varchar("+(1024+ENC_PAD)+") UNIQUE")
@@ -74,22 +74,22 @@ public class AppMatcher extends IdentifiableBase implements AppTemplateEntity {

public boolean matches (String value) { return getPattern().matcher(value).find(); }

@ECSearchable
@ECSearchable @ECField(index=70)
@ECForeignKey(entity=AppRule.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String rule;

@ECSearchable
@ECSearchable @ECField(index=80)
@Column(nullable=false)
@Getter @Setter private Boolean blocked = false;
public boolean blocked() { return blocked != null && blocked; }

@ECSearchable
@ECSearchable @ECField(index=90)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean template = false;
public boolean template () { return template == null || template; }

@ECSearchable
@ECSearchable @ECField(index=100)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;
public boolean enabled () { return enabled == null || enabled; }


+ 8
- 8
bubble-server/src/main/java/bubble/model/app/AppRule.java 查看文件

@@ -45,12 +45,12 @@ public class AppRule extends IdentifiableBaseParentEntity implements AppTemplate
public static final String[] VALUE_FIELDS = {"driver", "configJson", "template", "enabled"};
public static final String[] CREATE_FIELDS = ArrayUtil.append(VALUE_FIELDS, "name");

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.name.required")
@ECIndex @Column(nullable=false, updatable=false, length=200)
@Getter @Setter private String name;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;
@@ -59,26 +59,26 @@ public class AppRule extends IdentifiableBaseParentEntity implements AppTemplate
return (account == null && accountUuid == null) || (account != null && account.equals(accountUuid));
}

@ECSearchable
@ECSearchable @ECField(index=30)
@ECForeignKey(entity=BubbleApp.class)
@Column(nullable=false, length=UUID_MAXLEN)
@Getter @Setter private String app;

@ECSearchable
@ECSearchable @ECField(index=40)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean template = false;
public boolean template () { return template == null || template; }

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;
public boolean enabled () { return enabled == null || enabled; }

@ECSearchable
@ECSearchable @ECField(index=60)
@Column(nullable=false)
@Getter @Setter private Integer priority = 0;

@ECSearchable
@ECSearchable @ECField(index=70)
@ECForeignKey(entity=RuleDriver.class)
@HasValue(message="err.driver.required")
@Column(nullable=false, length=UUID_MAXLEN)
@@ -90,7 +90,7 @@ public class AppRule extends IdentifiableBaseParentEntity implements AppTemplate
return d;
}

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=80)
@Size(max=500000, message="err.configJson.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(500000+ENC_PAD)+")")
@JsonIgnore @Getter @Setter private String configJson;


+ 10
- 10
bubble-server/src/main/java/bubble/model/app/AppSite.java 查看文件

@@ -41,35 +41,35 @@ public class AppSite extends IdentifiableBase implements AppTemplateEntity {
return this;
}

@ECSearchable
@ECSearchable(filter=true) @ECField(index=10)
@ECIndex @Column(nullable=false, updatable=false, length=1000)
@Getter @Setter private String name;

@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true)
@ECIndex @Column(nullable=false, updatable=false, length=1000)
@Getter @Setter private String name;

@ECSearchable
@ECSearchable @ECField(index=30)
@ECForeignKey(entity=BubbleApp.class)
@Column(nullable=false, length=UUID_MAXLEN)
@Getter @Setter private String app;

@ECSearchable
@ECSearchable @ECField(index=40)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean template = false;
public boolean template () { return template == null || template; }

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;
public boolean enabled () { return enabled == null || enabled; }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=60)
@Column(nullable=false, length=10000)
@Getter @Setter private String description;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=70)
@Column(nullable=false, length=1024)
@Getter @Setter private String url;



+ 11
- 11
bubble-server/src/main/java/bubble/model/app/BubbleApp.java 查看文件

@@ -40,38 +40,38 @@ public class BubbleApp extends IdentifiableBaseParentEntity implements AccountTe

private static final String[] VALUE_FIELDS = {"url", "description", "template", "enabled"};

@ECSearchable
@ECForeignKey(entity=Account.class)
@Column(length=UUID_MAXLEN, nullable=false, updatable=false)
@Getter @Setter private String account;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.name.required")
@ECIndex @Column(nullable=false, updatable=false, length=200)
@Getter @Setter private String name;

@ECSearchable(filter=true)
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(length=UUID_MAXLEN, nullable=false, updatable=false)
@Getter @Setter private String account;

@ECSearchable(filter=true) @ECField(index=30)
@HasValue(message="err.url.required")
@Size(max=1024, message="err.url.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(1024+ENC_PAD)+") NOT NULL")
@Getter @Setter private String url;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=40)
@Size(max=10000, message="err.description.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(10000+ENC_PAD)+")")
@Getter @Setter private String description;

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean template = false;
public boolean template() { return template != null && template; }

@ECSearchable
@ECSearchable @ECField(index=60)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;
public boolean enabled () { return enabled == null || enabled; }

@ECSearchable
@ECSearchable @ECField(index=70)
@ECIndex @Getter @Setter private Boolean needsUpdate = false;

public BubbleApp(Account account, BubbleApp app) {


+ 13
- 13
bubble-server/src/main/java/bubble/model/app/RuleDriver.java 查看文件

@@ -50,39 +50,39 @@ public class RuleDriver extends IdentifiableBase implements AccountTemplate {
return this;
}

@ECSearchable
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.name.required")
@ECIndex @Column(length=200, nullable=false, updatable=false)
@Getter @Setter private String name;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable @ECField(index=30)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean template = false;
public boolean template() { return template != null && template; }

@ECSearchable
@ECSearchable @ECField(index=40)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;
public boolean enabled () { return enabled == null || enabled; }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=50)
@Column(length=200)
@Getter @Setter private String author;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=60)
@Column(length=1024)
@Getter @Setter private String url;

@ECSearchable
@ECSearchable @ECField(index=70)
@Column(nullable=false, updatable=false, length=1000)
@Getter @Setter private String driverClass;

@Column(length=100000)
@Column(length=100000) @ECField(index=80)
@JsonIgnore @Getter @Setter private String userConfigJson;

@Transient public RuleDriver setUserConfig (JsonNode json) { return setUserConfigJson(json(json)); }
@@ -92,7 +92,7 @@ public class RuleDriver extends IdentifiableBase implements AccountTemplate {

@Embedded @Getter @Setter private SemanticVersion version;

@ECSearchable
@ECSearchable @ECField(index=90)
@ECIndex @Getter @Setter private Boolean needsUpdate = false;

@Transient @Getter @Setter private AppRuleDriverDescriptor descriptor;


+ 23
- 22
bubble-server/src/main/java/bubble/model/bill/AccountPayment.java 查看文件

@@ -25,46 +25,59 @@ import static org.cobbzilla.wizard.model.crypto.EncryptedTypes.*;
@Entity @NoArgsConstructor @Accessors(chain=true)
public class AccountPayment extends IdentifiableBase implements HasAccountNoName {

@ECSearchable
@ECSearchable @ECField(index=10)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=AccountPaymentMethod.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String paymentMethod;

@ECSearchable
@ECSearchable @ECField(index=30)
@ECForeignKey(entity=BubblePlan.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String plan;

@ECSearchable
@ECSearchable @ECField(index=40)
@ECForeignKey(entity=AccountPlan.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String accountPlan;

@ECSearchable
@ECSearchable @ECField(index=50)
@ECForeignKey(entity=Bill.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String bill;

@ECSearchable
@ECSearchable @ECField(index=60)
@Enumerated(EnumType.STRING) @Column(nullable=false, updatable=false, length=20)
@Getter @Setter private AccountPaymentType type;

@ECSearchable
@ECSearchable @ECField(index=70)
@Enumerated(EnumType.STRING) @Column(nullable=false, length=20)
@Getter @Setter private AccountPaymentStatus status;

@ECSearchable
@ECSearchable @ECField(index=80)
@Type(type=ENCRYPTED_LONG) @Column(updatable=false, columnDefinition="varchar("+(ENC_LONG)+") NOT NULL")
@Getter @Setter private Long amount = 0L;

@ECSearchable @ECField(index=90)
@ECIndex @Column(nullable=false, updatable=false, length=10)
@Getter @Setter private String currency;

@ECSearchable(filter=true) @ECField(index=100)
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(100000+ENC_PAD)+") NOT NULL")
@Getter @Setter private String info;

@ECSearchable @ECField(index=110)
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(200+ENC_PAD)+")")
@Getter @Setter private String violation;

@ECSearchable
@ECSearchable @ECField(index=120)
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(10000+ENC_PAD)+")")
@JsonIgnore @Getter @Setter private String exception;
@JsonIgnore
@Getter @Setter private String exception;

public AccountPayment setError (Exception e) {
if (e instanceof SimpleViolationException) {
@@ -76,18 +89,6 @@ public class AccountPayment extends IdentifiableBase implements HasAccountNoName
return this;
}

@ECSearchable
@Type(type=ENCRYPTED_LONG) @Column(updatable=false, columnDefinition="varchar("+(ENC_LONG)+") NOT NULL")
@Getter @Setter private Long amount = 0L;

@ECSearchable
@ECIndex @Column(nullable=false, updatable=false, length=10)
@Getter @Setter private String currency;

@ECSearchable(filter=true)
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(100000+ENC_PAD)+") NOT NULL")
@Getter @Setter private String info;

@Transient @Getter @Setter private transient Bill billObject;

}

+ 5
- 5
bubble-server/src/main/java/bubble/model/bill/AccountPaymentMethod.java 查看文件

@@ -50,18 +50,18 @@ public class AccountPaymentMethod extends IdentifiableBase implements HasAccount

@Override public void beforeCreate() { if (!hasUuid()) initUuid(); }

@ECSearchable
@ECSearchable @ECField(index=10)
@ECForeignKey(entity=Account.class)
@Column(length=UUID_MAXLEN, nullable=false, updatable=false)
@Getter @Setter private String account;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=CloudService.class)
@Column(length=UUID_MAXLEN, nullable=false, updatable=false)
@Getter @Setter private String cloud;
public boolean hasCloud() { return cloud != null; }

@ECSearchable
@ECSearchable @ECField(index=30)
@Enumerated(EnumType.STRING) @Column(nullable=false, updatable=false, length=20)
@Getter @Setter private PaymentMethodType paymentMethodType;
public boolean hasPaymentMethodType() { return paymentMethodType != null; }
@@ -71,11 +71,11 @@ public class AccountPaymentMethod extends IdentifiableBase implements HasAccount
public boolean hasPaymentInfo () { return paymentInfo != null; }

public static final String DEFAULT_MASKED_PAYMENT_INFO = "XXXX-".repeat(3)+"XXXX";
@ECSearchable
@ECSearchable @ECField(index=40)
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(100+ENC_PAD)+") NOT NULL")
@Getter @Setter private String maskedPaymentInfo = DEFAULT_MASKED_PAYMENT_INFO;

@ECSearchable
@ECSearchable @ECField(index=50)
@Column(nullable=false)
@Getter @Setter private Boolean deleted = false;
public boolean deleted() { return deleted != null && deleted; }


+ 12
- 12
bubble-server/src/main/java/bubble/model/bill/AccountPlan.java 查看文件

@@ -43,63 +43,63 @@ public class AccountPlan extends IdentifiableBase implements HasAccount {
@Override public void beforeCreate() { if (!hasUuid()) initUuid(); }

// mirrors network name
@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=10)
@Size(max=100, message="err.name.length")
@Column(length=100, nullable=false)
@Getter @Setter private String name;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable
@ECSearchable @ECField(index=30)
@ECForeignKey(entity=BubblePlan.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String plan;

@ECSearchable
@ECSearchable @ECField(index=40)
@ECForeignKey(entity=AccountPaymentMethod.class)
@Column(updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String paymentMethod;

@ECSearchable
@ECSearchable @ECField(index=50)
@ECForeignKey(entity=BubbleDomain.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String domain;

@ECSearchable
@ECSearchable @ECField(index=60)
@ECForeignKey(entity=BubbleNetwork.class, index=false) @ECIndex(unique=true)
@Column(length=UUID_MAXLEN)
@Getter @Setter private String network;

@ECSearchable
@ECSearchable @ECField(index=70)
@Column(nullable=false)
@Getter @Setter private Boolean enabled = false;
public boolean enabled() { return enabled != null && enabled; }
public boolean disabled() { return !enabled(); }

@ECSearchable(type=EntityFieldType.epoch_time)
@ECSearchable(type=EntityFieldType.epoch_time) @ECField(index=80)
@Column(nullable=false)
@ECIndex @Getter @Setter private Long nextBill;

@ECSearchable
@ECSearchable @ECField(index=90)
@Column(nullable=false, length=20)
@Getter @Setter private String nextBillDate;
public AccountPlan setNextBillDate() { return setNextBillDate(BILL_START_END_FORMAT.print(getNextBill())); }

@ECSearchable
@ECSearchable @ECField(index=100)
@ECIndex @Getter @Setter private Long deleted;
public boolean deleted() { return deleted != null; }
public boolean notDeleted() { return !deleted(); }

@ECSearchable
@ECSearchable @ECField(index=110)
@Column(nullable=false)
@ECIndex @Getter @Setter private Boolean closed = false;
public boolean closed() { return closed != null && closed; }
public boolean notClosed() { return !closed(); }

@ECSearchable
@ECSearchable @ECField(index=120)
@ECIndex(unique=true) @Column(length=UUID_MAXLEN)
@Getter @Setter private String deletedNetwork;
public boolean hasDeletedNetwork() { return deletedNetwork != null; }


+ 12
- 12
bubble-server/src/main/java/bubble/model/bill/Bill.java 查看文件

@@ -23,60 +23,60 @@ import static org.cobbzilla.wizard.model.crypto.EncryptedTypes.*;
})
public class Bill extends IdentifiableBase implements HasAccountNoName {

@ECSearchable
@ECSearchable @ECField(index=10)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=BubblePlan.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String plan;

@ECSearchable
@ECSearchable @ECField(index=30)
@ECForeignKey(entity=AccountPlan.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String accountPlan;

@ECSearchable
@ECSearchable @ECField(index=40)
@ECIndex @Enumerated(EnumType.STRING)
@Column(nullable=false, length=20)
@Getter @Setter private BillStatus status = BillStatus.unpaid;
public boolean paid() { return status == BillStatus.paid; }
public boolean unpaid() { return !paid(); }

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Enumerated(EnumType.STRING)
@Column(nullable=false, updatable=false, length=20)
@Getter @Setter private BillItemType type;

@ECSearchable
@ECSearchable @ECField(index=60)
@Column(nullable=false, updatable=false, length=20)
@ECIndex @Getter @Setter private String periodLabel;

@ECSearchable
@ECSearchable @ECField(index=70)
@Column(nullable=false, updatable=false, length=20)
@Getter @Setter private String periodStart;

@ECSearchable
@ECSearchable @ECField(index=80)
@Column(nullable=false, updatable=false, length=20)
@Getter @Setter private String periodEnd;

public int daysInPeriod () { return BillPeriod.daysInPeriod(periodStart, periodEnd); }

@ECSearchable
@ECSearchable @ECField(index=90)
@Type(type=ENCRYPTED_LONG) @Column(updatable=false, columnDefinition="varchar("+(ENC_LONG)+") NOT NULL")
@Getter @Setter private Long quantity = 0L;

@ECSearchable
@ECSearchable @ECField(index=100)
@Type(type=ENCRYPTED_LONG) @Column(updatable=false, columnDefinition="varchar("+(ENC_LONG)+") NOT NULL")
@Getter @Setter private Long price = 0L;

@ECSearchable
@ECSearchable @ECField(index=110)
@ECIndex @Column(nullable=false, updatable=false, length=10)
@Getter @Setter private String currency;

@ECSearchable
@ECSearchable @ECField(index=120)
@Type(type=ENCRYPTED_LONG) @Column(columnDefinition="varchar("+(ENC_LONG)+")")
@Getter @Setter private Long refundedAmount = 0L;
public boolean hasRefundedAmount () { return refundedAmount != null && refundedAmount > 0L; }


+ 18
- 18
bubble-server/src/main/java/bubble/model/bill/BubblePlan.java 查看文件

@@ -43,17 +43,17 @@ public class BubblePlan extends IdentifiableBase implements HasAccount {

public BubblePlan (BubblePlan other) { copy(this, other, CREATE_FIELDS); }

@ECSearchable
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.name.required")
@ECIndex @Column(nullable=false, updatable=false, length=200)
@Getter @Setter private String name;

@ECSearchable(filter=true)
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true) @ECField(index=30)
@HasValue(message="err.chargeName.required")
@Size(message="err.chargeName.length")
@Column(nullable=false, updatable=false, length=12)
@@ -70,48 +70,48 @@ public class BubblePlan extends IdentifiableBase implements HasAccount {
}
}

@ECSearchable
@ECSearchable @ECField(index=40)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;
public boolean enabled () { return enabled == null || enabled; }

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Column(nullable=false)
@Getter @Setter private Long price;

@ECSearchable
@ECSearchable @ECField(index=60)
@ECIndex @Column(nullable=false, length=10)
@Getter @Setter private String currency = "USD";

@ECSearchable
@ECSearchable @ECField(index=70)
@Enumerated(EnumType.STRING) @Column(nullable=false, updatable=false, length=20)
@Getter @Setter private BillPeriod period = BillPeriod.monthly;

@ECSearchable
@ECSearchable @ECField(index=80)
@ECIndex @Column(nullable=false, updatable=false, length=20)
@Enumerated(EnumType.STRING) @Getter @Setter private ComputeNodeSizeType computeSizeType;

@ECSearchable
@ECSearchable @ECField(index=90)
@Column(nullable=false, updatable=false)
@Getter @Setter private Integer nodesIncluded;

@ECSearchable
@ECSearchable @ECField(index=100)
@Column(nullable=false, updatable=false)
@Getter @Setter private Integer additionalPerNodePrice;

@ECSearchable
@ECSearchable @ECField(index=120)
@Column(nullable=false, updatable=false)
@Getter @Setter private Integer storageGbIncluded;

@ECSearchable
@ECSearchable @ECField(index=130)
@Column(nullable=false, updatable=false)
@Getter @Setter private Integer additionalStoragePerGbPrice;

@ECSearchable
@ECSearchable @ECField(index=140)
@Column(nullable=false, updatable=false)
@Getter @Setter private Integer bandwidthGbIncluded;

@ECSearchable
@ECSearchable @ECField(index=150)
@Column(nullable=false, updatable=false)
@Getter @Setter private Integer additionalBandwidthPerGbPrice;



+ 12
- 12
bubble-server/src/main/java/bubble/model/cloud/AnsibleRole.java 查看文件

@@ -42,17 +42,17 @@ public class AnsibleRole extends IdentifiableBase implements AccountTemplate, Ha

public AnsibleRole(AnsibleRole role) { copy(this, role, COPY_FIELDS); }

@ECSearchable
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.name.required")
@Pattern(regexp=ROLENAME_PATTERN, message="err.name.invalid")
@ECIndex @Column(nullable=false, updatable=false, length=200)
@Getter @Setter private String name;

@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@JsonIgnore @Transient @Getter(lazy=true) private final String roleName = getRoleName(name);
@JsonIgnore @Transient @Getter(lazy=true) private final SemanticVersion version = getRoleVersion(name);

@@ -75,11 +75,11 @@ public class AnsibleRole extends IdentifiableBase implements AccountTemplate, Ha
.orElse(null);
}

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=30)
@Size(max=10000, message="err.description.length")
@Getter @Setter private String description;

@ECSearchable
@ECSearchable @ECField(index=40)
@Enumerated(EnumType.STRING)
@ECIndex @Column(nullable=false, length=20)
@Getter @Setter private AnsibleInstallType install = AnsibleInstallType.standard;
@@ -87,16 +87,16 @@ public class AnsibleRole extends IdentifiableBase implements AccountTemplate, Ha
return install.shouldInstall(installType);
}

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Column(nullable=false)
@Getter @Setter private Integer priority;

@ECSearchable
@ECSearchable @ECField(index=60)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean template = false;
public boolean template() { return template != null && template; }

@ECSearchable
@ECSearchable @ECField(index=70)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;
public boolean enabled () { return enabled == null || enabled; }
@@ -108,7 +108,7 @@ public class AnsibleRole extends IdentifiableBase implements AccountTemplate, Ha
@Transient public NameAndValue[] getConfig () { return configJson == null ? null : json(configJson, NameAndValue[].class); }
public AnsibleRole setConfig(NameAndValue[] config) { return setConfigJson(config == null ? null : json(config)); }

@Column(updatable=false, length=1000)
@Column(updatable=false, length=1000) @ECField(index=80)
@JsonIgnore @Getter @Setter private String optionalConfigNamesJson;
public boolean hasOptionalConfigNames () { return optionalConfigNamesJson != null; }



+ 6
- 6
bubble-server/src/main/java/bubble/model/cloud/BubbleBackup.java 查看文件

@@ -33,22 +33,22 @@ public class BubbleBackup extends IdentifiableBase implements HasAccount {
if (getUuid() == null) initUuid();
}

@ECSearchable
@ECSearchable @ECField(index=10)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=BubbleNetwork.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String network;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=30)
@Size(max=2000, message="err.path.length")
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(2000+ENC_PAD)+") NOT NULL")
@Getter @Setter private String path;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=40)
@Pattern(regexp="[A-Za-z0-9][-A-Za-z0-9\\._]{2,}", message="err.label.invalid")
@Size(max=300, message="err.label.length")
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(300+ENC_PAD)+")")
@@ -57,13 +57,13 @@ public class BubbleBackup extends IdentifiableBase implements HasAccount {

@Override @JsonIgnore @Transient public String getName() { return hasLabel() ? getLabel() : getPath(); }

@ECSearchable
@ECSearchable @ECField(index=50)
@Enumerated(EnumType.STRING)
@ECIndex @Column(nullable=false, length=40)
@Getter @Setter private BackupStatus status;
public boolean success () { return status == BackupStatus.backup_completed; }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=60)
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(ERROR_MAXLEN+ENC_PAD)+")")
@Getter private String error;
public BubbleBackup setError (String err) { this.error = ellipsis(err, ERROR_MAXLEN); return this; }


+ 11
- 11
bubble-server/src/main/java/bubble/model/cloud/BubbleDomain.java 查看文件

@@ -58,16 +58,16 @@ public class BubbleDomain extends IdentifiableBase implements AccountTemplate {

@Override public Identifiable update(Identifiable other) { copy(this, other, UPDATE_FIELDS); return this; }

@ECSearchable
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.name.required")
@ECIndex @Column(nullable=false, updatable=false, length=DOMAIN_NAME_MAXLEN)
@Getter @Setter private String name;

@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

public String ensureDomainSuffix(String fqdn) { return fqdn.endsWith("." + getName()) ? fqdn : fqdn + "." + getName(); }

public String dropDomainSuffix(String fqdn) {
@@ -75,27 +75,27 @@ public class BubbleDomain extends IdentifiableBase implements AccountTemplate {
: fqdn.substring(0, fqdn.length() - getName().length() - 1);
}

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=30)
@Size(max=10000, message="err.description.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(10000+ENC_PAD)+")")
@Getter @Setter private String description;

@ECSearchable
@ECSearchable @ECField(index=40)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean template = false;
public boolean template() { return template != null && template; }

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;
public boolean enabled () { return enabled == null || enabled; }

@ECSearchable
@ECSearchable @ECField(index=60)
@ECIndex @Column(updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String delegated;
public boolean delegated() { return delegated != null; }

@ECSearchable @ECForeignKey(entity=CloudService.class)
@ECSearchable @ECForeignKey(entity=CloudService.class) @ECField(index=70)
@Column(nullable=false, length=UUID_MAXLEN)
@Getter @Setter private String publicDns;



+ 10
- 10
bubble-server/src/main/java/bubble/model/cloud/BubbleFootprint.java 查看文件

@@ -57,31 +57,31 @@ public class BubbleFootprint extends IdentifiableBase implements AccountTemplate

@Override public Identifiable update(Identifiable other) { copy(this, other, UPDATE_FIELDS); return this; }

@ECSearchable
@ECSearchable(filter=true) @ECField(index=10)
@ECIndex @Column(nullable=false, updatable=false, length=100)
@Getter @Setter private String name;

@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true)
@ECIndex @Column(nullable=false, updatable=false, length=100)
@Getter @Setter private String name;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=30)
@Size(max=10000, message="err.description.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(10000+ENC_PAD)+")")
@Getter @Setter private String description;

@ECSearchable
@ECSearchable @ECField(index=40)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean template = false;
public boolean template() { return template != null && template; }

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;
public boolean enabled () { return enabled == null || enabled; }

@ECSearchable
@ECSearchable @ECField(index=60)
@Size(max=5000, message="err.allowedCountriesJson.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(5000+ENC_PAD)+")")
@JsonIgnore @Getter @Setter private String allowedCountriesJson;
@@ -90,7 +90,7 @@ public class BubbleFootprint extends IdentifiableBase implements AccountTemplate
@Transient public String[] getAllowedCountries () { return allowedCountriesJson == null ? null : json(allowedCountriesJson, String[].class); }
public BubbleFootprint setAllowedCountries (String[] countries) { return setAllowedCountriesJson(countries == null ? null : json(countries)); }

@ECSearchable
@ECSearchable @ECField(index=70)
@Size(max=5000, message="err.disallowedCountriesJson.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(5000+ENC_PAD)+")")
@JsonIgnore @Getter @Setter private String disallowedCountriesJson;


+ 14
- 14
bubble-server/src/main/java/bubble/model/cloud/BubbleNetwork.java 查看文件

@@ -62,56 +62,56 @@ public class BubbleNetwork extends IdentifiableBase implements HasNetwork, HasBu

@Transient @JsonIgnore public String getNetwork () { return getUuid(); }

@ECSearchable
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable
@ECSearchable @ECField(index=10)
@HasValue(message="err.name.required")
@ECIndex @Column(nullable=false, updatable=false, length=200)
@Getter @Setter private String name;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable @ECField(index=30)
@ECForeignKey(entity=BubbleDomain.class)
@HasValue(message="err.domain.required")
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String domain;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=40)
@ECIndex @Column(nullable=false, updatable=false, length=DOMAIN_NAME_MAXLEN)
@Getter @Setter private String domainName; // denormalized from BubbleNetwork

@Transient @JsonIgnore public String getNetworkDomain () { return name + "." + domainName; }

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Column(nullable=false, updatable=false, length=20)
@Enumerated(EnumType.STRING) @Getter @Setter private ComputeNodeSizeType computeSizeType;

@ECSearchable
@ECSearchable @ECField(index=60)
@ECForeignKey(entity=BubbleFootprint.class)
@Column(nullable=false, length=UUID_MAXLEN)
@Getter @Setter private String footprint;
public boolean hasFootprint () { return footprint != null; }

@ECSearchable
@ECSearchable @ECField(index=70)
@ECForeignKey(entity=CloudService.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String storage;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=80)
@Size(max=10000, message="err.description.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(10000+ENC_PAD)+")")
@Getter @Setter private String description;

@ECSearchable @ECField(type=EntityFieldType.locale)
@ECSearchable @ECField(type=EntityFieldType.locale, index=90)
@Size(max=20, message="err.locale.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(20+ENC_PAD)+") NOT NULL")
@Getter @Setter private String locale = DEFAULT_LOCALE;

// A unicode timezone alias from: cobbzilla-utils/src/main/resources/org/cobbzilla/util/time/unicode-timezones.xml
// All unicode aliases are guaranteed to map to a Linux timezone and a Java timezone
@ECSearchable @ECField(type=EntityFieldType.time_zone)
@ECSearchable @ECField(type=EntityFieldType.time_zone, index=100)
@Size(max=100, message="err.timezone.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(100+ENC_PAD)+") NOT NULL")
@Getter @Setter private String timezone = "America/New_York";


+ 17
- 17
bubble-server/src/main/java/bubble/model/cloud/BubbleNode.java 查看文件

@@ -86,12 +86,16 @@ public class BubbleNode extends IdentifiableBase implements HasNetwork, HasBubbl

@JsonIgnore @Transient @Override public String getName() { return getFqdn(); }

@ECSearchable
@ECSearchable(filter=true) @ECField(index=10)
@ECIndex(unique=true) @Column(nullable=false, updatable=false, length=1000)
@Getter @Setter private String fqdn;

@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(fkDepth=shallow)
@ECSearchable(fkDepth=shallow) @ECField(index=30)
@ECForeignKey(entity=BubbleDomain.class)
@HasValue(message="err.network.required")
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@@ -100,7 +104,7 @@ public class BubbleNode extends IdentifiableBase implements HasNetwork, HasBubbl
return getDomain() != null && n.getDomain() != null && getDomain().equals(n.getDomain());
}

@ECSearchable(fkDepth=shallow)
@ECSearchable(fkDepth=shallow) @ECField(index=40)
@ECForeignKey(entity=BubbleNetwork.class)
@HasValue(message="err.network.required")
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@@ -109,44 +113,40 @@ public class BubbleNode extends IdentifiableBase implements HasNetwork, HasBubbl
return getNetwork() != null && n.getNetwork() != null && getNetwork().equals(n.getNetwork());
}

@ECSearchable
@ECSearchable @ECField(index=50)
@ECForeignKey(entity=BubbleNode.class, cascade=false)
@Column(length=UUID_MAXLEN)
@Getter @Setter private String sageNode;
public boolean hasSageNode() { return sageNode != null; }
public boolean selfSage() { return hasSageNode() && getSageNode().equals(getUuid()); }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=60)
@ECIndex @Column(length=250)
@Getter @Setter private String host;
public boolean hasHost () { return host != null; }

@ECSearchable(filter=true)
@ECIndex(unique=true) @Column(nullable=false, updatable=false, length=1000)
@Getter @Setter private String fqdn;

@ECSearchable
@ECSearchable @ECField(index=70)
@ECForeignKey(entity=CloudService.class)
@HasValue(message="err.cloud.required")
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String cloud;

@ECSearchable
@ECSearchable @ECField(index=80)
@HasValue(message="err.region.required")
@ECIndex @Column(nullable=false, updatable=false, length=100)
@Getter @Setter private String region;

@ECSearchable
@ECSearchable @ECField(index=90)
@HasValue(message="err.size.required")
@ECIndex @Column(nullable=false, updatable=false, length=100)
@Getter @Setter private String size;

@ECSearchable
@ECSearchable @ECField(index=100)
@Enumerated(EnumType.STRING)
@ECIndex @Column(length=20, nullable=false)
@Getter @Setter private ComputeNodeSizeType sizeType;

@ECSearchable
@ECSearchable @ECField(index=110)
@Column(nullable=false)
@Getter @Setter private int costUnits;

@@ -160,7 +160,7 @@ public class BubbleNode extends IdentifiableBase implements HasNetwork, HasBubbl
@JsonIgnore @Getter @Setter private String ansibleUser = "root";
@JsonIgnore @Transient public String getUser () { return getAnsibleUser(); }

@ECSearchable(filter=true) @ECField(type=EntityFieldType.ip4)
@ECSearchable(filter=true) @ECField(type=EntityFieldType.ip4, index=120)
@ECIndex(unique=true) @Column(length=IP4_MAXLEN)
@Getter @Setter private String ip4;
public boolean hasIp4() { return ip4 != null; }
@@ -168,7 +168,7 @@ public class BubbleNode extends IdentifiableBase implements HasNetwork, HasBubbl

public String id() { return getUuid() + "/fqdn=" + getFqdn() + "/ip4=" + getIp4(); }

@ECSearchable(filter=true) @ECField(type=EntityFieldType.ip6)
@ECSearchable(filter=true) @ECField(type=EntityFieldType.ip6, index=130)
@ECIndex(unique=true) @Column(length=IP6_MAXLEN)
@Getter @Setter private String ip6;
public boolean hasIp6() { return ip6 != null; }
@@ -181,7 +181,7 @@ public class BubbleNode extends IdentifiableBase implements HasNetwork, HasBubbl
return (hasIp4() && getIp4().equals(ip)) || (hasIp6() && getIp6().equals(ip));
}

@ECSearchable
@ECSearchable @ECField(index=140)
@Enumerated(EnumType.STRING)
@ECIndex @Column(length=20, nullable=false)
@Getter @Setter private BubbleNodeState state = created;


+ 7
- 9
bubble-server/src/main/java/bubble/model/cloud/BubbleNodeKey.java 查看文件

@@ -12,10 +12,7 @@ import org.cobbzilla.util.security.RsaKeyPair;
import org.cobbzilla.util.security.RsaMessage;
import org.cobbzilla.wizard.model.IdentifiableBase;
import org.cobbzilla.wizard.model.entityconfig.EntityFieldType;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECForeignKey;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECIndex;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECSearchable;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECType;
import org.cobbzilla.wizard.model.entityconfig.annotations.*;
import org.hibernate.annotations.Type;

import javax.persistence.Column;
@@ -82,17 +79,17 @@ public class BubbleNodeKey extends IdentifiableBase implements HasAccountNoName
return keys.stream().allMatch(k -> k.expiresInLessThan(TOKEN_GENERATION_LIMIT));
}

@ECSearchable
@ECSearchable @ECField(index=10)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=BubbleNode.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String node;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=30)
@Column(length=10000, updatable=false, nullable=false)
@Getter private String publicKey;
public BubbleNodeKey setPublicKey (String k) {
@@ -101,6 +98,7 @@ public class BubbleNodeKey extends IdentifiableBase implements HasAccountNoName
return this;
}

@ECField(index=40)
@ECIndex(unique=true) @Column(length=100, updatable=false, nullable=false)
@Getter @Setter private String publicKeyHash;

@@ -118,12 +116,12 @@ public class BubbleNodeKey extends IdentifiableBase implements HasAccountNoName
@Type(type=ENCRYPTED_STRING) @ECIndex(unique=true) @Column(updatable=false, columnDefinition="varchar("+(100+ENC_PAD)+")")
@Getter @Setter private String privateKeyHash;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=50)
@Size(max=100, message="err.remoteHost.length")
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(100+ENC_PAD)+") NOT NULL")
@Getter @Setter private String remoteHost;

@ECSearchable(type=EntityFieldType.epoch_time)
@ECSearchable(type=EntityFieldType.epoch_time) @ECField(index=60)
@ECIndex @Column(nullable=false, updatable=false)
@Getter @Setter private Long expiration = defaultExpiration();



+ 14
- 14
bubble-server/src/main/java/bubble/model/cloud/CloudService.java 查看文件

@@ -71,47 +71,47 @@ public class CloudService extends IdentifiableBaseParentEntity implements Accoun

@Override public Identifiable update(Identifiable thing) { copy(this, thing, UPDATE_FIELDS); return this; }

@ECSearchable
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.name.required")
@ECIndex @Column(nullable=false, updatable=false, length=200)
@Getter @Setter private String name;

@ECSearchable(filter=true)
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true) @ECField(index=30)
@Size(max=10000, message="err.description.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(10000+ENC_PAD)+")")
@Getter @Setter private String description;

@ECSearchable
@ECSearchable @ECField(index=40)
@HasValue(message="err.type.required")
@Enumerated(EnumType.STRING)
@ECIndex @Column(nullable=false, updatable=false, length=20)
@Getter @Setter private CloudServiceType type;

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Getter @Setter private Integer priority = 1;

@ECSearchable
@ECSearchable @ECField(index=60)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean template = false;
public boolean template() { return template != null && template; }

@ECSearchable
@ECSearchable @ECField(index=70)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;
public boolean enabled () { return enabled == null || enabled; }
public boolean disabled () { return !enabled(); }

@ECSearchable
@ECSearchable @ECField(index=80)
@ECIndex @Column(updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String delegated;
public boolean delegated() { return delegated != null; }

@ECSearchable
@ECSearchable @ECField(index=90)
@HasValue(message="err.driverClass.required")
@Column(nullable=false, length=1000)
@Getter @Setter private String driverClass;
@@ -128,7 +128,7 @@ public class CloudService extends IdentifiableBaseParentEntity implements Accoun
});
}

@ECSearchable
@ECSearchable @ECField(index=100)
@Size(max=100000, message="err.driverConfigJson.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(100000+ENC_PAD)+")")
@JsonIgnore @Getter @Setter private String driverConfigJson;


+ 10
- 10
bubble-server/src/main/java/bubble/model/cloud/CloudServiceData.java 查看文件

@@ -35,25 +35,25 @@ public class CloudServiceData extends IdentifiableBase implements HasAccount {

public CloudServiceData (CloudServiceData other) { copy(this, other, CREATE_FIELDS); }

@ECSearchable
@ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.key.required")
@ECIndex @Column(nullable=false, updatable=false, length=1000)
@Getter @Setter private String key;
public boolean hasKey () { return key != null; }

@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@Override @JsonIgnore @Transient public String getName() { return getKey(); }

@ECSearchable
@ECSearchable @ECField(index=30)
@ECForeignKey(entity=CloudService.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String cloud;

@ECSearchable(filter=true)
@HasValue(message="err.key.required")
@ECIndex @Column(nullable=false, updatable=false, length=1000)
@Getter @Setter private String key;
public boolean hasKey () { return key != null; }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=40)
@Size(max=100000, message="err.data.length")
@Type(type=ENCRYPTED_STRING) @Column(columnDefinition="varchar("+(100000+ENC_PAD)+")")
@Getter @Setter private String data;
@@ -61,7 +61,7 @@ public class CloudServiceData extends IdentifiableBase implements HasAccount {
@Transient public JsonNode getDataJson () { return data == null ? null : json(data, JsonNode.class); }
public CloudServiceData setDataJson(JsonNode n) { return setData(n == null ? null : json(n)); }

@ECSearchable
@ECSearchable @ECField(index=50)
@ECIndex @Getter @Setter private Long expiration;

}

+ 11
- 8
bubble-server/src/main/java/bubble/model/cloud/notify/NotificationBase.java 查看文件

@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.cobbzilla.wizard.model.IdentifiableBase;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECField;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECForeignKey;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECIndex;
import org.cobbzilla.wizard.model.entityconfig.annotations.ECSearchable;
@@ -28,38 +29,38 @@ import static org.cobbzilla.wizard.model.crypto.EncryptedTypes.ENC_PAD;
public class NotificationBase extends IdentifiableBase implements HasAccountNoName {

// synchronous requests may include this
@ECSearchable
@ECSearchable @ECField(index=10)
@Column(updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String notificationId;
public boolean hasId () { return notificationId != null; }

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=30)
@ECIndex @Column(nullable=false, updatable=false, length=50)
@Enumerated(EnumType.STRING) @Getter @Setter private NotificationType type;

@Getter @Setter private boolean resolveNodes = false;

@ECSearchable
@ECSearchable @ECField(index=40)
@ECForeignKey(entity=BubbleNode.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String fromNode;
public boolean hasFromNode () { return fromNode != null; }

@ECSearchable
@ECSearchable @ECField(index=50)
@ECForeignKey(entity=BubbleNode.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String toNode;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=60)
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(1024+ENC_PAD)+") NOT NULL")
@Getter @Setter private String uri;

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=70)
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(100_000+ENC_PAD)+")")
@JsonIgnore @Getter @Setter private String payloadJson;
public boolean hasPayload () { return payloadJson != null; }
@@ -69,16 +70,18 @@ public class NotificationBase extends IdentifiableBase implements HasAccountNoNa

@Transient @JsonIgnore public BubbleNode getNode() { return json(payloadJson, BubbleNode.class); }

@ECField(index=80)
@Getter @Setter private Boolean truncated = false;
public boolean truncated () { return truncated != null && truncated; }

@ECField(index=90)
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(1000+ENC_PAD)+")")
@JsonIgnore @Getter @Setter private String receiptJson;

@Transient public NotificationReceipt getReceipt () { return receiptJson == null ? null : json(receiptJson, NotificationReceipt.class); }
public <T extends NotificationBase> T setReceipt (NotificationReceipt receipt) { return (T) setReceiptJson(receipt == null ? null : json(receiptJson)); }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=100)
@Type(type=ENCRYPTED_STRING) @Column(updatable=false, columnDefinition="varchar("+(ERROR_MAXLEN+ENC_PAD)+")")
@JsonIgnore @Getter private String error;
public NotificationBase setError (String err) { this.error = ellipsis(err, ERROR_MAXLEN); return this; }


+ 1
- 1
bubble-server/src/main/java/bubble/model/cloud/notify/ReceivedNotification.java 查看文件

@@ -21,7 +21,7 @@ public class ReceivedNotification extends NotificationBase {

public ReceivedNotification(SentNotification notification) { copy(this, notification); setUuid(null); }

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=1000)
@ECIndex @Column(nullable=false, length=20)
@Enumerated(EnumType.STRING) @Getter @Setter private NotificationProcessingStatus processingStatus = NotificationProcessingStatus.received;



+ 1
- 1
bubble-server/src/main/java/bubble/model/cloud/notify/SentNotification.java 查看文件

@@ -18,7 +18,7 @@ import static bubble.ApiConstants.EP_SENT_NOTIFICATIONS;
@Entity @NoArgsConstructor @Accessors(chain=true)
public class SentNotification extends NotificationBase {

@ECSearchable
@ECSearchable @ECField(index=1000)
@ECIndex @Column(nullable=false, length=20)
@Enumerated(EnumType.STRING) @Getter @Setter private NotificationSendStatus status = NotificationSendStatus.created;



+ 8
- 8
bubble-server/src/main/java/bubble/model/device/Device.java 查看文件

@@ -49,23 +49,23 @@ public class Device extends IdentifiableBase implements HasAccount {
initTotpKey();
}

@ECSearchable(filter=true)
@ECSearchable(filter=true) @ECField(index=10)
@ECIndex @Column(nullable=false, length=500)
@Getter @Setter private String name;

@ECSearchable
@ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable @ECField(index=30)
@ECIndex @Column(nullable=false)
@Getter @Setter private Boolean enabled = true;

public boolean uninitialized () { return name.equals(UNINITIALIZED_DEVICE); }
public boolean initialized () { return !uninitialized(); }

@ECSearchable
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String account;

@ECSearchable
@ECSearchable @ECField(index=40)
@ECForeignKey(entity=BubbleNetwork.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@Getter @Setter private String network;


+ 1
- 1
bubble-web

@@ -1 +1 @@
Subproject commit 387b7c4ef4139adeb1bf504c1be4e72d6ca7156b
Subproject commit 22741cc80464c120c2eeeef4290c86a3bbc50506

+ 1
- 1
utils/cobbzilla-utils

@@ -1 +1 @@
Subproject commit e2ca56235088bbb77c748e28a4f483f50f71a790
Subproject commit d6f4b31cda97819212ba2ff6b4ca34e9536d3a9a

+ 1
- 1
utils/cobbzilla-wizard

@@ -1 +1 @@
Subproject commit 65c623153e1f2ec09eb9b6d55bf3bcefa589d5da
Subproject commit 0d30dc4bc12a93e3b3f944c101f89fc995cefe2d

正在加载...
取消
保存