diff --git a/.idea/.gitignore b/.idea/.gitignore index 13566b8..86c5dc6 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -6,3 +6,6 @@ # Datasource local storage ignored files /dataSources/ /dataSources.local.xml + +# files that may contain internal information and should not be shared publicly +jarRepositories.xml diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index 831cd38..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8376545..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/api/pom.xml b/api/pom.xml index 74a4106..adb1bd4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -58,6 +58,14 @@ jackson-databind + + + org.projectlombok + lombok + 1.18.46 + compile + + junit diff --git a/api/src/main/java/info/rexs/io/RexsIoFormat.java b/api/src/main/java/info/rexs/io/RexsIoFormat.java index 6709974..ebc9531 100644 --- a/api/src/main/java/info/rexs/io/RexsIoFormat.java +++ b/api/src/main/java/info/rexs/io/RexsIoFormat.java @@ -23,7 +23,9 @@ import info.rexs.io.xml.RexsXmlFileWriter; import info.rexs.io.zip.RexsZipFileReader; import info.rexs.io.zip.RexsZipFileWriter; +import lombok.Getter; +@Getter public enum RexsIoFormat { JSON("rexsj", "rexs.json") { @@ -68,10 +70,6 @@ public AbstractRexsFileReader createNewFileReader(Resource rexsInputFileResource private final String[] endings; - public String[] getEndings() { - return endings; - } - public boolean hasEnding(String filename) { if (filename == null) return false; diff --git a/api/src/main/java/info/rexs/io/json/model/Accumulation.java b/api/src/main/java/info/rexs/io/json/model/Accumulation.java index 20a9475..9cc2398 100644 --- a/api/src/main/java/info/rexs/io/json/model/Accumulation.java +++ b/api/src/main/java/info/rexs/io/json/model/Accumulation.java @@ -22,7 +22,7 @@ public class Accumulation { @JsonProperty("components") private List components = new ArrayList<>(); @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("components") public List getComponents() { diff --git a/api/src/main/java/info/rexs/io/json/model/Component.java b/api/src/main/java/info/rexs/io/json/model/Component.java index 2b704a8..1f8d798 100644 --- a/api/src/main/java/info/rexs/io/json/model/Component.java +++ b/api/src/main/java/info/rexs/io/json/model/Component.java @@ -32,7 +32,7 @@ public class Component { @JsonProperty("attributes") private List attributes = new ArrayList<>(); @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("id") public Integer getId() { diff --git a/api/src/main/java/info/rexs/io/json/model/FloatingPointArrayCoded.java b/api/src/main/java/info/rexs/io/json/model/FloatingPointArrayCoded.java index 689e6ac..cc0ec4c 100644 --- a/api/src/main/java/info/rexs/io/json/model/FloatingPointArrayCoded.java +++ b/api/src/main/java/info/rexs/io/json/model/FloatingPointArrayCoded.java @@ -23,7 +23,7 @@ public class FloatingPointArrayCoded { @JsonProperty("value") private String value; @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("code") public String getCode() { diff --git a/api/src/main/java/info/rexs/io/json/model/FloatingPointMatrixCoded.java b/api/src/main/java/info/rexs/io/json/model/FloatingPointMatrixCoded.java index 46ba518..b2cf32e 100644 --- a/api/src/main/java/info/rexs/io/json/model/FloatingPointMatrixCoded.java +++ b/api/src/main/java/info/rexs/io/json/model/FloatingPointMatrixCoded.java @@ -29,7 +29,7 @@ public class FloatingPointMatrixCoded { @JsonProperty("value") private String value; @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("code") public String getCode() { diff --git a/api/src/main/java/info/rexs/io/json/model/JSONModel.java b/api/src/main/java/info/rexs/io/json/model/JSONModel.java index 2646aaa..9f936de 100644 --- a/api/src/main/java/info/rexs/io/json/model/JSONModel.java +++ b/api/src/main/java/info/rexs/io/json/model/JSONModel.java @@ -20,7 +20,7 @@ public class JSONModel { @JsonProperty("model") private Model model; @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("model") public Model getModel() { diff --git a/api/src/main/java/info/rexs/io/json/model/LoadCase.java b/api/src/main/java/info/rexs/io/json/model/LoadCase.java index e6d34f6..9b71c64 100644 --- a/api/src/main/java/info/rexs/io/json/model/LoadCase.java +++ b/api/src/main/java/info/rexs/io/json/model/LoadCase.java @@ -25,7 +25,7 @@ public class LoadCase { @JsonProperty("components") private List components = new ArrayList<>(); @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("id") public Integer getId() { diff --git a/api/src/main/java/info/rexs/io/json/model/LoadSpectrum.java b/api/src/main/java/info/rexs/io/json/model/LoadSpectrum.java index 69d57ae..71e0b9e 100644 --- a/api/src/main/java/info/rexs/io/json/model/LoadSpectrum.java +++ b/api/src/main/java/info/rexs/io/json/model/LoadSpectrum.java @@ -28,7 +28,7 @@ public class LoadSpectrum { @JsonProperty("accumulation") private Accumulation accumulation; @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("id") public Integer getId() { diff --git a/api/src/main/java/info/rexs/io/json/model/Model.java b/api/src/main/java/info/rexs/io/json/model/Model.java index 4cf3c7c..b202baa 100644 --- a/api/src/main/java/info/rexs/io/json/model/Model.java +++ b/api/src/main/java/info/rexs/io/json/model/Model.java @@ -43,7 +43,7 @@ public class Model { @JsonProperty("load_spectrum") private LoadSpectrum loadSpectrum; @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("version") public String getVersion() { diff --git a/api/src/main/java/info/rexs/io/json/model/Ref.java b/api/src/main/java/info/rexs/io/json/model/Ref.java index 96cf226..317a7ac 100644 --- a/api/src/main/java/info/rexs/io/json/model/Ref.java +++ b/api/src/main/java/info/rexs/io/json/model/Ref.java @@ -26,7 +26,7 @@ public class Ref { @JsonProperty("hint") private String hint; @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("id") public Integer getId() { diff --git a/api/src/main/java/info/rexs/io/json/model/Relation.java b/api/src/main/java/info/rexs/io/json/model/Relation.java index c21a375..a70e897 100644 --- a/api/src/main/java/info/rexs/io/json/model/Relation.java +++ b/api/src/main/java/info/rexs/io/json/model/Relation.java @@ -31,7 +31,7 @@ public class Relation { @JsonProperty("refs") private List refs = new ArrayList<>(); @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("id") public Integer getId() { diff --git a/api/src/main/java/info/rexs/io/json/model/attributes/FloatingPointAttribute.java b/api/src/main/java/info/rexs/io/json/model/attributes/FloatingPointAttribute.java index d6e3d9a..0320f55 100644 --- a/api/src/main/java/info/rexs/io/json/model/attributes/FloatingPointAttribute.java +++ b/api/src/main/java/info/rexs/io/json/model/attributes/FloatingPointAttribute.java @@ -21,7 +21,7 @@ public class FloatingPointAttribute extends Attribute{ @JsonProperty("floating_point") private Double floatingPoint; @JsonIgnore - private Map additionalProperties = new HashMap<>(); + private final Map additionalProperties = new HashMap<>(); @JsonProperty("floating_point") public Double getFloatingPoint() { diff --git a/api/src/main/java/info/rexs/model/RexsAttribute.java b/api/src/main/java/info/rexs/model/RexsAttribute.java index f6a6ee1..2660e36 100644 --- a/api/src/main/java/info/rexs/model/RexsAttribute.java +++ b/api/src/main/java/info/rexs/model/RexsAttribute.java @@ -19,11 +19,6 @@ import java.util.List; import java.util.Objects; -import info.rexs.schema.constants.RexsAttributeId; -import info.rexs.schema.constants.RexsUnitId; -import info.rexs.schema.constants.RexsValueType; -import info.rexs.schema.constants.standard.RexsStandardAttributeIds; -import info.rexs.schema.constants.standard.RexsStandardUnitIds; import info.rexs.model.value.AbstractRexsAttributeValue; import info.rexs.model.value.RexsAttributeValueArray; import info.rexs.model.value.RexsAttributeValueArrayBase64; @@ -31,6 +26,12 @@ import info.rexs.model.value.RexsAttributeValueMatrix; import info.rexs.model.value.RexsAttributeValueMatrixBase64; import info.rexs.model.value.RexsAttributeValueScalar; +import info.rexs.schema.constants.RexsAttributeId; +import info.rexs.schema.constants.RexsUnitId; +import info.rexs.schema.constants.RexsValueType; +import info.rexs.schema.constants.standard.RexsStandardAttributeIds; +import info.rexs.schema.constants.standard.RexsStandardUnitIds; +import lombok.Getter; /** * This class represents an attribute of a REXS model. @@ -39,16 +40,28 @@ */ public class RexsAttribute { - /** The ID of the attribute. */ + /** + * The ID of the attribute as a {@link RexsAttributeId}. + */ + @Getter private RexsAttributeId attributeId; - /** The origin ID of the attribute */ - private String originAttributeId; + /** + * The origin ID of the attribute as a {@link String}. + */ + @Getter + private final String originAttributeId; - /** The unit of the attribute. */ + /** + * The unit of the attribute as a {@link RexsUnitId}. + */ + @Getter private RexsUnitId unit; - /** The orign unti of the attribute */ + /** + * The origin unit of the attribute as a {@link String}. + */ + @Getter private String originUnit; /**The value of the attribute */ @@ -108,43 +121,11 @@ public RexsAttribute(RexsAttribute attribute) { this.setRawValue(attribute.value.copy()); } - /** - * @return - * The ID of the attribute as a {@link RexsAttributeId}. - */ - public RexsAttributeId getAttributeId() { - return attributeId; - } - - /** - * @return - * The origin ID of the attribute as a {@link String}. - */ - public String getOriginAttributeId() { - return originAttributeId; - } - - /** - * @return - * The unit of the attribute as {@link RexsUnitId}. - */ - public RexsUnitId getUnit() { - return unit; - } - public void setUnit(RexsUnitId unit) { this.unit = unit; this.originUnit = unit.getId(); } - /** - * @return - * The origing unit of the attribute as a {@link String}. - */ - public String getOriginUnit() { - return originUnit; - } - /** * @return * The value of the attribute as a {@link AbstractRexsAttributeValue}. diff --git a/api/src/main/java/info/rexs/model/RexsComponent.java b/api/src/main/java/info/rexs/model/RexsComponent.java index 30f9647..db14fe9 100644 --- a/api/src/main/java/info/rexs/model/RexsComponent.java +++ b/api/src/main/java/info/rexs/model/RexsComponent.java @@ -26,6 +26,8 @@ import info.rexs.schema.constants.RexsComponentType; import info.rexs.schema.constants.RexsUnitId; import info.rexs.schema.constants.RexsValueType; +import lombok.Getter; +import lombok.Setter; /** * This class represents an component of a REXS model. @@ -34,20 +36,31 @@ */ public class RexsComponent implements Comparable { - /** The numeric ID of the component within the REXS model. */ + /** + * The numeric ID of the component within the REXS model. + */ + @Getter private Integer id; - /** The type of the component. */ + /** + * The type of the component as a {@link RexsComponentType}. + */ + @Setter + @Getter private RexsComponentType type; - /** The origin type of the component */ - private String originType; + /** + * The origin type of the component as a {@link String}. + */ + @Getter + private final String originType; /** The name of the component */ + @Setter private String name; /** An internal index with all attributes of the component for quick access. */ - private Map attributes = new HashMap<>(); + private final Map attributes = new HashMap<>(); /** * Constructs a new {@link RexsComponent} for the given properties. @@ -95,30 +108,6 @@ public RexsComponent(RexsComponent component) { } } - /** - * @return - * The numeric ID of the component within the REXS model. - */ - public Integer getId() { - return id; - } - - /** - * @return - * The type of the component as {@link RexsComponentType}. - */ - public RexsComponentType getType() { - return type; - } - - /** - * @return - * The orign type of the component as a {@link String}. - */ - public String getOriginType() { - return originType; - } - /** * @return * The name of the component within the REXS model. @@ -129,10 +118,6 @@ public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - /** * @return * All attributes assigned to the component as a {@link Collection} of {@link RexsAttribute}. @@ -1045,10 +1030,6 @@ public void setId(Integer newCompId) { this.id = newCompId; } - public void setType(RexsComponentType newType) { - this.type = newType; - } - @Override public boolean equals(Object o) { if (o == this) { diff --git a/api/src/main/java/info/rexs/model/RexsLoadSpectrum.java b/api/src/main/java/info/rexs/model/RexsLoadSpectrum.java index ed6ac50..c2b0992 100644 --- a/api/src/main/java/info/rexs/model/RexsLoadSpectrum.java +++ b/api/src/main/java/info/rexs/model/RexsLoadSpectrum.java @@ -20,6 +20,9 @@ import java.util.List; import java.util.Map; +import lombok.Getter; +import lombok.Setter; + /** * This class represents a load spectrum of a REXS model. * @@ -27,13 +30,20 @@ */ public class RexsLoadSpectrum { - /** The numeric ID of the load spectrum within the REXS model. */ - private Integer id; + /** + * The numeric ID of the load spectrum within the REXS model. + */ + @Getter + private final Integer id; /** An internal index with all load cases of the load spectrum for quick access. */ protected Map loadCases = new HashMap<>(); - /** The sub-model for accumulated values of this load spectrum. */ + /** + * The sub-model for accumulated values of this load spectrum. + */ + @Setter + @Getter private RexsSubModel accumulation = new RexsSubModel(); /** @@ -60,13 +70,6 @@ public RexsLoadSpectrum(RexsLoadSpectrum spectrum) { } this.accumulation = new RexsSubModel(spectrum.accumulation); } - /** - * @return - * The numeric ID of the load spectrum within the REXS model. - */ - public Integer getId() { - return id; - } /** * @return @@ -99,21 +102,4 @@ public void addLoadCase(RexsSubModel loadCase) { this.loadCases.put(loadCase.getId(), loadCase); } - /** - * @return - * The sub-model for accumulated values of this load spectrum. - */ - public RexsSubModel getAccumulation() { - return accumulation; - } - - /** - * Sets the accumulation of the load spectrum. - * - * @param accumulation - * The new accumulation as a {@link RexsSubModel}. - */ - public void setAccumulation(RexsSubModel accumulation) { - this.accumulation = accumulation; - } } diff --git a/api/src/main/java/info/rexs/model/RexsModel.java b/api/src/main/java/info/rexs/model/RexsModel.java index 999865d..bb2fecf 100644 --- a/api/src/main/java/info/rexs/model/RexsModel.java +++ b/api/src/main/java/info/rexs/model/RexsModel.java @@ -34,6 +34,8 @@ import info.rexs.schema.constants.standard.RexsStandardComponentTypes; import info.rexs.schema.constants.standard.RexsStandardRelationRoles; import info.rexs.schema.constants.standard.RexsStandardRelationTypes; +import lombok.Getter; +import lombok.Setter; /** * This class represents a REXS model. @@ -42,35 +44,55 @@ */ public class RexsModel implements IRexsModel { - /** The version of the REXS model. */ + /** + * The version of the REXS model as a {@link RexsVersion}. + */ + @Setter + @Getter private RexsVersion version; - /** The origin version of the REXS model */ - private String originVersion; + /** + * The origin version of the REXS model as a {@link String}. + */ + @Getter + private final String originVersion; - /** Name of the application that created the REXS model, e.g. "FVA Workbench". */ + /** + * The name of the application that created the REXS model, e.g. "FVA Workbench". + */ + @Setter + @Getter private String applicationId; - /** Version of the application. */ - private String applicationVersion; + /** + * The version of the application as a {@link String}. + */ + @Getter + private final String applicationVersion; - /** All relations of the model as a {@link List} of {@link RexsRelation}. */ + /** + * All relations of the model as a {@link List} of {@link RexsRelation}. + */ + @Getter protected List relations = new ArrayList<>(); - /** All load spectrums of the model as a {@link List} of {@link RexsLoadSpectrum}. */ + /** + * All load spectrums of the model as a {@link List} of {@link RexsLoadSpectrum}. + */ + @Getter protected List loadSpectrums = new ArrayList<>(); /** An internal index with all components of the model for quick access. */ - private Map components = new HashMap<>(); + private final Map components = new HashMap<>(); /** An internal index with all components of the component types in the model for quick access. */ - private Map> mapTypeToComponent = new HashMap<>(); + private final Map> mapTypeToComponent = new HashMap<>(); /** An internal index with all relations of the component in the model for quick access. */ - private Map> mapMainCompToRelation = new HashMap<>(); + private final Map> mapMainCompToRelation = new HashMap<>(); /** An internal index with all relations of the relation types in the model for quick access. */ - private Map> mapTypeToRelation = new HashMap<>(); + private final Map> mapTypeToRelation = new HashMap<>(); /** * Constructs a new {@link RexsModel} from scratch. @@ -127,46 +149,6 @@ protected RexsModel(RexsVersion version, String applicationId, String applicatio this.applicationVersion = applicationVersion; } - /** - * @return - * The version of the REXS model as a {@link RexsVersion}. - */ - public RexsVersion getVersion() { - return version; - } - - public void setVersion(RexsVersion version) { - this.version = version; - } - - /** - * @return - * The origin version of the REXS model as a {@link String}. - */ - public String getOriginVersion() { - return originVersion; - } - - /** - * @return - * The name of the application that created the REXS model as a {@link String}. - */ - public String getApplicationId() { - return applicationId; - } - - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * @return - * The version of the application as a {@link String}. - */ - public String getApplicationVersion() { - return applicationVersion; - } - /** * @return * All components of the model as a {@link List} of {@link RexsComponent}. @@ -184,22 +166,6 @@ public List getComponentsSorted() { return components.keySet().stream().sorted().map(this::getComponent).collect(Collectors.toList()); } - /** - * @return - * All relations of the model as a {@link List} of {@link RexsRelation}. - */ - public List getRelations() { - return relations; - } - - /** - * @return - * All load spectrums of the model as a {@link List} of {@link RexsLoadSpectrum}. - */ - public List getLoadSpectrums() { - return loadSpectrums; - } - /** * Adds a load spectrum to the REXS model. * diff --git a/api/src/main/java/info/rexs/model/RexsModelAccessException.java b/api/src/main/java/info/rexs/model/RexsModelAccessException.java index 0ebe859..3c817e4 100644 --- a/api/src/main/java/info/rexs/model/RexsModelAccessException.java +++ b/api/src/main/java/info/rexs/model/RexsModelAccessException.java @@ -15,11 +15,14 @@ */ package info.rexs.model; +import lombok.Getter; + /** * Thrown to indicate that there is illegal access to the REXS model. * * @author FVA GmbH */ +@Getter public class RexsModelAccessException extends RuntimeException { /** Serial Version UID for interoperability */ @@ -94,11 +97,4 @@ public RexsModelAccessException(RexsComponent rexsComponent, String message, Thr this.componentName = rexsComponent.getName(); } - public int getComponentId() { - return componentId; - } - - public String getComponentName() { - return componentName; - } } diff --git a/api/src/main/java/info/rexs/model/RexsModelObjectFactory.java b/api/src/main/java/info/rexs/model/RexsModelObjectFactory.java index b3e2345..3cb91df 100644 --- a/api/src/main/java/info/rexs/model/RexsModelObjectFactory.java +++ b/api/src/main/java/info/rexs/model/RexsModelObjectFactory.java @@ -20,6 +20,8 @@ import info.rexs.schema.constants.RexsRelationRole; import info.rexs.schema.constants.RexsRelationType; import info.rexs.schema.constants.RexsVersion; +import lombok.Getter; +import lombok.Setter; /** * TODO Document me! @@ -28,27 +30,12 @@ */ public class RexsModelObjectFactory { - private static RexsModelObjectFactory instance = new RexsModelObjectFactory(); - /** - * TODO Document me! - * - * @param newInstance - * TODO Document me! + * The singleton factory instance. */ - public static void setInstance(RexsModelObjectFactory newInstance) { - instance = newInstance; - } - - /** - * TODO Document me! - * - * @return - * TODO Document me! - */ - public static RexsModelObjectFactory getInstance() { - return instance; - } + @Setter + @Getter + private static RexsModelObjectFactory instance = new RexsModelObjectFactory(); /** * Creates a new {@link RexsModel} for the given properties. diff --git a/api/src/main/java/info/rexs/model/RexsRelation.java b/api/src/main/java/info/rexs/model/RexsRelation.java index 1b74caf..17512fb 100644 --- a/api/src/main/java/info/rexs/model/RexsRelation.java +++ b/api/src/main/java/info/rexs/model/RexsRelation.java @@ -24,6 +24,8 @@ import info.rexs.schema.constants.RexsRelationType; import info.rexs.schema.constants.standard.RexsStandardRelationRoles; import info.rexs.schema.constants.standard.RexsStandardRelationTypes; +import lombok.Getter; +import lombok.Setter; /** * This class represents a relation of a REXS model. @@ -32,20 +34,33 @@ */ public class RexsRelation { - /** The numeric ID of the relation. */ + /** + * The numeric ID of the relation as an {@link Integer}. + */ + @Getter private final Integer id; - /** The type of the relation. */ - private RexsRelationType type; + /** + * The type of the relation as a {@link RexsRelationType}. + */ + @Getter + private final RexsRelationType type; - /** Optional order for sorting in the case of several relations. */ + /** + * Optional order for sorting in the case of several relations. + */ + @Setter + @Getter private Integer order; - /** All relation references of the relation. */ - private List refs = new ArrayList<>(); + /** + * All relation references of the relation as a {@link List} of {@link RexsRelationRef}. + */ + @Getter + private final List refs = new ArrayList<>(); /** A set with all component IDs of this relation. */ - private Set componentIds = new HashSet<>(); + private final Set componentIds = new HashSet<>(); /** * Constructs a new {@link RexsRelation} for the given properties. @@ -92,48 +107,6 @@ public RexsRelation(RexsRelation relation) { } } - /** - * @return - * The ID of the relation as {@link Integer}. - */ - public Integer getId() { - return id; - } - - /** - * @return - * The type of the relation as {@link RexsRelationType}. - */ - public RexsRelationType getType() { - return type; - } - - - /** - * @return - * The order of the relation as {@link Integer}. - */ - public Integer getOrder() { - return order; - } - - /** - * Sets the order of the relation. - * - * @param order - * The order of the relation as a {@link Integer}. - */ - public void setOrder(Integer order) { - this.order = order; - } - - /** - * @return - * All relation references of the relation as a {@link List} of {@link RexsRelationRef}. - */ - public List getRefs() { - return refs; - } /** * Adds a relation reference to the relation. diff --git a/api/src/main/java/info/rexs/model/RexsRelationRef.java b/api/src/main/java/info/rexs/model/RexsRelationRef.java index 5d0ee09..f3da2fe 100644 --- a/api/src/main/java/info/rexs/model/RexsRelationRef.java +++ b/api/src/main/java/info/rexs/model/RexsRelationRef.java @@ -16,22 +16,33 @@ package info.rexs.model; import info.rexs.schema.constants.RexsRelationRole; +import lombok.Getter; +import lombok.Setter; /** * This class represents a relation reference of a REXS model. * * @author FVA GmbH */ +@Getter public class RexsRelationRef { - /** The numeric ID of the relation reference */ + /** + * The numeric ID of the relation reference as an {@link Integer}. + */ + @Setter private Integer id; - /** The role of the relation reference */ + /** + * The role of the relation reference as a {@link RexsRelationRole}. + */ + @Setter private RexsRelationRole role; - /** Optional note for better readability of the relation reference. */ - private String hint; + /** + * Optional note for better readability of the relation reference. + */ + private final String hint; /** * Constructs a new {@link RexsRelationRef} for the given properties. @@ -74,42 +85,5 @@ public RexsRelationRef(RexsRelationRef reference) { this.hint = reference.hint; } - /** - * @return - * The ID of the relation reference as a {@link Integer}. - */ - public Integer getId() { - return id; - } - /** - * Sets the ID of the relation reference. - * - * @param id - * The ID of the relation reference as a {@link Integer}. - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * @return - * The role of the relation reference as a {@link RexsRelationRole}. - */ - public RexsRelationRole getRole() { - return role; - } - - public void setRole(RexsRelationRole role) { - this.role = role; - } - - - /** - * @return - * The hint of the relation reference as a {@link String}. - */ - public String getHint() { - return hint; - } } diff --git a/api/src/main/java/info/rexs/model/RexsSubModel.java b/api/src/main/java/info/rexs/model/RexsSubModel.java index 6484c10..89f5f81 100644 --- a/api/src/main/java/info/rexs/model/RexsSubModel.java +++ b/api/src/main/java/info/rexs/model/RexsSubModel.java @@ -22,6 +22,7 @@ import java.util.stream.Collectors; import info.rexs.schema.constants.standard.RexsStandardAttributeIds; +import lombok.Getter; /** * This class represents a sub-model (containing only the varied data) of a REXS model. @@ -33,10 +34,16 @@ public class RexsSubModel implements Comparable,IRexsModel { /** An internal index with all components of the sub-model for quick access. */ protected Map components = new HashMap<>(); - /** The numeric ID of the sub-model within the REXS model. */ - private Integer id; + /** + * The numeric ID of the sub-model within the REXS model. + */ + @Getter + private final Integer id; - /** Indicates whether it is a separate sub-model for accumulated values. */ + /** + * Indicates whether it is a separate sub-model for accumulated values. + */ + @Getter private boolean isAccumulation = false; /** @@ -83,23 +90,8 @@ public RexsSubModel(RexsSubModel subModel) { this.addComponent(rexsComponent); } } - /** - * @return - * The numeric ID of the sub-model within the REXS model. - */ - public Integer getId() { - return id; - } /** - * @return - * {@code true} if it is a separate sub-model for accumulated values, otherwise {@code false}. - */ - public boolean isAccumulation() { - return isAccumulation; - } - -/** * @return * All components of the sub-model as a {@link List} of {@link RexsComponent}. */ diff --git a/api/src/main/java/info/rexs/model/value/Base64Type.java b/api/src/main/java/info/rexs/model/value/Base64Type.java index 9e9a91f..7fbb550 100644 --- a/api/src/main/java/info/rexs/model/value/Base64Type.java +++ b/api/src/main/java/info/rexs/model/value/Base64Type.java @@ -15,6 +15,9 @@ */ package info.rexs.model.value; +import lombok.Getter; + +@Getter public enum Base64Type { INT_32("int32"), @@ -27,10 +30,6 @@ private Base64Type(String code) { this.code = code; } - public String getCode() { - return code; - } - public static Base64Type fromCode(String code) { for (Base64Type type: Base64Type.values()) { if (type.code.equals(code)) { diff --git a/api/src/main/java/info/rexs/schema/RexsSchemaFile.java b/api/src/main/java/info/rexs/schema/RexsSchemaFile.java index 632d3bb..a215043 100644 --- a/api/src/main/java/info/rexs/schema/RexsSchemaFile.java +++ b/api/src/main/java/info/rexs/schema/RexsSchemaFile.java @@ -22,6 +22,7 @@ import info.rexs.schema.constants.RexsVersion; import info.rexs.schema.constants.standard.RexsStandardVersions; +import lombok.Getter; /** * This class represents a REXS schema file. @@ -38,7 +39,7 @@ public class RexsSchemaFile { private static final RexsSchemaFileResolver DEFAULT_FILE_RESOLVER = new RexsSchemaFileResolver(); /** An internal index with all created REXS schema files (REXS standard and own) for quick access. */ - private static Set allRexsSchemaFiles = new HashSet<>(); + private static final Set allRexsSchemaFiles = new HashSet<>(); /** REXS 1.0 */ public static final RexsSchemaFile V1_0 = create(RexsStandardVersions.V1_0); @@ -67,7 +68,10 @@ public class RexsSchemaFile { /** REXS 2.0.0 */ public static final RexsSchemaFile V2_0_0 = create(RexsStandardVersions.V2_0_0); - /** The {@link RexsVersion} of the REXS schema file. */ + /** + * The {@link RexsVersion} of the REXS schema file. + */ + @Getter private final RexsVersion version; /** The {@link RexsSchemaFileResolver} for the REXS schema file. */ @@ -80,14 +84,6 @@ private RexsSchemaFile(RexsVersion version, RexsSchemaFileResolver fileResolver) this.fileResolver = fileResolver; } - /** - * @return - * The {@link RexsVersion} of the REXS schema file. - */ - public RexsVersion getVersion() { - return version; - } - /** * Opens an input stream for the REXS schema file and returns it. * diff --git a/api/src/main/java/info/rexs/schema/constants/RexsAttributeId.java b/api/src/main/java/info/rexs/schema/constants/RexsAttributeId.java index 2865dfa..1c78df7 100644 --- a/api/src/main/java/info/rexs/schema/constants/RexsAttributeId.java +++ b/api/src/main/java/info/rexs/schema/constants/RexsAttributeId.java @@ -20,6 +20,7 @@ import java.util.Objects; import info.rexs.schema.constants.standard.RexsStandardAttributeIds; +import lombok.Getter; /** * This class represents the ID of a REXS attribute. @@ -30,15 +31,20 @@ * * @author FVA GmbH */ +@Getter public class RexsAttributeId implements RexsStandardAttributeIds { /** An internal index with all created attribute IDs (REXS standard and own) for quick access. */ - private static Map allAttributeIds = new HashMap<>(); + private static final Map allAttributeIds = new HashMap<>(); - /** The actual attribute ID as a {@link String}. */ + /** + * The actual attribute ID as a {@link String}. + */ private final String id; - /** The unit of the attribute as {@link RexsUnitId}. */ + /** + * The unit of the attribute as a {@link RexsUnitId}. + */ private final RexsUnitId unit; private RexsAttributeId(String id, RexsUnitId unit) { @@ -50,22 +56,6 @@ private RexsAttributeId(String id, RexsUnitId unit) { this.unit = unit; } - /** - * @return - * The actual attribute ID as a {@link String}. - */ - public String getId() { - return id; - } - - /** - * @return - * The unit of the attribute as {@link RexsUnitId}. - */ - public RexsUnitId getUnit() { - return unit; - } - /** * TODO Document me! * diff --git a/api/src/main/java/info/rexs/schema/constants/RexsComponentType.java b/api/src/main/java/info/rexs/schema/constants/RexsComponentType.java index a0e242e..2af40a0 100644 --- a/api/src/main/java/info/rexs/schema/constants/RexsComponentType.java +++ b/api/src/main/java/info/rexs/schema/constants/RexsComponentType.java @@ -20,6 +20,7 @@ import java.util.Objects; import info.rexs.schema.constants.standard.RexsStandardComponentTypes; +import lombok.Getter; /** * This class represents the type of a REXS component. @@ -30,12 +31,15 @@ * * @author FVA GmbH */ +@Getter public class RexsComponentType implements RexsStandardComponentTypes { /** An internal index with all created component types (REXS standard and own) for quick access. */ - private static Map allComponentTypes = new HashMap<>(); + private static final Map allComponentTypes = new HashMap<>(); - /** The actual ID of the component type as a {@link String}. */ + /** + * The actual ID of the component type as a {@link String}. + */ private final String id; private RexsComponentType(String id) { @@ -44,14 +48,6 @@ private RexsComponentType(String id) { this.id = id; } - /** - * @return - * The actual ID of the component type as a {@link String}. - */ - public String getId() { - return id; - } - /** * @return * The actual ID of the component type as a {@link String}. diff --git a/api/src/main/java/info/rexs/schema/constants/RexsRelationRole.java b/api/src/main/java/info/rexs/schema/constants/RexsRelationRole.java index f38b89c..aa8de6d 100644 --- a/api/src/main/java/info/rexs/schema/constants/RexsRelationRole.java +++ b/api/src/main/java/info/rexs/schema/constants/RexsRelationRole.java @@ -20,6 +20,7 @@ import java.util.Objects; import info.rexs.schema.constants.standard.RexsStandardRelationRoles; +import lombok.Getter; /** * This class represents a REXS relation role. @@ -30,12 +31,15 @@ * * @author FVA GmbH */ +@Getter public class RexsRelationRole implements RexsStandardRelationRoles { /** An internal index with all created relation roles (REXS standard and own) for quick access. */ - private static Map allRelationRoles = new HashMap<>(); + private static final Map allRelationRoles = new HashMap<>(); - /** The actual key of the relation role as a {@link String}. */ + /** + * The actual key of the relation role as a {@link String}. + */ private final String key; private RexsRelationRole(String key) { @@ -44,14 +48,6 @@ private RexsRelationRole(String key) { this.key = key; } - /** - * @return - * The actual key of the relation role as a {@link String}. - */ - public String getKey() { - return key; - } - /** * TODO Document me! * diff --git a/api/src/main/java/info/rexs/schema/constants/RexsRelationType.java b/api/src/main/java/info/rexs/schema/constants/RexsRelationType.java index 52446ab..235c4a2 100644 --- a/api/src/main/java/info/rexs/schema/constants/RexsRelationType.java +++ b/api/src/main/java/info/rexs/schema/constants/RexsRelationType.java @@ -22,6 +22,7 @@ import java.util.Objects; import info.rexs.schema.constants.standard.RexsStandardRelationTypes; +import lombok.Getter; /** * This class represents a REXS relation type. @@ -32,12 +33,15 @@ * * @author FVA GmbH */ +@Getter public class RexsRelationType implements RexsStandardRelationTypes { /** An internal index with all created relation types (REXS standard and own) for quick access. */ - private static Map allRelationTypes = new HashMap<>(); + private static final Map allRelationTypes = new HashMap<>(); - /** The actual key of the relation type as a {@link String}. */ + /** + * The actual key of the relation type as a {@link String}. + */ private final String key; private final List roles; @@ -56,18 +60,6 @@ private RexsRelationType(String key, List roles) { this.roles = roles; } - public List getRoles() { - return roles; - } - - /** - * @return - * The actual key of the relation type as a {@link String}. - */ - public String getKey() { - return key; - } - /** * TODO Document me! * diff --git a/api/src/main/java/info/rexs/schema/constants/RexsUnitId.java b/api/src/main/java/info/rexs/schema/constants/RexsUnitId.java index 79478db..e45f81f 100644 --- a/api/src/main/java/info/rexs/schema/constants/RexsUnitId.java +++ b/api/src/main/java/info/rexs/schema/constants/RexsUnitId.java @@ -21,6 +21,7 @@ import java.util.Set; import info.rexs.schema.constants.standard.RexsStandardUnitIds; +import lombok.Getter; /** * This class represents a REXS unit. @@ -31,15 +32,20 @@ * * @author FVA GmbH */ +@Getter public class RexsUnitId implements RexsStandardUnitIds { /** An internal index with all created units (REXS standard and own) for quick access. */ private static final Map allUnitIds = new HashMap<>(); - /** The actual unit ID as a {@link String}. */ + /** + * The actual unit ID as a {@link String}. + */ private final String id; - /** The units unique numeric ID as a {@code int}. */ + /** + * The unit's unique numeric ID as an {@code int}. + */ private int numericId = 0; private RexsUnitId(String id) { @@ -57,22 +63,6 @@ private RexsUnitId(String id, int numericId) { this.numericId = numericId; } - /** - * @return - * The actual unit ID as a {@link String}. - */ - public String getId() { - return id; - } - - /** - * @return - * The units numeric ID as a {@code int}. - */ - public int getNumericId() { - return numericId; - } - /** * Checks if the unit is one of the specified units. * diff --git a/api/src/main/java/info/rexs/schema/constants/RexsValueType.java b/api/src/main/java/info/rexs/schema/constants/RexsValueType.java index 6fcdfe3..53ba1d3 100644 --- a/api/src/main/java/info/rexs/schema/constants/RexsValueType.java +++ b/api/src/main/java/info/rexs/schema/constants/RexsValueType.java @@ -15,6 +15,8 @@ */ package info.rexs.schema.constants; +import lombok.Getter; + /** * This enum represents a REXS value type. *

@@ -43,10 +45,16 @@ public enum RexsValueType { FILE_REFERENCE(6, "file_reference"), DATE_TIME(19, "date_time"); - /** The numeric ID of this value type. */ + /** + * The numeric ID of this value type as an {@code int}. + */ + @Getter private final int numericId; - /** The actual key of the value type. */ + /** + * The actual key of the value type as a {@link String}. + */ + @Getter private final String key; /** The base type associated with the value type. */ @@ -70,22 +78,6 @@ public enum RexsValueType { this.basicType = basicType; } - /** - * @return - * The numeric id of the value type as a {@code int}. - */ - public int getNumericId() { - return numericId; - } - - /** - * @return - * The actual key of the value type as a {@link String}. - */ - public String getKey() { - return key; - } - /** * @return * The base type associated with the data type. diff --git a/api/src/main/java/info/rexs/schema/constants/RexsVersion.java b/api/src/main/java/info/rexs/schema/constants/RexsVersion.java index 6d4d1f9..3fdc8a3 100644 --- a/api/src/main/java/info/rexs/schema/constants/RexsVersion.java +++ b/api/src/main/java/info/rexs/schema/constants/RexsVersion.java @@ -7,6 +7,7 @@ import java.util.Objects; import info.rexs.schema.constants.standard.RexsStandardVersions; +import lombok.Getter; /** * Class representing a version in the REXS (Reusable Engineering EXchange Standard) schema. @@ -37,16 +38,19 @@ public class RexsVersion { /** * The (case-insensitive) identifier of the version in the REXS schema. */ + @Getter private final String schemaVersion; /** * The (case-insensitive) identifier of the provider in the REXS schema. */ + @Getter private final String schemaProvider; /** * The (case-insensitive) identifier of the version in the REXS model. */ + @Getter private final String modelVersion; /** @@ -209,37 +213,10 @@ public static List getAll() { return listOfVersions.stream().distinct().toList(); } - /** - * Gets the schema version. - * - * @return The schema version. - */ - public String getSchemaVersion() { - return schemaVersion; - } - - /** - * Gets the schema provider. - * - * @return The schema provider. - */ - public String getSchemaProvider() { - return schemaProvider; - } - - /** - * Gets the model version. - * - * @return The model version. - */ - public String getModelVersion() { - return modelVersion; - } - /** * Gets the numeric representation of the REXS version. *

- * The numeric version is derived from the {@link #getSchemaVersion() schemaVersion} as follows: + * The numeric version is derived from the schema version as follows: *

    *
  • Major version is multiplied by {@code 10000}
  • *
  • Minor version is multiplied by {@code 100}
  • @@ -251,7 +228,6 @@ public String getModelVersion() { * {@link #DEV} and {@link #UNKNOWN} are handled as special cases. The latest development version is always {@link java.lang.Integer#MAX_VALUE Integer.MAX_VALUE}, the unknown version is returning as {@code -1}. * * @return the numeric representation of the REXS version - * @apiNote The {@link #getSchemaProvider() schemaProvider} and {@link #getModelVersion() modelVersion} are not considered in the numeric version. */ public int getNumericVersion() { // return -1 for UNKNOWN diff --git a/api/src/main/java/info/rexs/upgrade/RexsUpgrader.java b/api/src/main/java/info/rexs/upgrade/RexsUpgrader.java index 6f4c0b8..091143a 100644 --- a/api/src/main/java/info/rexs/upgrade/RexsUpgrader.java +++ b/api/src/main/java/info/rexs/upgrade/RexsUpgrader.java @@ -18,25 +18,29 @@ import java.util.ArrayList; import java.util.List; -import info.rexs.schema.constants.RexsVersion; -import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.model.RexsModel; import info.rexs.model.jaxb.Model; +import info.rexs.schema.constants.RexsVersion; +import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.upgrade.upgraders.ModelUpgrader; import info.rexs.upgrade.upgraders.ModelUpgraderResult; import info.rexs.upgrade.upgraders.UpgradeNotifications; import info.rexs.upgrade.upgraders.UpgradeNotifications.Notification; import info.rexs.upgrade.upgraders.UpgradeResolver; +import lombok.Getter; /** * The {@link RexsUpgrader} upgrades a REXS model {@link Model}. * * @author FVA GmbH */ +@Getter public class RexsUpgrader { - /** The REXS model {@link Model}. */ - private RexsModel rexsModel; + /** + * The REXS model. + */ + private final RexsModel rexsModel; /** * Constructs a new {@link RexsUpgrader} for the given {@link Model}. @@ -48,14 +52,6 @@ public RexsUpgrader(RexsModel rexsModel) { this.rexsModel = rexsModel; } - /** - * @return - * The REXS model {@link Model}. - */ - public RexsModel getRexsModel() { - return rexsModel; - } - /** * Upgrades the REXS model to the latest standard REXS version. * @return diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/ModelChangelogUpgrader.java b/api/src/main/java/info/rexs/upgrade/upgraders/ModelChangelogUpgrader.java index c4717a4..b8a5c0d 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/ModelChangelogUpgrader.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/ModelChangelogUpgrader.java @@ -39,6 +39,7 @@ import info.rexs.upgrade.upgraders.changelog.jaxb.EnumValueChange; import info.rexs.upgrade.upgraders.changelog.jaxb.MappingChange; import info.rexs.upgrade.upgraders.changelog.jaxb.RexsChangelog; +import lombok.Getter; /** generic upgrade for changes defined in the changelog file */ public class ModelChangelogUpgrader { @@ -47,9 +48,10 @@ public class ModelChangelogUpgrader { private final RexsModel oldModel; private final RexsChangelog changelog; - private UpgradeNotifications notifications = new UpgradeNotifications(); + @Getter + private final UpgradeNotifications notifications = new UpgradeNotifications(); /** remove invalid attributes in strict mode */ - private boolean strictMode; + private final boolean strictMode; public ModelChangelogUpgrader(RexsModel model, RexsChangelog changelog, boolean strictMode) { this.oldModel = model; @@ -320,8 +322,4 @@ private void editAttributeValueType( } } - public UpgradeNotifications getNotifications() { - return notifications; - } - } diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderResult.java b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderResult.java index fc0d6d4..ae3a9b7 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderResult.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderResult.java @@ -1,23 +1,17 @@ package info.rexs.upgrade.upgraders; import info.rexs.model.RexsModel; +import lombok.Getter; +@Getter public class ModelUpgraderResult { - + private final RexsModel model; private final UpgradeNotifications notifications; - + public ModelUpgraderResult(RexsModel model, UpgradeNotifications notifications) { this.model = model; this.notifications = notifications; } - public RexsModel getModel() { - return model; - } - - public UpgradeNotifications getNotifications() { - return notifications; - } - -} \ No newline at end of file +} diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV10toV11.java b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV10toV11.java index 264a4b5..37ac070 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV10toV11.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV10toV11.java @@ -79,7 +79,7 @@ public AttributeLocation(RexsComponentType component, RexsAttributeId attribute) private final boolean strictMode; private RexsChangelog changelog; - private UpgradeNotifications notifications = new UpgradeNotifications(); + private final UpgradeNotifications notifications = new UpgradeNotifications(); public ModelUpgraderV10toV11(RexsModel model, boolean strictMode) { this.oldModel = model; diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV11toV12.java b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV11toV12.java index 11b9d57..168d86c 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV11toV12.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV11toV12.java @@ -1,7 +1,7 @@ package info.rexs.upgrade.upgraders; -import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.model.RexsModel; +import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.upgrade.RexsUpgradeException; import info.rexs.upgrade.upgraders.changelog.ChangelogFile; import info.rexs.upgrade.upgraders.changelog.ChangelogResolver; @@ -16,7 +16,7 @@ public class ModelUpgraderV11toV12 { private final boolean strictMode; private RexsChangelog changelog; - private UpgradeNotifications notifications = new UpgradeNotifications(); + private final UpgradeNotifications notifications = new UpgradeNotifications(); public ModelUpgraderV11toV12(RexsModel model, boolean strictMode) { this.oldModel = model; diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV12toV13.java b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV12toV13.java index 0d7d0e1..1987c51 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV12toV13.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV12toV13.java @@ -28,7 +28,7 @@ public class ModelUpgraderV12toV13 { private final boolean strictMode; private RexsChangelog changelog; - private UpgradeNotifications notifications = new UpgradeNotifications(); + private final UpgradeNotifications notifications = new UpgradeNotifications(); public ModelUpgraderV12toV13(RexsModel model, boolean strictMode) { this.oldModel = model; diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV13toV14.java b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV13toV14.java index bdbbb89..d2ca5e9 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV13toV14.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV13toV14.java @@ -33,7 +33,7 @@ public class ModelUpgraderV13toV14 { private final boolean strictMode; private RexsChangelog changelog; - private UpgradeNotifications notifications = new UpgradeNotifications(); + private final UpgradeNotifications notifications = new UpgradeNotifications(); public ModelUpgraderV13toV14(RexsModel model, boolean strictMode) { this.oldModel = model; diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV14toV15.java b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV14toV15.java index c76e84b..293bd9b 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV14toV15.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV14toV15.java @@ -1,7 +1,7 @@ package info.rexs.upgrade.upgraders; -import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.model.RexsModel; +import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.upgrade.RexsUpgradeException; import info.rexs.upgrade.upgraders.changelog.ChangelogFile; import info.rexs.upgrade.upgraders.changelog.ChangelogResolver; @@ -16,7 +16,7 @@ public class ModelUpgraderV14toV15 { private final boolean strictMode; private RexsChangelog changelog; - private UpgradeNotifications notifications = new UpgradeNotifications(); + private final UpgradeNotifications notifications = new UpgradeNotifications(); public ModelUpgraderV14toV15(RexsModel model, boolean strictMode) { this.oldModel = model; diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV15toV16.java b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV15toV16.java index c7b798c..2d5a910 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV15toV16.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV15toV16.java @@ -1,7 +1,7 @@ package info.rexs.upgrade.upgraders; -import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.model.RexsModel; +import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.upgrade.RexsUpgradeException; import info.rexs.upgrade.upgraders.changelog.ChangelogFile; import info.rexs.upgrade.upgraders.changelog.ChangelogResolver; @@ -16,7 +16,7 @@ public class ModelUpgraderV15toV16 { private final boolean strictMode; private RexsChangelog changelog; - private UpgradeNotifications notifications = new UpgradeNotifications(); + private final UpgradeNotifications notifications = new UpgradeNotifications(); public ModelUpgraderV15toV16(RexsModel model, boolean strictMode) { this.oldModel = model; diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV16toV17.java b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV16toV17.java index 52f8469..b2b1e1e 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV16toV17.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV16toV17.java @@ -1,7 +1,7 @@ package info.rexs.upgrade.upgraders; -import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.model.RexsModel; +import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.upgrade.RexsUpgradeException; import info.rexs.upgrade.upgraders.changelog.ChangelogFile; import info.rexs.upgrade.upgraders.changelog.ChangelogResolver; @@ -16,7 +16,7 @@ public class ModelUpgraderV16toV17 { private final boolean strictMode; private RexsChangelog changelog; - private UpgradeNotifications notifications = new UpgradeNotifications(); + private final UpgradeNotifications notifications = new UpgradeNotifications(); public ModelUpgraderV16toV17(RexsModel model, boolean strictMode) { this.oldModel = model; diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV17toV20.java b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV17toV20.java index 5448bbd..ead45ac 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV17toV20.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/ModelUpgraderV17toV20.java @@ -1,7 +1,7 @@ package info.rexs.upgrade.upgraders; -import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.model.RexsModel; +import info.rexs.schema.constants.standard.RexsStandardVersions; import info.rexs.upgrade.RexsUpgradeException; import info.rexs.upgrade.upgraders.changelog.ChangelogFile; import info.rexs.upgrade.upgraders.changelog.ChangelogResolver; @@ -16,7 +16,7 @@ public class ModelUpgraderV17toV20 { private final boolean strictMode; private RexsChangelog changelog; - private UpgradeNotifications notifications = new UpgradeNotifications(); + private final UpgradeNotifications notifications = new UpgradeNotifications(); public ModelUpgraderV17toV20(RexsModel model, boolean strictMode) { this.oldModel = model; diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/UpgradeNotifications.java b/api/src/main/java/info/rexs/upgrade/upgraders/UpgradeNotifications.java index 0583493..e020ece 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/UpgradeNotifications.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/UpgradeNotifications.java @@ -5,6 +5,9 @@ import java.util.Collection; import java.util.List; +import lombok.Getter; + +@Getter public class UpgradeNotifications { public enum NotificationType { @@ -23,7 +26,9 @@ public enum NotificationType { } public static class Notification { + @Getter private final NotificationType type; + @Getter private final String message; private final List sources; @@ -39,14 +44,6 @@ public Notification(NotificationType type, String message, Source ... sources) { this.sources = Arrays.asList(sources); } - public NotificationType getType() { - return type; - } - - public String getMessage() { - return message; - } - public String getMessageVerbose() { String sourceStr = sources.stream().map(Object::toString).reduce((a, b) -> a+", "+b).orElse(""); return type+": "+message+" ["+sourceStr+"]"; @@ -96,7 +93,7 @@ public String toString() { } } - private List notifications = new ArrayList<>(); + private final List notifications = new ArrayList<>(); public UpgradeNotifications() { } @@ -113,7 +110,4 @@ public void addAll(Collection notification) { notifications.addAll(notification); } - public List getNotifications() { - return notifications; - } } diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/UpgradeResolver.java b/api/src/main/java/info/rexs/upgrade/upgraders/UpgradeResolver.java index 3786fac..17d11ce 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/UpgradeResolver.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/UpgradeResolver.java @@ -41,7 +41,7 @@ public class UpgradeResolver { private static UpgradeResolver instance = null; /** An internal index with all registered upgraders (REXS standard and own) for quick access. [toVersion -> fromVersion -> upgrader] */ - private Map> registeredUpgraders = new HashMap<>(); + private final Map> registeredUpgraders = new HashMap<>(); private UpgradeResolver() { register(RexsStandardVersions.V1_0, RexsStandardVersions.V1_1, new ModelUpgrader() { diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/changelog/ChangelogFile.java b/api/src/main/java/info/rexs/upgrade/upgraders/changelog/ChangelogFile.java index d11784d..651d9de 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/changelog/ChangelogFile.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/changelog/ChangelogFile.java @@ -22,6 +22,7 @@ import info.rexs.schema.constants.RexsVersion; import info.rexs.schema.constants.standard.RexsStandardVersions; +import lombok.Getter; /** * This class represents a REXS database changelog file. @@ -38,7 +39,7 @@ public class ChangelogFile { private static final ChangelogFileResolver DEFAULT_FILE_RESOLVER = new ChangelogFileResolver(); /** An internal index with all created REXS database changelog files (REXS standard and own) for quick access. */ - private static Set allChangelogFiles = new HashSet<>(); + private static final Set allChangelogFiles = new HashSet<>(); /** REXS Changelog 1.0 to 1.1 */ public static final ChangelogFile V1_0_TO_V1_1 = create(RexsStandardVersions.V1_0, RexsStandardVersions.V1_1); @@ -64,10 +65,16 @@ public class ChangelogFile { /** REXS Changelog 1.7 to 2.0.0 */ public static final ChangelogFile V1_7_TO_V2_0_0 = create(RexsStandardVersions.V1_7, RexsStandardVersions.V2_0_0); - /** The from {@link RexsVersion} of the REXS database changelog file. */ + /** + * The source {@link RexsVersion} of the REXS database changelog file. + */ + @Getter private final RexsVersion fromVersion; - /** The to {@link RexsVersion} of the REXS database changelog file. */ + /** + * The target {@link RexsVersion} of the REXS database changelog file. + */ + @Getter private final RexsVersion toVersion; /** The {@link ChangelogFileResolver} for the REXS database changelog file. */ @@ -83,22 +90,6 @@ private ChangelogFile(RexsVersion fromVersion, RexsVersion toVersion, ChangelogF this.fileResolver = fileResolver; } - /** - * @return - * The from {@link RexsVersion} of the REXS database changelog file. - */ - public RexsVersion getFromVersion() { - return fromVersion; - } - - /** - * @return - * The to {@link RexsVersion} of the REXS database changelog file. - */ - public RexsVersion getToVersion() { - return toVersion; - } - /** * Opens an input stream for the REXS database changelog file and returns it. * diff --git a/api/src/main/java/info/rexs/upgrade/upgraders/changelog/ChangelogResolver.java b/api/src/main/java/info/rexs/upgrade/upgraders/changelog/ChangelogResolver.java index 4aa63c9..f94788f 100644 --- a/api/src/main/java/info/rexs/upgrade/upgraders/changelog/ChangelogResolver.java +++ b/api/src/main/java/info/rexs/upgrade/upgraders/changelog/ChangelogResolver.java @@ -19,11 +19,10 @@ import java.util.HashMap; import java.util.Map; -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.Unmarshaller; - import info.rexs.upgrade.RexsUpgradeException; import info.rexs.upgrade.upgraders.changelog.jaxb.RexsChangelog; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.Unmarshaller; /** * This class provides the REXS database changelogs of all available REXS versions (REXS standard and own). @@ -36,7 +35,7 @@ public class ChangelogResolver { private static ChangelogResolver instance = null; /** An internal index with all created REXS database changelogs (REXS standard and own) for quick access. */ - private Map changelogFileCache = new HashMap<>(); + private final Map changelogFileCache = new HashMap<>(); private ChangelogResolver() {} diff --git a/api/src/main/java/info/rexs/validation/DefaultRexsFileValidator.java b/api/src/main/java/info/rexs/validation/DefaultRexsFileValidator.java index 2dd7a5b..031fc4a 100644 --- a/api/src/main/java/info/rexs/validation/DefaultRexsFileValidator.java +++ b/api/src/main/java/info/rexs/validation/DefaultRexsFileValidator.java @@ -35,6 +35,7 @@ import info.rexs.io.zip.RexsZipFileReader; import info.rexs.model.RexsModel; import info.rexs.xsd.RexsXsd; +import lombok.Getter; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; @@ -156,24 +157,17 @@ private RexsValidationResult validateSchema(Resource rexsFileResource) { return validationResult; } + @Getter private class SchemaValidationErrorHandler implements ErrorHandler { - private List errorMessages = new ArrayList<>(); - private List warningMessages = new ArrayList<>(); + private final List errorMessages = new ArrayList<>(); + private final List warningMessages = new ArrayList<>(); @Override public void error(SAXParseException ex) { errorMessages.add(createExceptionMessage(ex)); } - public List getWarningMessages() { - return this.warningMessages; - } - - public List getErrorMessages() { - return this.errorMessages; - } - @Override public void fatalError(SAXParseException ex) { errorMessages.add(createExceptionMessage(ex)); diff --git a/api/src/main/java/info/rexs/validation/RexsValidationResult.java b/api/src/main/java/info/rexs/validation/RexsValidationResult.java index c7ac626..8d93f31 100644 --- a/api/src/main/java/info/rexs/validation/RexsValidationResult.java +++ b/api/src/main/java/info/rexs/validation/RexsValidationResult.java @@ -18,18 +18,21 @@ import java.util.ArrayList; import java.util.List; +import lombok.Getter; + /** * This class represents the result of a REXS validation. * * @author FVA GmbH */ +@Getter public class RexsValidationResult { /** A list containing all warning messages. */ - private List warnings = new ArrayList<>(); + private final List warnings = new ArrayList<>(); /** A list containing all error messages. */ - private List errors = new ArrayList<>(); + private final List errors = new ArrayList<>(); /** * Returns the status of the validation. @@ -76,11 +79,4 @@ public void add(RexsValidationResult validationResult) { warnings.addAll(validationResult.getWarnings()); } - public List getWarnings() { - return this.warnings; - } - - public List getErrors() { - return this.errors; - } } diff --git a/api/src/main/java/info/rexs/validation/RexsValidationResultMessage.java b/api/src/main/java/info/rexs/validation/RexsValidationResultMessage.java index 5ef16b4..d658be5 100644 --- a/api/src/main/java/info/rexs/validation/RexsValidationResultMessage.java +++ b/api/src/main/java/info/rexs/validation/RexsValidationResultMessage.java @@ -15,11 +15,14 @@ */ package info.rexs.validation; +import lombok.Getter; + /** * This class represents the result message of a REXS validation. * * @author FVA GmbH */ +@Getter public class RexsValidationResultMessage { /** The key of the message. */ @@ -42,14 +45,6 @@ public RexsValidationResultMessage(RexsValidationResultMessageKey key, String... this.additionalMessages = additionalMessages; } - public RexsValidationResultMessageKey getKey() { - return key; - } - - public String[] getAdditionalMessages() { - return additionalMessages; - } - public String getDefaultMessage() { if (additionalMessages == null || additionalMessages.length < 1) return key.getDefaultMessage(); diff --git a/api/src/main/java/info/rexs/validation/RexsValidationResultMessageKey.java b/api/src/main/java/info/rexs/validation/RexsValidationResultMessageKey.java index 96ba031..68b9625 100644 --- a/api/src/main/java/info/rexs/validation/RexsValidationResultMessageKey.java +++ b/api/src/main/java/info/rexs/validation/RexsValidationResultMessageKey.java @@ -15,11 +15,14 @@ */ package info.rexs.validation; +import lombok.Getter; + /** * This class represents the key of a result message for a REXS validation. * * @author FVA GmbH */ +@Getter public enum RexsValidationResultMessageKey { EMPTY_FILE("The file is empty."), @@ -70,13 +73,10 @@ public enum RexsValidationResultMessageKey { CAUGHT_EXCEPTION("%s"); /** The default message of the message key. */ - private String defaultMessage; + private final String defaultMessage; RexsValidationResultMessageKey(String defaultMessage) { this.defaultMessage = defaultMessage; } - public String getDefaultMessage() { - return defaultMessage; - } } diff --git a/api/src/main/java/info/rexs/xsd/RexsXsd.java b/api/src/main/java/info/rexs/xsd/RexsXsd.java index a823d40..272ee81 100644 --- a/api/src/main/java/info/rexs/xsd/RexsXsd.java +++ b/api/src/main/java/info/rexs/xsd/RexsXsd.java @@ -45,7 +45,7 @@ public enum RexsXsd { */ FILE_WITH_NAMESPACE("rexs-file-ns.xsd"); - private String filename; + private final String filename; RexsXsd(String filename) { this.filename = filename;