tenant config colors add cssOverride

This commit is contained in:
CITE\amentis 2024-10-14 10:43:40 +03:00
parent f9c001e27d
commit 910c56064f
5 changed files with 22 additions and 91 deletions

View File

@ -2,9 +2,7 @@ package org.opencdmp.commons.types.tenantconfiguration;
public class CssColorsTenantConfigurationEntity { public class CssColorsTenantConfigurationEntity {
private String primaryColor; private String primaryColor;
private String primaryColor2; private String cssOverride;
private String primaryColor3;
private String secondaryColor;
public String getPrimaryColor() { public String getPrimaryColor() {
return primaryColor; return primaryColor;
@ -14,27 +12,11 @@ public class CssColorsTenantConfigurationEntity {
this.primaryColor = primaryColor; this.primaryColor = primaryColor;
} }
public String getPrimaryColor2() { public String getCssOverride() {
return primaryColor2; return cssOverride;
} }
public void setPrimaryColor2(String primaryColor2) { public void setCssOverride(String cssOverride) {
this.primaryColor2 = primaryColor2; this.cssOverride = cssOverride;
}
public String getPrimaryColor3() {
return primaryColor3;
}
public void setPrimaryColor3(String primaryColor3) {
this.primaryColor3 = primaryColor3;
}
public String getSecondaryColor() {
return secondaryColor;
}
public void setSecondaryColor(String secondaryColor) {
this.secondaryColor = secondaryColor;
} }
} }

View File

@ -44,9 +44,7 @@ public class CssColorsTenantConfigurationBuilder extends BaseBuilder<CssColorsTe
for (CssColorsTenantConfigurationEntity d : data) { for (CssColorsTenantConfigurationEntity d : data) {
CssColorsTenantConfiguration m = new CssColorsTenantConfiguration(); CssColorsTenantConfiguration m = new CssColorsTenantConfiguration();
if (fields.hasField(this.asIndexer(CssColorsTenantConfiguration._primaryColor))) m.setPrimaryColor(d.getPrimaryColor()); if (fields.hasField(this.asIndexer(CssColorsTenantConfiguration._primaryColor))) m.setPrimaryColor(d.getPrimaryColor());
if (fields.hasField(this.asIndexer(CssColorsTenantConfiguration._primaryColor2))) m.setPrimaryColor2(d.getPrimaryColor2()); if (fields.hasField(this.asIndexer(CssColorsTenantConfiguration._cssOverride))) m.setCssOverride(d.getCssOverride());
if (fields.hasField(this.asIndexer(CssColorsTenantConfiguration._primaryColor3))) m.setPrimaryColor3(d.getPrimaryColor3());
if (fields.hasField(this.asIndexer(CssColorsTenantConfiguration._secondaryColor))) m.setSecondaryColor(d.getSecondaryColor());
models.add(m); models.add(m);
} }
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));

View File

@ -16,12 +16,8 @@ import java.util.List;
public class CssColorsTenantConfigurationPersist { public class CssColorsTenantConfigurationPersist {
private String primaryColor; private String primaryColor;
public static final String _primaryColor = "primaryColor"; public static final String _primaryColor = "primaryColor";
private String primaryColor2; private String cssOverride;
public static final String _primaryColor2 = "primaryColor2"; public static final String _cssOverride = "cssOverride";
private String primaryColor3;
public static final String _primaryColor3 = "primaryColor3";
private String secondaryColor;
public static final String _secondaryColor = "secondaryColor";
public String getPrimaryColor() { public String getPrimaryColor() {
return primaryColor; return primaryColor;
@ -31,32 +27,14 @@ public class CssColorsTenantConfigurationPersist {
this.primaryColor = primaryColor; this.primaryColor = primaryColor;
} }
public String getPrimaryColor2() { public String getCssOverride() {
return primaryColor2; return cssOverride;
} }
public void setPrimaryColor2(String primaryColor2) { public void setCssOverride(String cssOverride) {
this.primaryColor2 = primaryColor2; this.cssOverride = cssOverride;
} }
public String getPrimaryColor3() {
return primaryColor3;
}
public void setPrimaryColor3(String primaryColor3) {
this.primaryColor3 = primaryColor3;
}
public String getSecondaryColor() {
return secondaryColor;
}
public void setSecondaryColor(String secondaryColor) {
this.secondaryColor = secondaryColor;
}
@Component(CssColorsTenantConfigurationPersist.CssColorsTenantConfigurationPersistValidator.ValidatorName) @Component(CssColorsTenantConfigurationPersist.CssColorsTenantConfigurationPersistValidator.ValidatorName)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class CssColorsTenantConfigurationPersistValidator extends BaseValidator<CssColorsTenantConfigurationPersist> { public static class CssColorsTenantConfigurationPersistValidator extends BaseValidator<CssColorsTenantConfigurationPersist> {
@ -82,14 +60,8 @@ public class CssColorsTenantConfigurationPersist {
.must(() -> !this.isEmpty(item.getPrimaryColor())) .must(() -> !this.isEmpty(item.getPrimaryColor()))
.failOn(CssColorsTenantConfigurationPersist._primaryColor).failWith(messageSource.getMessage("Validation_Required", new Object[]{CssColorsTenantConfigurationPersist._primaryColor}, LocaleContextHolder.getLocale())), .failOn(CssColorsTenantConfigurationPersist._primaryColor).failWith(messageSource.getMessage("Validation_Required", new Object[]{CssColorsTenantConfigurationPersist._primaryColor}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isEmpty(item.getPrimaryColor2())) .must(() -> !this.isEmpty(item.getCssOverride()))
.failOn(CssColorsTenantConfigurationPersist._primaryColor2).failWith(messageSource.getMessage("Validation_Required", new Object[]{CssColorsTenantConfigurationPersist._primaryColor2}, LocaleContextHolder.getLocale())), .failOn(CssColorsTenantConfigurationPersist._cssOverride).failWith(messageSource.getMessage("Validation_Required", new Object[]{CssColorsTenantConfigurationPersist._cssOverride}, LocaleContextHolder.getLocale()))
this.spec()
.must(() -> !this.isEmpty(item.getPrimaryColor3()))
.failOn(CssColorsTenantConfigurationPersist._primaryColor3).failWith(messageSource.getMessage("Validation_Required", new Object[]{CssColorsTenantConfigurationPersist._primaryColor3}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getSecondaryColor()))
.failOn(CssColorsTenantConfigurationPersist._secondaryColor).failWith(messageSource.getMessage("Validation_Required", new Object[]{CssColorsTenantConfigurationPersist._secondaryColor}, LocaleContextHolder.getLocale()))
); );
} }
} }

View File

@ -3,12 +3,9 @@ package org.opencdmp.model.tenantconfiguration;
public class CssColorsTenantConfiguration { public class CssColorsTenantConfiguration {
private String primaryColor; private String primaryColor;
public static final String _primaryColor = "primaryColor"; public static final String _primaryColor = "primaryColor";
private String primaryColor2;
public static final String _primaryColor2 = "primaryColor2"; private String cssOverride;
private String primaryColor3; public static final String _cssOverride = "cssOverride";
public static final String _primaryColor3 = "primaryColor3";
private String secondaryColor;
public static final String _secondaryColor = "secondaryColor";
public String getPrimaryColor() { public String getPrimaryColor() {
return primaryColor; return primaryColor;
@ -18,27 +15,11 @@ public class CssColorsTenantConfiguration {
this.primaryColor = primaryColor; this.primaryColor = primaryColor;
} }
public String getPrimaryColor2() { public String getCssOverride() {
return primaryColor2; return cssOverride;
} }
public void setPrimaryColor2(String primaryColor2) { public void setCssOverride(String cssOverride) {
this.primaryColor2 = primaryColor2; this.cssOverride = cssOverride;
}
public String getPrimaryColor3() {
return primaryColor3;
}
public void setPrimaryColor3(String primaryColor3) {
this.primaryColor3 = primaryColor3;
}
public String getSecondaryColor() {
return secondaryColor;
}
public void setSecondaryColor(String secondaryColor) {
this.secondaryColor = secondaryColor;
} }
} }

View File

@ -238,9 +238,7 @@ public class TenantConfigurationServiceImpl implements TenantConfigurationServic
CssColorsTenantConfigurationEntity data = new CssColorsTenantConfigurationEntity(); CssColorsTenantConfigurationEntity data = new CssColorsTenantConfigurationEntity();
if (persist == null) return data; if (persist == null) return data;
data.setPrimaryColor(persist.getPrimaryColor()); data.setPrimaryColor(persist.getPrimaryColor());
data.setPrimaryColor2(persist.getPrimaryColor2()); data.setCssOverride(persist.getCssOverride());
data.setPrimaryColor3(persist.getPrimaryColor3());
data.setSecondaryColor(persist.getSecondaryColor());
return data; return data;
} }