From 93fd14023d82c06d49d026b920b3037efb994cad Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 5 Jun 2015 12:43:04 +0000 Subject: [PATCH] refs #200: Create accouting-lib library https://support.d4science.org/issues/200 Fixing data model git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@115239 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../datamodel/AggregatedUsageRecord.java | 28 +++++++++++++++++++ .../datamodel/SingleUsageRecord.java | 12 ++++++++ .../implementations/JobUsageRecord.java | 3 +- .../implementations/PortletUsageRecord.java | 3 +- .../implementations/ServiceUsageRecord.java | 3 +- .../StorageUsageUsageRecord.java | 5 ++-- .../implementations/TaskUsageRecord.java | 3 +- .../aggregated/StorageStatusUsageRecord.java | 3 +- 8 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 src/main/java/org/gcube/accounting/datamodel/AggregatedUsageRecord.java create mode 100644 src/main/java/org/gcube/accounting/datamodel/SingleUsageRecord.java rename src/main/java/org/gcube/accounting/datamodel/{ => implementations}/aggregated/StorageStatusUsageRecord.java (96%) diff --git a/src/main/java/org/gcube/accounting/datamodel/AggregatedUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/AggregatedUsageRecord.java new file mode 100644 index 0000000..18f0e44 --- /dev/null +++ b/src/main/java/org/gcube/accounting/datamodel/AggregatedUsageRecord.java @@ -0,0 +1,28 @@ +/** + * + */ +package org.gcube.accounting.datamodel; + +import org.gcube.accounting.exception.InvalidValueException; + +/** + * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ + */ +public interface AggregatedUsageRecord extends UsageRecord { + + /** + * Return the id of the usage record aggregating this + * @return Aggregated Id + */ + @Override + public String getAggregatedId(); + + /** + * Set the id of the usage record aggregating this + * @param aggregatedId + * @throws InvalidValueException + */ + @Override + public void setAggregatedId(String aggregatedId) throws InvalidValueException; + +} diff --git a/src/main/java/org/gcube/accounting/datamodel/SingleUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/SingleUsageRecord.java new file mode 100644 index 0000000..d6349f4 --- /dev/null +++ b/src/main/java/org/gcube/accounting/datamodel/SingleUsageRecord.java @@ -0,0 +1,12 @@ +/** + * + */ +package org.gcube.accounting.datamodel; + +/** + * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ + * + */ +public interface SingleUsageRecord extends UsageRecord { + +} 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 b480807..c63eb32 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/JobUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/JobUsageRecord.java @@ -6,6 +6,7 @@ package org.gcube.accounting.datamodel.implementations; import java.util.Calendar; import org.gcube.accounting.datamodel.RawUsageRecord; +import org.gcube.accounting.datamodel.SingleUsageRecord; import org.gcube.accounting.datamodel.annotations.NotEmpty; import org.gcube.accounting.datamodel.annotations.ValidInteger; import org.gcube.accounting.datamodel.annotations.ValidLong; @@ -15,7 +16,7 @@ import org.gcube.accounting.exception.InvalidValueException; * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ * */ -public class JobUsageRecord extends RawUsageRecord { +public class JobUsageRecord extends RawUsageRecord implements SingleUsageRecord { /** * Generated Serial Version UID 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 d19e927..b7155d7 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/PortletUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/PortletUsageRecord.java @@ -4,6 +4,7 @@ package org.gcube.accounting.datamodel.implementations; import org.gcube.accounting.datamodel.RawUsageRecord; +import org.gcube.accounting.datamodel.SingleUsageRecord; import org.gcube.accounting.datamodel.annotations.NotEmpty; import org.gcube.accounting.exception.InvalidValueException; @@ -11,7 +12,7 @@ import org.gcube.accounting.exception.InvalidValueException; * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ * */ -public class PortletUsageRecord extends RawUsageRecord { +public class PortletUsageRecord extends RawUsageRecord implements SingleUsageRecord { /** * Generated Serial Version UID 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 17d2fff..e6a1ff6 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/ServiceUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/ServiceUsageRecord.java @@ -4,6 +4,7 @@ package org.gcube.accounting.datamodel.implementations; import org.gcube.accounting.datamodel.RawUsageRecord; +import org.gcube.accounting.datamodel.SingleUsageRecord; import org.gcube.accounting.datamodel.annotations.NotEmpty; import org.gcube.accounting.datamodel.annotations.ValidIP; import org.gcube.accounting.datamodel.annotations.ValidInteger; @@ -13,7 +14,7 @@ import org.gcube.accounting.exception.InvalidValueException; * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ * */ -public class ServiceUsageRecord extends RawUsageRecord { +public class ServiceUsageRecord extends RawUsageRecord implements SingleUsageRecord { /** * Generated Serial Version UID 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 2f2769a..0043870 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/StorageUsageUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/StorageUsageUsageRecord.java @@ -3,19 +3,20 @@ */ package org.gcube.accounting.datamodel.implementations; -import org.gcube.accounting.datamodel.aggregated.StorageStatusUsageRecord; +import org.gcube.accounting.datamodel.SingleUsageRecord; import org.gcube.accounting.datamodel.annotations.NotEmpty; import org.gcube.accounting.datamodel.annotations.NotEmptyIfNotNull; import org.gcube.accounting.datamodel.annotations.ValidIP; import org.gcube.accounting.datamodel.annotations.ValidInteger; import org.gcube.accounting.datamodel.annotations.ValidLong; +import org.gcube.accounting.datamodel.implementations.aggregated.StorageStatusUsageRecord; import org.gcube.accounting.exception.InvalidValueException; /** * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ * */ -public class StorageUsageUsageRecord extends StorageStatusUsageRecord { +public class StorageUsageUsageRecord extends StorageStatusUsageRecord implements SingleUsageRecord { /** * Generated Serial Version UID 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 3215f9f..bd5a016 100644 --- a/src/main/java/org/gcube/accounting/datamodel/implementations/TaskUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/TaskUsageRecord.java @@ -6,6 +6,7 @@ package org.gcube.accounting.datamodel.implementations; import java.util.Calendar; import org.gcube.accounting.datamodel.RawUsageRecord; +import org.gcube.accounting.datamodel.SingleUsageRecord; import org.gcube.accounting.datamodel.annotations.NotEmpty; import org.gcube.accounting.datamodel.annotations.ValidInteger; import org.gcube.accounting.datamodel.annotations.ValidLong; @@ -15,7 +16,7 @@ import org.gcube.accounting.exception.InvalidValueException; * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ * */ -public class TaskUsageRecord extends RawUsageRecord { +public class TaskUsageRecord extends RawUsageRecord implements SingleUsageRecord { /** * Generated Serial Version UID diff --git a/src/main/java/org/gcube/accounting/datamodel/aggregated/StorageStatusUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/StorageStatusUsageRecord.java similarity index 96% rename from src/main/java/org/gcube/accounting/datamodel/aggregated/StorageStatusUsageRecord.java rename to src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/StorageStatusUsageRecord.java index 0ee0607..c71a46d 100644 --- a/src/main/java/org/gcube/accounting/datamodel/aggregated/StorageStatusUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/StorageStatusUsageRecord.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.accounting.datamodel.aggregated; +package org.gcube.accounting.datamodel.implementations.aggregated; import org.gcube.accounting.datamodel.RawUsageRecord; import org.gcube.accounting.datamodel.annotations.NotEmpty; @@ -11,7 +11,6 @@ import org.gcube.accounting.exception.InvalidValueException; /** * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ - * */ public class StorageStatusUsageRecord extends RawUsageRecord {