@@ -9,6 +9,8 @@ import lombok.Getter; | |||||
import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; | ||||
import lombok.Setter; | import lombok.Setter; | ||||
import lombok.experimental.Accessors; | import lombok.experimental.Accessors; | ||||
import org.cobbzilla.util.collection.ArrayUtil; | |||||
import org.cobbzilla.wizard.model.Identifiable; | |||||
import org.cobbzilla.wizard.model.IdentifiableBase; | import org.cobbzilla.wizard.model.IdentifiableBase; | ||||
import org.cobbzilla.wizard.model.entityconfig.EntityFieldType; | import org.cobbzilla.wizard.model.entityconfig.EntityFieldType; | ||||
import org.cobbzilla.wizard.model.entityconfig.annotations.*; | import org.cobbzilla.wizard.model.entityconfig.annotations.*; | ||||
@@ -32,14 +34,16 @@ import static org.cobbzilla.util.reflect.ReflectionUtil.copy; | |||||
}) | }) | ||||
public class AccountPlan extends IdentifiableBase implements HasAccount { | public class AccountPlan extends IdentifiableBase implements HasAccount { | ||||
public static final String[] CREATE_FIELDS = { | |||||
"name", "description", "locale", "timezone", "domain", "network", "plan", "footprint", | |||||
"paymentMethod", "paymentMethodObject" | |||||
}; | |||||
public static final String[] UPDATE_FIELDS = {"description", "paymentMethod", "paymentMethodObject"}; | |||||
public static final String[] CREATE_FIELDS = ArrayUtil.append(UPDATE_FIELDS, | |||||
"name", "locale", "timezone", "domain", "network", "plan", "footprint"); | |||||
@SuppressWarnings("unused") | @SuppressWarnings("unused") | ||||
public AccountPlan (AccountPlan other) { copy(this, other, CREATE_FIELDS); } | public AccountPlan (AccountPlan other) { copy(this, other, CREATE_FIELDS); } | ||||
@Override public Identifiable update(Identifiable other) { copy(this, other, UPDATE_FIELDS); return this; } | |||||
@Override public void beforeCreate() { if (!hasUuid()) initUuid(); } | @Override public void beforeCreate() { if (!hasUuid()) initUuid(); } | ||||
// mirrors network name | // mirrors network name | ||||
@@ -58,7 +58,7 @@ public class BubbleNetwork extends IdentifiableBase implements HasNetwork, HasBu | |||||
@Override public Identifiable update(Identifiable other) { copy(this, other, UPDATE_FIELDS); return this; } | @Override public Identifiable update(Identifiable other) { copy(this, other, UPDATE_FIELDS); return this; } | ||||
@Override public void beforeCreate() { | @Override public void beforeCreate() { | ||||
if (!hasUuid() && !getUuid().equals(ROOT_NETWORK_UUID)) super.beforeCreate(); | |||||
if (!hasUuid() || !getUuid().equals(ROOT_NETWORK_UUID)) super.beforeCreate(); | |||||
} | } | ||||
@Transient @JsonIgnore public String getNetwork () { return getUuid(); } | @Transient @JsonIgnore public String getNetwork () { return getUuid(); } | ||||
@@ -19,6 +19,7 @@ public class DevServerTest extends ActivatedBubbleModelTestBase { | |||||
@Override protected boolean dropPreExistingDatabase() { return false; } | @Override protected boolean dropPreExistingDatabase() { return false; } | ||||
@Override protected boolean allowPreExistingDatabase() { return true; } | @Override protected boolean allowPreExistingDatabase() { return true; } | ||||
@Override public boolean doTruncateDb() { return false; } | @Override public boolean doTruncateDb() { return false; } | ||||
@Override protected boolean createSqlIndexes () { return true; } | |||||
@Override public void onStart(RestServer<BubbleConfiguration> server) { | @Override public void onStart(RestServer<BubbleConfiguration> server) { | ||||
getConfiguration().getBean(EntityConfigsResource.class).getAllowPublic().set(true); | getConfiguration().getBean(EntityConfigsResource.class).getAllowPublic().set(true); | ||||
@@ -15,6 +15,7 @@ public class NewBlankDevServerTest extends BubbleModelTestBase { | |||||
@Override protected String getManifest() { return "manifest-empty"; } | @Override protected String getManifest() { return "manifest-empty"; } | ||||
@Override protected boolean useMocks() { return false; } | @Override protected boolean useMocks() { return false; } | ||||
@Override protected boolean createSqlIndexes () { return true; } | |||||
@Override public void onStart(RestServer<BubbleConfiguration> server) { | @Override public void onStart(RestServer<BubbleConfiguration> server) { | ||||
getConfiguration().getBean(EntityConfigsResource.class).getAllowPublic().set(true); | getConfiguration().getBean(EntityConfigsResource.class).getAllowPublic().set(true); | ||||
@@ -1 +1 @@ | |||||
Subproject commit 65acdc3d8f9ffc6f51f2c3f481e9d7b814543733 | |||||
Subproject commit c04be671c012a2a7454de143836af0a87bf5f175 |