accounting-lib/src/main/java/org/gcube/accounting/datamodel/implementations/PortletUsageRecord.java

81 lines
2.2 KiB
Java

/**
*
*/
package org.gcube.accounting.datamodel.implementations;
import java.io.Serializable;
import java.util.Map;
import org.gcube.accounting.datamodel.RawUsageRecord;
import org.gcube.accounting.datamodel.SingleUsageRecord;
import org.gcube.accounting.datamodel.decorators.RequiredField;
import org.gcube.accounting.datamodel.deprecationmanagement.annotations.DeprecatedWarning;
import org.gcube.accounting.datamodel.validations.annotations.NotEmpty;
import org.gcube.accounting.datamodel.validations.annotations.NotEmptyIfNotNull;
import org.gcube.accounting.exception.InvalidValueException;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class PortletUsageRecord extends RawUsageRecord implements SingleUsageRecord {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 8339324883678974869L;
@NotEmptyIfNotNull @DeprecatedWarning
protected static final String USER_ID = "userId";
@RequiredField @NotEmpty
public static final String PORTLET_ID = "portletId";
@RequiredField @NotEmpty
public static final String OPERATION_ID = "operationId";
@NotEmptyIfNotNull
public static final String MESSAGE = "message";
public PortletUsageRecord(){
super();
}
public PortletUsageRecord(Map<String, Serializable> properties) throws InvalidValueException {
super(properties);
}
@Deprecated
public String getUserId() {
return (String) this.resourceProperties.get(USER_ID);
}
@Deprecated
public void setUserId(String userId) throws InvalidValueException {
setResourceProperty(USER_ID, userId);
}
public String getPortletId() {
return (String) this.resourceProperties.get(PORTLET_ID);
}
public void setPortletId(String portletId) throws InvalidValueException {
setResourceProperty(PORTLET_ID, portletId);
}
public String getOperationId() {
return (String) this.resourceProperties.get(OPERATION_ID);
}
public void setOperationId(String operationId) throws InvalidValueException {
setResourceProperty(OPERATION_ID, operationId);
}
public String getMessage() {
return (String) this.resourceProperties.get(MESSAGE);
}
public void setMessage(String message) throws InvalidValueException {
setResourceProperty(MESSAGE, message);
}
}