Quellcode durchsuchen

Extract some needed max length constants

tags/v0.10.5
Kristijan Mitrovic vor 4 Jahren
Ursprung
Commit
16ae49a3a2
4 geänderte Dateien mit 10 neuen und 6 gelöschten Zeilen
  1. +1
    -1
      bubble-server/src/main/java/bubble/model/account/Account.java
  2. +2
    -1
      bubble-server/src/main/java/bubble/model/bill/AccountPaymentMethod.java
  3. +5
    -3
      bubble-server/src/main/java/bubble/model/bill/Bill.java
  4. +2
    -1
      bubble-server/src/main/java/bubble/model/bill/BubblePlan.java

+ 1
- 1
bubble-server/src/main/java/bubble/model/account/Account.java Datei anzeigen

@@ -108,7 +108,7 @@ public class Account extends IdentifiableBaseParentEntity implements TokenPrinci

@ECSearchable(filter=true) @ECField(index=10)
@HasValue(message="err.name.required")
@ECIndex(unique=true) @Column(nullable=false, updatable=false, length=100)
@ECIndex(unique=true) @Column(nullable=false, updatable=false, length=NAME_MAX_LENGTH)
@Getter private String name;
public Account setName (String n) { this.name = n == null ? null : n.toLowerCase(); return this; }
public boolean hasName () { return !empty(name); }


+ 2
- 1
bubble-server/src/main/java/bubble/model/bill/AccountPaymentMethod.java Datei anzeigen

@@ -83,7 +83,8 @@ public class AccountPaymentMethod extends IdentifiableBase implements HasAccount

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

@ECSearchable @ECField(index=60)


+ 5
- 3
bubble-server/src/main/java/bubble/model/bill/Bill.java Datei anzeigen

@@ -30,6 +30,8 @@ import static org.cobbzilla.wizard.model.entityconfig.annotations.ECForeignKeySe
})
public class Bill extends IdentifiableBase implements HasAccountNoName {

public static final int PERIOD_FIELDS_MAX_LENGTH = 20;

@ECSearchable(fkDepth=shallow) @ECField(index=10)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)
@@ -53,15 +55,15 @@ public class Bill extends IdentifiableBase implements HasAccountNoName {
public boolean unpaid() { return !paid(); }

@ECSearchable @ECField(index=50, type=EntityFieldType.opaque_string)
@Column(nullable=false, updatable=false, length=20)
@Column(nullable=false, updatable=false, length=PERIOD_FIELDS_MAX_LENGTH)
@ECIndex @Getter @Setter private String periodLabel;

@ECSearchable @ECField(index=60, type=EntityFieldType.opaque_string)
@Column(nullable=false, updatable=false, length=20)
@Column(nullable=false, updatable=false, length=PERIOD_FIELDS_MAX_LENGTH)
@Getter @Setter private String periodStart;

@ECSearchable @ECField(index=70, type=EntityFieldType.opaque_string)
@Column(nullable=false, updatable=false, length=20)
@Column(nullable=false, updatable=false, length=PERIOD_FIELDS_MAX_LENGTH)
@Getter @Setter private String periodEnd;

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


+ 2
- 1
bubble-server/src/main/java/bubble/model/bill/BubblePlan.java Datei anzeigen

@@ -41,6 +41,7 @@ import static org.cobbzilla.util.reflect.ReflectionUtil.copy;
@Entity @NoArgsConstructor @Accessors(chain=true)
public class BubblePlan extends IdentifiableBaseParentEntity implements HasAccount, HasPriority {

public static final int PLAN_NAME_MAX_LENGTH = 200;
public static final int MAX_CHARGENAME_LEN = 12;

public static final String[] UPDATE_FIELDS = {
@@ -59,7 +60,7 @@ public class BubblePlan extends IdentifiableBaseParentEntity implements HasAccou

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

@ECSearchable @ECField(index=20)


Laden…
Abbrechen
Speichern