2015-05-28 13:19:25 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2015-07-01 12:50:00 +02:00
|
|
|
package org.gcube.accounting.datamodel.basetypes;
|
2015-05-28 13:19:25 +02:00
|
|
|
|
2015-06-09 15:53:21 +02:00
|
|
|
import java.io.Serializable;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2015-06-10 17:36:50 +02:00
|
|
|
import org.gcube.accounting.datamodel.BasicUsageRecord;
|
2020-07-10 18:30:52 +02:00
|
|
|
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
2015-12-18 17:09:05 +01:00
|
|
|
import org.gcube.documentstore.exception.InvalidValueException;
|
2015-12-21 11:50:09 +01:00
|
|
|
import org.gcube.documentstore.records.implementation.RequiredField;
|
|
|
|
import org.gcube.documentstore.records.implementation.validations.annotations.NotEmpty;
|
|
|
|
import org.gcube.documentstore.records.implementation.validations.annotations.NotEmptyIfNotNull;
|
2015-05-28 13:19:25 +02:00
|
|
|
|
|
|
|
/**
|
2016-10-12 14:15:28 +02:00
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
2015-05-28 13:19:25 +02:00
|
|
|
*/
|
2015-07-29 14:41:28 +02:00
|
|
|
public abstract class AbstractPortletUsageRecord extends BasicUsageRecord {
|
2015-05-28 13:19:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generated Serial Version UID
|
|
|
|
*/
|
|
|
|
private static final long serialVersionUID = 8339324883678974869L;
|
|
|
|
|
2017-09-06 11:47:13 +02:00
|
|
|
//@DeprecatedWarning @MoveToConsumerId
|
|
|
|
//protected static final String USER_ID = "userId";
|
|
|
|
|
2015-06-08 17:30:08 +02:00
|
|
|
@RequiredField @NotEmpty
|
2015-06-05 18:50:07 +02:00
|
|
|
public static final String PORTLET_ID = "portletId";
|
2015-06-08 17:30:08 +02:00
|
|
|
@RequiredField @NotEmpty
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String OPERATION_ID = "operationId";
|
2015-06-10 15:15:07 +02:00
|
|
|
@NotEmptyIfNotNull
|
|
|
|
public static final String MESSAGE = "message";
|
|
|
|
|
2015-07-29 14:41:28 +02:00
|
|
|
public AbstractPortletUsageRecord(){
|
2015-05-28 13:19:25 +02:00
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
2016-01-28 18:29:11 +01:00
|
|
|
public AbstractPortletUsageRecord(Map<String, ? extends Serializable> properties) throws InvalidValueException {
|
2015-06-09 15:53:21 +02:00
|
|
|
super(properties);
|
|
|
|
}
|
|
|
|
|
2015-07-29 14:41:28 +02:00
|
|
|
private static final String ABSTRACT_TO_REPLACE = "Abstract";
|
|
|
|
|
|
|
|
@Override
|
2017-09-06 11:47:13 +02:00
|
|
|
public String getRecordType() {
|
2015-07-29 14:41:28 +02:00
|
|
|
return AbstractPortletUsageRecord.class.getSimpleName().replace(ABSTRACT_TO_REPLACE, "");
|
|
|
|
}
|
|
|
|
|
2017-09-21 09:52:10 +02:00
|
|
|
@JsonIgnore
|
2015-06-05 18:50:07 +02:00
|
|
|
public String getPortletId() {
|
2015-06-09 14:54:14 +02:00
|
|
|
return (String) this.resourceProperties.get(PORTLET_ID);
|
2015-06-05 18:50:07 +02:00
|
|
|
}
|
2017-05-11 16:38:38 +02:00
|
|
|
|
2015-06-05 18:50:07 +02:00
|
|
|
public void setPortletId(String portletId) throws InvalidValueException {
|
2015-06-09 14:54:14 +02:00
|
|
|
setResourceProperty(PORTLET_ID, portletId);
|
2015-06-05 18:50:07 +02:00
|
|
|
}
|
|
|
|
|
2017-09-21 09:52:10 +02:00
|
|
|
@JsonIgnore
|
2015-05-29 16:08:21 +02:00
|
|
|
public String getOperationId() {
|
2015-06-09 14:54:14 +02:00
|
|
|
return (String) this.resourceProperties.get(OPERATION_ID);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setOperationId(String operationId) throws InvalidValueException {
|
2015-06-09 14:54:14 +02:00
|
|
|
setResourceProperty(OPERATION_ID, operationId);
|
2015-05-29 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
2017-09-21 09:52:10 +02:00
|
|
|
@JsonIgnore
|
2015-06-10 15:15:07 +02:00
|
|
|
public String getMessage() {
|
|
|
|
return (String) this.resourceProperties.get(MESSAGE);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setMessage(String message) throws InvalidValueException {
|
|
|
|
setResourceProperty(MESSAGE, message);
|
|
|
|
}
|
2017-09-14 14:21:23 +02:00
|
|
|
|
2015-05-28 13:19:25 +02:00
|
|
|
}
|