From a8e522a45beb8113e08fe394d6ee41abb123131c Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 15 Jun 2015 13:53:40 +0000 Subject: [PATCH] refs #200: Create accouting-lib library https://support.d4science.org/issues/200 Fixing data model for backward compatibility git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@115389 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../gcube/accounting/datamodel/RawUsageRecord.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gcube/accounting/datamodel/RawUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/RawUsageRecord.java index 4fa1a77..c93fe76 100644 --- a/src/main/java/org/gcube/accounting/datamodel/RawUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/RawUsageRecord.java @@ -22,6 +22,7 @@ import org.gcube.accounting.datamodel.implementations.ServiceUsageRecord; import org.gcube.accounting.datamodel.implementations.StorageUsageRecord; import org.gcube.accounting.datamodel.implementations.TaskUsageRecord; import org.gcube.accounting.datamodel.validations.annotations.NotEmpty; +import org.gcube.accounting.datamodel.validations.annotations.NotEmptyIfNotNull; import org.gcube.accounting.datamodel.validations.validators.NotEmptyIfNotNullValidator; import org.gcube.accounting.exception.InvalidValueException; import org.slf4j.Logger; @@ -135,6 +136,9 @@ public class RawUsageRecord extends BasicUsageRecord { } } + @NotEmptyIfNotNull @DeprecatedWarning + protected static final String FULLY_QUALIFIED_CONSUMER_ID = "fullyQualifiedConsumerId"; + public RawUsageRecord(){ super(); this.resourceProperties.remove(USAGE_RECORD_TYPE); @@ -372,7 +376,7 @@ public class RawUsageRecord extends BasicUsageRecord { */ @Deprecated public String getFullyQualifiedConsumerId() { - return getConsumerId(); + return (String) this.resourceProperties.get(FULLY_QUALIFIED_CONSUMER_ID); } /** @@ -382,7 +386,11 @@ public class RawUsageRecord extends BasicUsageRecord { */ @Deprecated public void setFullyQualifiedConsumerId(String fqcid) { - // TODO + try { + setResourceProperty(FULLY_QUALIFIED_CONSUMER_ID, fqcid); + } catch (InvalidValueException e) { + logger.error("Unable to Set {}", FULLY_QUALIFIED_CONSUMER_ID); + } }