Browse Source

name on account, plan, network, node should all be case-insensitive

tags/v0.9.16
Jonathan Cobb 4 years ago
parent
commit
468d35c24c
6 changed files with 14 additions and 6 deletions
  1. +2
    -1
      bubble-server/src/main/java/bubble/model/account/Account.java
  2. +2
    -1
      bubble-server/src/main/java/bubble/model/bill/AccountPlan.java
  3. +5
    -2
      bubble-server/src/main/java/bubble/model/cloud/BubbleNetwork.java
  4. +2
    -1
      bubble-server/src/main/java/bubble/model/cloud/BubbleNode.java
  5. +2
    -0
      bubble-server/src/main/java/bubble/service/dbfilter/EntityIterator.java
  6. +1
    -1
      bubble-web

+ 2
- 1
bubble-server/src/main/java/bubble/model/account/Account.java View File

@@ -109,7 +109,8 @@ public class Account extends IdentifiableBaseParentEntity implements TokenPrinci
@ECSearchable(filter=true) @ECField(index=10) @ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.name.required") @HasValue(message="err.name.required")
@ECIndex(unique=true) @Column(nullable=false, updatable=false, length=100) @ECIndex(unique=true) @Column(nullable=false, updatable=false, length=100)
@Getter @Setter private String name;
@Getter private String name;
public Account setName (String n) { this.name = n == null ? null : n.toLowerCase(); return this; }
public boolean hasName () { return !empty(name); } public boolean hasName () { return !empty(name); }


public static final Pattern VALID_NAME_PATTERN = Pattern.compile("^[A-Za-z][-\\.A-Za-z0-9_]+$"); public static final Pattern VALID_NAME_PATTERN = Pattern.compile("^[A-Za-z][-\\.A-Za-z0-9_]+$");


+ 2
- 1
bubble-server/src/main/java/bubble/model/bill/AccountPlan.java View File

@@ -60,7 +60,8 @@ public class AccountPlan extends IdentifiableBase implements HasNetwork {
@ECSearchable(filter=true) @ECField(index=10) @ECSearchable(filter=true) @ECField(index=10)
@Size(max=NETWORK_NAME_MAXLEN, message="err.name.length") @Size(max=NETWORK_NAME_MAXLEN, message="err.name.length")
@Column(length=NETWORK_NAME_MAXLEN, nullable=false) @Column(length=NETWORK_NAME_MAXLEN, nullable=false)
@Getter @Setter private String name;
@Getter private String name;
public AccountPlan setName (String name) { this.name = name == null ? null : name.toLowerCase(); return this; }


@ECSearchable @ECField(index=20) @ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class) @ECForeignKey(entity=Account.class)


+ 5
- 2
bubble-server/src/main/java/bubble/model/cloud/BubbleNetwork.java View File

@@ -12,6 +12,7 @@ import bubble.model.HasBubbleTags;
import bubble.model.account.Account; import bubble.model.account.Account;
import bubble.model.account.AccountSshKey; import bubble.model.account.AccountSshKey;
import bubble.model.account.HasNetwork; import bubble.model.account.HasNetwork;
import bubble.model.bill.AccountPlan;
import bubble.server.BubbleConfiguration; import bubble.server.BubbleConfiguration;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter; import lombok.Getter;
@@ -86,7 +87,8 @@ public class BubbleNetwork extends IdentifiableBase implements HasNetwork, HasBu
@HasValue(message="err.name.required") @HasValue(message="err.name.required")
@Size(min=NETWORK_NAME_MINLEN, max=NETWORK_NAME_MAXLEN, message="err.name.length") @Size(min=NETWORK_NAME_MINLEN, max=NETWORK_NAME_MAXLEN, message="err.name.length")
@ECIndex @Column(nullable=false, updatable=false, length=NETWORK_NAME_MAXLEN) @ECIndex @Column(nullable=false, updatable=false, length=NETWORK_NAME_MAXLEN)
@Getter @Setter private String name;
@Getter private String name;
public BubbleNetwork setName (String name) { this.name = name == null ? null : name.toLowerCase(); return this; }


@ECSearchable @ECField(index=20) @ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class) @ECForeignKey(entity=Account.class)
@@ -101,7 +103,8 @@ public class BubbleNetwork extends IdentifiableBase implements HasNetwork, HasBu


@ECSearchable(filter=true) @ECField(index=40, type=EntityFieldType.fqdn) @ECSearchable(filter=true) @ECField(index=40, type=EntityFieldType.fqdn)
@ECIndex @Column(nullable=false, updatable=false, length=DOMAIN_NAME_MAXLEN) @ECIndex @Column(nullable=false, updatable=false, length=DOMAIN_NAME_MAXLEN)
@Getter @Setter private String domainName; // denormalized from BubbleDomain
@Getter private String domainName; // denormalized from BubbleDomain
public BubbleNetwork setDomainName (String dn) { this.domainName = dn == null ? null : dn.toLowerCase(); return this; }


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




+ 2
- 1
bubble-server/src/main/java/bubble/model/cloud/BubbleNode.java View File

@@ -91,7 +91,8 @@ public class BubbleNode extends IdentifiableBase implements HasNetwork, HasBubbl


@ECSearchable(filter=true) @ECField(index=10) @ECSearchable(filter=true) @ECField(index=10)
@ECIndex(unique=true) @Column(nullable=false, updatable=false, length=1000) @ECIndex(unique=true) @Column(nullable=false, updatable=false, length=1000)
@Getter @Setter private String fqdn;
@Getter private String fqdn;
public BubbleNode setFqdn (String fqdn) { this.fqdn = fqdn == null ? null : fqdn.toLowerCase(); return this; }


@ECSearchable @ECField(index=20) @ECSearchable @ECField(index=20)
@ECForeignKey(entity=Account.class) @ECForeignKey(entity=Account.class)


+ 2
- 0
bubble-server/src/main/java/bubble/service/dbfilter/EntityIterator.java View File

@@ -19,11 +19,13 @@ import bubble.model.cloud.CloudService;
import lombok.Getter; import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.cobbzilla.wizard.model.Identifiable; import org.cobbzilla.wizard.model.Identifiable;
import org.cobbzilla.wizard.model.IdentifiableBase;


import java.util.*; import java.util.*;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;


import static bubble.cloud.NoopCloud.NOOP_CLOUD; import static bubble.cloud.NoopCloud.NOOP_CLOUD;
import static bubble.cloud.storage.local.LocalStorageDriver.LOCAL_STORAGE_STANDARD_BASE_DIR; import static bubble.cloud.storage.local.LocalStorageDriver.LOCAL_STORAGE_STANDARD_BASE_DIR;


+ 1
- 1
bubble-web

@@ -1 +1 @@
Subproject commit 0f08a7489d90ddca61c5cba053c3e6e8203a2e5d
Subproject commit f0c6eb4b5cc5b0c1e69d1d4e2640a6cd3e066b07

Loading…
Cancel
Save