All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fivefaces.structureclient.config.SetupEssentialStructures Maven / Gradle / Ivy

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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy