diff --git a/src/main/java/org/gcube/accounting/datamodel/RawUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/RawUsageRecord.java index d340cbf..d7aa5c7 100644 --- a/src/main/java/org/gcube/accounting/datamodel/RawUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/RawUsageRecord.java @@ -17,10 +17,10 @@ import java.util.Map.Entry; import java.util.Set; import java.util.UUID; -import org.gcube.accounting.datamodel.validations.Aggregated; -import org.gcube.accounting.datamodel.validations.FieldValidator; -import org.gcube.accounting.datamodel.validations.Required; -import org.gcube.accounting.datamodel.validations.ValidityChecker; +import org.gcube.accounting.datamodel.decorators.AggregatedField; +import org.gcube.accounting.datamodel.decorators.RequiredField; +import org.gcube.accounting.datamodel.decorators.ValidatorAction; +import org.gcube.accounting.datamodel.decorators.ValidatorField; import org.gcube.accounting.datamodel.validations.annotations.NotEmpty; import org.gcube.accounting.datamodel.validations.annotations.NotEmptyIfNotNull; import org.gcube.accounting.datamodel.validations.annotations.ValidLong; @@ -37,29 +37,29 @@ public abstract class RawUsageRecord implements UsageRecord, Serializable { private static Logger logger = LoggerFactory.getLogger(RawUsageRecord.class); - @Required @NotEmpty + @RequiredField @NotEmpty public static final String ID = "id"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String CREATOR_ID = "creatorId"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String CONSUMER_ID = "consumerId"; - @Required @ValidLong + @RequiredField @ValidLong public static final String CREATION_TIME = "creationTime"; - @Aggregated @ValidLong + @AggregatedField @ValidLong protected static final String START_TIME = "startTime"; - @Aggregated @ValidLong + @AggregatedField @ValidLong protected static final String END_TIME = "endTime"; - @Required @NotEmpty + @RequiredField @NotEmpty protected static final String RESOURCE_TYPE = "resourceType"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String RESOURCE_SCOPE = "resourceScope"; @NotEmpty protected static final String RESOURCE_OWNER = "resourceOwner"; - @Aggregated @NotEmptyIfNotNull + @AggregatedField @NotEmptyIfNotNull protected static final String AGGREGATED_ID = "aggregatedId"; @NotEmptyIfNotNull protected static final String AGGREGATED_USAGE_RECORD_ID = "aggregatedUsageRecordId"; - @Required @ValidOperationResult + @RequiredField @ValidOperationResult public static final String OPERATION_RESULT = "operationResult"; /** @@ -72,7 +72,7 @@ public abstract class RawUsageRecord implements UsageRecord, Serializable { */ protected Map resourceSpecificProperties; - protected final Map> validation; + protected final Map> validation; protected void initializeValidation() { logger.debug("Initializing Field Validators"); @@ -84,12 +84,12 @@ public abstract class RawUsageRecord implements UsageRecord, Serializable { } catch (Exception e) { continue; } - List fieldValidators = new ArrayList(); + List fieldValidators = new ArrayList(); validation.put(keyString, fieldValidators); for (Annotation annotation : field.getAnnotations()){ - if (annotation.annotationType().isAnnotationPresent(ValidityChecker.class)){ - Class managedClass = ((ValidityChecker)annotation.annotationType().getAnnotation(ValidityChecker.class)).managed(); - FieldValidator validator; + if (annotation.annotationType().isAnnotationPresent(ValidatorField.class)){ + Class managedClass = ((ValidatorField)annotation.annotationType().getAnnotation(ValidatorField.class)).managed(); + ValidatorAction validator; try { validator = managedClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { @@ -104,7 +104,7 @@ public abstract class RawUsageRecord implements UsageRecord, Serializable { protected RawUsageRecord(){ this.resourceSpecificProperties = new HashMap(); - this.validation = new HashMap>(); + this.validation = new HashMap>(); initializeValidation(); this.resourceSpecificProperties.put(ID, UUID.randomUUID().toString()); this.resourceSpecificProperties.put(RESOURCE_TYPE, this.getClass().getSimpleName()); @@ -113,7 +113,7 @@ public abstract class RawUsageRecord implements UsageRecord, Serializable { } protected RawUsageRecord(Map properties) throws InvalidValueException { - this.validation = new HashMap>(); + this.validation = new HashMap>(); initializeValidation(); setResourceSpecificProperties(properties); } @@ -391,9 +391,9 @@ public abstract class RawUsageRecord implements UsageRecord, Serializable { protected Serializable validateField(String key, Serializable serializable) throws InvalidValueException { Serializable checkedValue = serializable; - List fieldValidators = validation.get(key); + List fieldValidators = validation.get(key); if(fieldValidators!=null){ - for(FieldValidator fieldValidator : fieldValidators){ + for(ValidatorAction fieldValidator : fieldValidators){ checkedValue = fieldValidator.validate(checkedValue); } } diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/DeprecationAction.java b/src/main/java/org/gcube/accounting/datamodel/decorators/AggregatedAction.java similarity index 74% rename from src/main/java/org/gcube/accounting/datamodel/validations/DeprecationAction.java rename to src/main/java/org/gcube/accounting/datamodel/decorators/AggregatedAction.java index 0c96a5b..5e291b2 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/DeprecationAction.java +++ b/src/main/java/org/gcube/accounting/datamodel/decorators/AggregatedAction.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.accounting.datamodel.validations; +package org.gcube.accounting.datamodel.decorators; import java.io.Serializable; @@ -10,7 +10,7 @@ import org.gcube.accounting.datamodel.UsageRecord; /** * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ */ -public interface DeprecationAction { +public interface AggregatedAction { public Serializable manage(String key, Serializable manage, UsageRecord usageRecord); diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/Required.java b/src/main/java/org/gcube/accounting/datamodel/decorators/AggregatedField.java similarity index 72% rename from src/main/java/org/gcube/accounting/datamodel/validations/Required.java rename to src/main/java/org/gcube/accounting/datamodel/decorators/AggregatedField.java index a71d369..536edc2 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/Required.java +++ b/src/main/java/org/gcube/accounting/datamodel/decorators/AggregatedField.java @@ -1,4 +1,4 @@ -package org.gcube.accounting.datamodel.validations; +package org.gcube.accounting.datamodel.decorators; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -7,6 +7,6 @@ import java.lang.annotation.Target; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -public @interface Required { +public @interface AggregatedField { } diff --git a/src/main/java/org/gcube/accounting/datamodel/decorators/DeprecatedAction.java b/src/main/java/org/gcube/accounting/datamodel/decorators/DeprecatedAction.java new file mode 100644 index 0000000..bccbd08 --- /dev/null +++ b/src/main/java/org/gcube/accounting/datamodel/decorators/DeprecatedAction.java @@ -0,0 +1,17 @@ +/** + * + */ +package org.gcube.accounting.datamodel.decorators; + +import java.io.Serializable; + +import org.gcube.accounting.datamodel.UsageRecord; + +/** + * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ + */ +public interface DeprecatedAction { + + public Serializable manage(String key, Serializable manage, UsageRecord usageRecord); + +} diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/DeprecatedField.java b/src/main/java/org/gcube/accounting/datamodel/decorators/DeprecatedField.java similarity index 76% rename from src/main/java/org/gcube/accounting/datamodel/validations/DeprecatedField.java rename to src/main/java/org/gcube/accounting/datamodel/decorators/DeprecatedField.java index 5b44351..41a04cf 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/DeprecatedField.java +++ b/src/main/java/org/gcube/accounting/datamodel/decorators/DeprecatedField.java @@ -1,4 +1,4 @@ -package org.gcube.accounting.datamodel.validations; +package org.gcube.accounting.datamodel.decorators; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; @@ -11,6 +11,6 @@ import java.lang.annotation.Target; @Inherited public @interface DeprecatedField { - Class action(); + Class action(); } diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/Aggregated.java b/src/main/java/org/gcube/accounting/datamodel/decorators/RequiredField.java similarity index 72% rename from src/main/java/org/gcube/accounting/datamodel/validations/Aggregated.java rename to src/main/java/org/gcube/accounting/datamodel/decorators/RequiredField.java index 02f67d2..7baa3bc 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/Aggregated.java +++ b/src/main/java/org/gcube/accounting/datamodel/decorators/RequiredField.java @@ -1,4 +1,4 @@ -package org.gcube.accounting.datamodel.validations; +package org.gcube.accounting.datamodel.decorators; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -7,6 +7,6 @@ import java.lang.annotation.Target; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -public @interface Aggregated { +public @interface RequiredField { } diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/FieldValidator.java b/src/main/java/org/gcube/accounting/datamodel/decorators/ValidatorAction.java similarity index 85% rename from src/main/java/org/gcube/accounting/datamodel/validations/FieldValidator.java rename to src/main/java/org/gcube/accounting/datamodel/decorators/ValidatorAction.java index cf6ced7..8d803af 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/FieldValidator.java +++ b/src/main/java/org/gcube/accounting/datamodel/decorators/ValidatorAction.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.accounting.datamodel.validations; +package org.gcube.accounting.datamodel.decorators; import java.io.Serializable; @@ -10,7 +10,7 @@ import org.gcube.accounting.exception.InvalidValueException; /** * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ */ -public interface FieldValidator { +public interface ValidatorAction { /** * Validate (and convert if needed) the provided property diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/ValidityChecker.java b/src/main/java/org/gcube/accounting/datamodel/decorators/ValidatorField.java similarity index 74% rename from src/main/java/org/gcube/accounting/datamodel/validations/ValidityChecker.java rename to src/main/java/org/gcube/accounting/datamodel/decorators/ValidatorField.java index bc1d1fa..3403a14 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/ValidityChecker.java +++ b/src/main/java/org/gcube/accounting/datamodel/decorators/ValidatorField.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.accounting.datamodel.validations; +package org.gcube.accounting.datamodel.decorators; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; @@ -16,8 +16,8 @@ import java.lang.annotation.Target; @Target(ElementType.ANNOTATION_TYPE) @Retention(RetentionPolicy.RUNTIME) @Inherited -public @interface ValidityChecker { +public @interface ValidatorField { - Class managed(); + Class managed(); } diff --git a/src/main/java/org/gcube/accounting/datamodel/implementations/JobUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/implementations/JobUsageRecord.java index 01310e9..58dbf47 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/JobUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/JobUsageRecord.java @@ -7,8 +7,8 @@ import java.util.Calendar; import org.gcube.accounting.datamodel.RawUsageRecord; import org.gcube.accounting.datamodel.SingleUsageRecord; -import org.gcube.accounting.datamodel.validations.DeprecatedField; -import org.gcube.accounting.datamodel.validations.Required; +import org.gcube.accounting.datamodel.decorators.DeprecatedField; +import org.gcube.accounting.datamodel.decorators.RequiredField; import org.gcube.accounting.datamodel.validations.annotations.NotEmpty; import org.gcube.accounting.datamodel.validations.annotations.ValidInteger; import org.gcube.accounting.datamodel.validations.annotations.ValidLong; @@ -30,15 +30,15 @@ public class JobUsageRecord extends RawUsageRecord implements SingleUsageRecord completed, failed }; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String JOB_ID = "jobId"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String JOB_QUALIFIER = "jobQualifier"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String JOB_NAME = "jobName"; - @Required @ValidLong + @RequiredField @ValidLong public static final String JOB_START_TIME = "jobStartTime"; - @Required @ValidLong + @RequiredField @ValidLong public static final String JOB_END_TIME = "jobEndTime"; @DeprecatedField(action=ConvertToOperationResult.class) @NotEmpty //TODO diff --git a/src/main/java/org/gcube/accounting/datamodel/implementations/PortletUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/implementations/PortletUsageRecord.java index b4500d9..b8d016a 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/PortletUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/PortletUsageRecord.java @@ -5,8 +5,8 @@ package org.gcube.accounting.datamodel.implementations; import org.gcube.accounting.datamodel.RawUsageRecord; import org.gcube.accounting.datamodel.SingleUsageRecord; -import org.gcube.accounting.datamodel.validations.DeprecatedField; -import org.gcube.accounting.datamodel.validations.Required; +import org.gcube.accounting.datamodel.decorators.DeprecatedField; +import org.gcube.accounting.datamodel.decorators.RequiredField; import org.gcube.accounting.datamodel.validations.annotations.NotEmpty; import org.gcube.accounting.datamodel.validations.annotations.NotEmptyIfNotNull; import org.gcube.accounting.datamodel.validations.validators.WarningAlert; @@ -26,9 +26,9 @@ public class PortletUsageRecord extends RawUsageRecord implements SingleUsageRec @DeprecatedField(action=WarningAlert.class) @NotEmptyIfNotNull protected static final String USER_ID = "userId"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String PORTLET_ID = "portletId"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String OPERATION_ID = "operationId"; // TODO More diff --git a/src/main/java/org/gcube/accounting/datamodel/implementations/ServiceUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/implementations/ServiceUsageRecord.java index 59b8f9c..88f30c9 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/ServiceUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/ServiceUsageRecord.java @@ -5,8 +5,8 @@ package org.gcube.accounting.datamodel.implementations; import org.gcube.accounting.datamodel.RawUsageRecord; import org.gcube.accounting.datamodel.SingleUsageRecord; -import org.gcube.accounting.datamodel.validations.DeprecatedField; -import org.gcube.accounting.datamodel.validations.Required; +import org.gcube.accounting.datamodel.decorators.DeprecatedField; +import org.gcube.accounting.datamodel.decorators.RequiredField; import org.gcube.accounting.datamodel.validations.annotations.NotEmpty; import org.gcube.accounting.datamodel.validations.annotations.ValidIP; import org.gcube.accounting.datamodel.validations.annotations.ValidInteger; @@ -26,11 +26,11 @@ public class ServiceUsageRecord extends RawUsageRecord implements SingleUsageRec @ValidIP public static final String CALLER_IP = "callerIP"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String CALLER_SCOPE = "callerScope"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String REF_HOST = "refHost"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String REF_VM = "refVM"; @DeprecatedField(action=WarningAlert.class) @NotEmpty public static final String DOMAIN = "domain"; diff --git a/src/main/java/org/gcube/accounting/datamodel/implementations/StorageUsageUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/implementations/StorageUsageUsageRecord.java index 4a7c60f..05bbfc3 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/StorageUsageUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/StorageUsageUsageRecord.java @@ -5,7 +5,7 @@ package org.gcube.accounting.datamodel.implementations; import org.gcube.accounting.datamodel.RawUsageRecord; import org.gcube.accounting.datamodel.SingleUsageRecord; -import org.gcube.accounting.datamodel.validations.Required; +import org.gcube.accounting.datamodel.decorators.RequiredField; import org.gcube.accounting.datamodel.validations.annotations.NotEmpty; import org.gcube.accounting.datamodel.validations.annotations.NotEmptyIfNotNull; import org.gcube.accounting.datamodel.validations.annotations.ValidIP; @@ -28,7 +28,7 @@ public class StorageUsageUsageRecord extends RawUsageRecord implements SingleUsa public static final String PROVIDER_ID = "providerId"; @NotEmptyIfNotNull public static final String OBJECT_URI = "objectURI"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String OPERATION_TYPE = "operationType"; @NotEmpty public static final String QUALIFIER = "qualifier"; diff --git a/src/main/java/org/gcube/accounting/datamodel/implementations/TaskUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/implementations/TaskUsageRecord.java index 29440ba..1e59b1a 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/TaskUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/TaskUsageRecord.java @@ -7,8 +7,8 @@ import java.util.Calendar; import org.gcube.accounting.datamodel.RawUsageRecord; import org.gcube.accounting.datamodel.SingleUsageRecord; -import org.gcube.accounting.datamodel.validations.DeprecatedField; -import org.gcube.accounting.datamodel.validations.Required; +import org.gcube.accounting.datamodel.decorators.DeprecatedField; +import org.gcube.accounting.datamodel.decorators.RequiredField; import org.gcube.accounting.datamodel.validations.annotations.NotEmpty; import org.gcube.accounting.datamodel.validations.annotations.ValidInteger; import org.gcube.accounting.datamodel.validations.annotations.ValidLong; @@ -31,17 +31,17 @@ public class TaskUsageRecord extends RawUsageRecord implements SingleUsageRecord completed, failed }; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String JOB_ID = "jobId"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String REF_HOST = "refHost"; - @Required @NotEmpty + @RequiredField @NotEmpty public static final String REF_VM = "refVM"; @DeprecatedField(action=WarningAlert.class) protected static final String DOMAIN = "domain"; - @Required @ValidLong + @RequiredField @ValidLong public static final String USAGE_START_TIME = "usageStartTime"; - @Required @ValidLong + @RequiredField @ValidLong public static final String USAGE_END_TIME = "usageEndTime"; @DeprecatedField(action=ConvertToOperationResult.class) @NotEmpty public static final String USAGE_PHASE = "usagePhase"; diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotEmpty.java b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotEmpty.java index 29b6622..ac961f1 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotEmpty.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotEmpty.java @@ -5,12 +5,12 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.gcube.accounting.datamodel.validations.ValidityChecker; +import org.gcube.accounting.datamodel.decorators.ValidatorField; import org.gcube.accounting.datamodel.validations.validators.NotEmptyValidator; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -@ValidityChecker(managed=NotEmptyValidator.class) +@ValidatorField(managed=NotEmptyValidator.class) public @interface NotEmpty { } diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotEmptyIfNotNull.java b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotEmptyIfNotNull.java index a5a2ef9..ad1abd1 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotEmptyIfNotNull.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotEmptyIfNotNull.java @@ -5,12 +5,12 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.gcube.accounting.datamodel.validations.ValidityChecker; +import org.gcube.accounting.datamodel.decorators.ValidatorField; import org.gcube.accounting.datamodel.validations.validators.NotEmptyIfNotNullValidator; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -@ValidityChecker(managed=NotEmptyIfNotNullValidator.class) +@ValidatorField(managed=NotEmptyIfNotNullValidator.class) public @interface NotEmptyIfNotNull { } diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotNull.java b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotNull.java index 188b83f..d2e1006 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotNull.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/NotNull.java @@ -5,12 +5,12 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.gcube.accounting.datamodel.validations.ValidityChecker; +import org.gcube.accounting.datamodel.decorators.ValidatorField; import org.gcube.accounting.datamodel.validations.validators.NotNullValidator; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -@ValidityChecker(managed=NotNullValidator.class) +@ValidatorField(managed=NotNullValidator.class) public @interface NotNull { } diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidIP.java b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidIP.java index 9d74f1a..2f02d33 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidIP.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidIP.java @@ -5,12 +5,12 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.gcube.accounting.datamodel.validations.ValidityChecker; +import org.gcube.accounting.datamodel.decorators.ValidatorField; import org.gcube.accounting.datamodel.validations.validators.ValidIPValidator; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -@ValidityChecker(managed=ValidIPValidator.class) +@ValidatorField(managed=ValidIPValidator.class) public @interface ValidIP { } diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidInteger.java b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidInteger.java index ff72601..02868b1 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidInteger.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidInteger.java @@ -5,12 +5,12 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.gcube.accounting.datamodel.validations.ValidityChecker; +import org.gcube.accounting.datamodel.decorators.ValidatorField; import org.gcube.accounting.datamodel.validations.validators.ValidIntegerValidator; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -@ValidityChecker(managed=ValidIntegerValidator.class) +@ValidatorField(managed=ValidIntegerValidator.class) public @interface ValidInteger { } diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidLong.java b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidLong.java index c318dfa..f24789d 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidLong.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidLong.java @@ -5,12 +5,12 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.gcube.accounting.datamodel.validations.ValidityChecker; +import org.gcube.accounting.datamodel.decorators.ValidatorField; import org.gcube.accounting.datamodel.validations.validators.ValidLongValidator; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -@ValidityChecker(managed=ValidLongValidator.class) +@ValidatorField(managed=ValidLongValidator.class) public @interface ValidLong { } diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidOperationResult.java b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidOperationResult.java index 8314565..70c824c 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidOperationResult.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/annotations/ValidOperationResult.java @@ -5,12 +5,12 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.gcube.accounting.datamodel.validations.ValidityChecker; +import org.gcube.accounting.datamodel.decorators.ValidatorField; import org.gcube.accounting.datamodel.validations.validators.ValidOperationResultValidator; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -@ValidityChecker(managed=ValidOperationResultValidator.class) +@ValidatorField(managed=ValidOperationResultValidator.class) public @interface ValidOperationResult { } diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/validators/ConvertToOperationResult.java b/src/main/java/org/gcube/accounting/datamodel/validations/validators/ConvertToOperationResult.java index 6f8dc48..6f60554 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/validators/ConvertToOperationResult.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/validators/ConvertToOperationResult.java @@ -6,13 +6,13 @@ package org.gcube.accounting.datamodel.validations.validators; import java.io.Serializable; import org.gcube.accounting.datamodel.UsageRecord; -import org.gcube.accounting.datamodel.validations.DeprecationAction; +import org.gcube.accounting.datamodel.decorators.DeprecatedAction; /** * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ * */ -public class ConvertToOperationResult implements DeprecationAction { +public class ConvertToOperationResult implements DeprecatedAction { /** * {@inheritDoc} diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/validators/NotEmptyValidator.java b/src/main/java/org/gcube/accounting/datamodel/validations/validators/NotEmptyValidator.java index 43d78c9..3783bc7 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/validators/NotEmptyValidator.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/validators/NotEmptyValidator.java @@ -3,10 +3,10 @@ package org.gcube.accounting.datamodel.validations.validators; import java.io.Serializable; import java.util.Map; -import org.gcube.accounting.datamodel.validations.FieldValidator; +import org.gcube.accounting.datamodel.decorators.ValidatorAction; import org.gcube.accounting.exception.InvalidValueException; -public class NotEmptyValidator implements FieldValidator{ +public class NotEmptyValidator implements ValidatorAction{ private static final String ERROR = "Is Empty"; diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/validators/NotNullValidator.java b/src/main/java/org/gcube/accounting/datamodel/validations/validators/NotNullValidator.java index 1297c16..bd1828c 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/validators/NotNullValidator.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/validators/NotNullValidator.java @@ -2,10 +2,10 @@ package org.gcube.accounting.datamodel.validations.validators; import java.io.Serializable; -import org.gcube.accounting.datamodel.validations.FieldValidator; +import org.gcube.accounting.datamodel.decorators.ValidatorAction; import org.gcube.accounting.exception.InvalidValueException; -public class NotNullValidator implements FieldValidator { +public class NotNullValidator implements ValidatorAction { private static final String ERROR = "Is Null"; diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidIPValidator.java b/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidIPValidator.java index 334b133..9ccd9a9 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidIPValidator.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidIPValidator.java @@ -4,12 +4,12 @@ import java.io.Serializable; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.gcube.accounting.datamodel.validations.FieldValidator; +import org.gcube.accounting.datamodel.decorators.ValidatorAction; import org.gcube.accounting.exception.InvalidValueException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ValidIPValidator implements FieldValidator{ +public class ValidIPValidator implements ValidatorAction{ private static Logger logger = LoggerFactory.getLogger(ValidIPValidator.class); diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidIntegerValidator.java b/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidIntegerValidator.java index 70cd7f2..c2be995 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidIntegerValidator.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidIntegerValidator.java @@ -2,11 +2,11 @@ package org.gcube.accounting.datamodel.validations.validators; import java.io.Serializable; -import org.gcube.accounting.datamodel.validations.FieldValidator; +import org.gcube.accounting.datamodel.decorators.ValidatorAction; import org.gcube.accounting.exception.InvalidValueException; -public class ValidIntegerValidator implements FieldValidator { +public class ValidIntegerValidator implements ValidatorAction { private static final String ERROR = String.format("Not Instance of %s", Integer.class.getSimpleName()); diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidLongValidator.java b/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidLongValidator.java index a8e3e0a..46dd4dd 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidLongValidator.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidLongValidator.java @@ -2,11 +2,11 @@ package org.gcube.accounting.datamodel.validations.validators; import java.io.Serializable; -import org.gcube.accounting.datamodel.validations.FieldValidator; +import org.gcube.accounting.datamodel.decorators.ValidatorAction; import org.gcube.accounting.exception.InvalidValueException; -public class ValidLongValidator implements FieldValidator { +public class ValidLongValidator implements ValidatorAction { private static final String ERROR = String.format("Not Instance of %s", Integer.class.getSimpleName()); diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidOperationResultValidator.java b/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidOperationResultValidator.java index 08f1d44..9c2738a 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidOperationResultValidator.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/validators/ValidOperationResultValidator.java @@ -3,10 +3,10 @@ package org.gcube.accounting.datamodel.validations.validators; import java.io.Serializable; import org.gcube.accounting.datamodel.UsageRecord.OperationResult; -import org.gcube.accounting.datamodel.validations.FieldValidator; +import org.gcube.accounting.datamodel.decorators.ValidatorAction; import org.gcube.accounting.exception.InvalidValueException; -public class ValidOperationResultValidator implements FieldValidator { +public class ValidOperationResultValidator implements ValidatorAction { private static final String ERROR = String.format("Not Instance of %s", OperationResult.class.getSimpleName()); diff --git a/src/main/java/org/gcube/accounting/datamodel/validations/validators/WarningAlert.java b/src/main/java/org/gcube/accounting/datamodel/validations/validators/WarningAlert.java index 25e2865..c531c64 100644 --- a/src/main/java/org/gcube/accounting/datamodel/validations/validators/WarningAlert.java +++ b/src/main/java/org/gcube/accounting/datamodel/validations/validators/WarningAlert.java @@ -6,7 +6,7 @@ package org.gcube.accounting.datamodel.validations.validators; import java.io.Serializable; import org.gcube.accounting.datamodel.UsageRecord; -import org.gcube.accounting.datamodel.validations.DeprecationAction; +import org.gcube.accounting.datamodel.decorators.DeprecatedAction; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory; * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ * */ -public class WarningAlert implements DeprecationAction { +public class WarningAlert implements DeprecatedAction { private static Logger logger = LoggerFactory.getLogger(WarningAlert.class);