com.fivefaces.structureclient.config.SetupEssentialStructures Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-structure-client Show documentation
Show all versions of common-structure-client Show documentation
structure Client for Five Faces
The newest version!
package com.fivefaces.structureclient.config;
import com.fivefaces.structure.schema.StructureDefinition;
import com.fivefaces.structure.schema.StructureFieldDefinition;
import com.fivefaces.structure.schema.StructureFieldType;
import com.fivefaces.structure.service.EssentialStructuresDescriptor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
@Component
@RequiredArgsConstructor
@Slf4j
public class SetupEssentialStructures implements EssentialStructuresDescriptor {
@Override
public List essentialStructures() {
return List.of(applicationDefinition(), userProfileDefinition());
}
private StructureDefinition userProfileDefinition() {
StructureDefinition structureSchema = new StructureDefinition();
structureSchema.setType("userProfile");
structureSchema.setWarehouse(true);
structureSchema.setFields(new HashMap<>() {{
put("loginId", new StructureFieldDefinition(StructureFieldType.STRING, null, null, true, true, true, true, null, false));
put("preferences", new StructureFieldDefinition(StructureFieldType.OBJECT, null, null, true, false, false, false, null, false));
put("config", new StructureFieldDefinition(StructureFieldType.OBJECT, null, null, true, false, false, false, null, false));
}});
return structureSchema;
}
private StructureDefinition applicationDefinition() {
StructureDefinition structureSchema = new StructureDefinition();
structureSchema.setType("application");
structureSchema.setWarehouse(true);
structureSchema.setFields(new HashMap<>() {{
put("application", new StructureFieldDefinition(StructureFieldType.OBJECT, null, null, true, false, false, false, null, false));
}});
return structureSchema;
}
}