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 {
private String primaryColor;
private String primaryColor2;
private String primaryColor3;
private String secondaryColor;
private String cssOverride;
public String getPrimaryColor() {
return primaryColor;
@ -14,27 +12,11 @@ public class CssColorsTenantConfigurationEntity {
this.primaryColor = primaryColor;
}
public String getPrimaryColor2() {
return primaryColor2;
public String getCssOverride() {
return cssOverride;
}
public void setPrimaryColor2(String primaryColor2) {
this.primaryColor2 = primaryColor2;
}
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;
public void setCssOverride(String cssOverride) {
this.cssOverride = cssOverride;
}
}

View File

@ -44,9 +44,7 @@ public class CssColorsTenantConfigurationBuilder extends BaseBuilder<CssColorsTe
for (CssColorsTenantConfigurationEntity d : data) {
CssColorsTenantConfiguration m = new CssColorsTenantConfiguration();
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._primaryColor3))) m.setPrimaryColor3(d.getPrimaryColor3());
if (fields.hasField(this.asIndexer(CssColorsTenantConfiguration._secondaryColor))) m.setSecondaryColor(d.getSecondaryColor());
if (fields.hasField(this.asIndexer(CssColorsTenantConfiguration._cssOverride))) m.setCssOverride(d.getCssOverride());
models.add(m);
}
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 {
private String primaryColor;
public static final String _primaryColor = "primaryColor";
private String primaryColor2;
public static final String _primaryColor2 = "primaryColor2";
private String primaryColor3;
public static final String _primaryColor3 = "primaryColor3";
private String secondaryColor;
public static final String _secondaryColor = "secondaryColor";
private String cssOverride;
public static final String _cssOverride = "cssOverride";
public String getPrimaryColor() {
return primaryColor;
@ -31,32 +27,14 @@ public class CssColorsTenantConfigurationPersist {
this.primaryColor = primaryColor;
}
public String getPrimaryColor2() {
return primaryColor2;
public String getCssOverride() {
return cssOverride;
}
public void setPrimaryColor2(String primaryColor2) {
this.primaryColor2 = primaryColor2;
public void setCssOverride(String cssOverride) {
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)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class CssColorsTenantConfigurationPersistValidator extends BaseValidator<CssColorsTenantConfigurationPersist> {
@ -82,14 +60,8 @@ public class CssColorsTenantConfigurationPersist {
.must(() -> !this.isEmpty(item.getPrimaryColor()))
.failOn(CssColorsTenantConfigurationPersist._primaryColor).failWith(messageSource.getMessage("Validation_Required", new Object[]{CssColorsTenantConfigurationPersist._primaryColor}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getPrimaryColor2()))
.failOn(CssColorsTenantConfigurationPersist._primaryColor2).failWith(messageSource.getMessage("Validation_Required", new Object[]{CssColorsTenantConfigurationPersist._primaryColor2}, 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()))
.must(() -> !this.isEmpty(item.getCssOverride()))
.failOn(CssColorsTenantConfigurationPersist._cssOverride).failWith(messageSource.getMessage("Validation_Required", new Object[]{CssColorsTenantConfigurationPersist._cssOverride}, LocaleContextHolder.getLocale()))
);
}
}

View File

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

View File

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