2015-05-28 13:19:25 +02:00
|
|
|
package org.gcube.accounting.datamodel;
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
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;
|
|
|
|
import org.gcube.documentstore.records.Record;
|
2015-05-28 13:19:25 +02:00
|
|
|
|
2016-10-12 14:15:28 +02:00
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
|
|
*/
|
2015-12-18 17:09:05 +01:00
|
|
|
public interface UsageRecord extends Record {
|
2015-05-28 13:19:25 +02:00
|
|
|
|
2015-12-03 11:06:15 +01:00
|
|
|
public enum OperationResult implements Serializable, Comparable<OperationResult> {
|
2015-06-04 18:52:29 +02:00
|
|
|
SUCCESS, FAILED
|
|
|
|
}
|
|
|
|
|
2015-07-09 15:34:31 +02:00
|
|
|
/**
|
2015-12-18 17:09:05 +01:00
|
|
|
* KEY for : The Operation Result of the accounted operation.
|
2017-10-27 18:17:37 +02:00
|
|
|
* The value is expressed as OperationResult
|
2015-07-09 15:34:31 +02:00
|
|
|
*/
|
2015-12-18 17:09:05 +01:00
|
|
|
public static final String OPERATION_RESULT = "operationResult";
|
2015-07-09 15:34:31 +02:00
|
|
|
|
2015-07-29 14:41:28 +02:00
|
|
|
/**
|
2015-12-18 17:09:05 +01:00
|
|
|
* KEY for : The user (or the Consumer Identity, that in the S2S
|
|
|
|
* communication is another service).
|
2015-07-29 14:41:28 +02:00
|
|
|
*/
|
2015-12-18 17:09:05 +01:00
|
|
|
public static final String CONSUMER_ID = "consumerId";
|
2015-07-29 14:41:28 +02:00
|
|
|
|
2015-05-28 13:19:25 +02:00
|
|
|
/**
|
2015-12-18 17:09:05 +01:00
|
|
|
* KEY for : The scope
|
2015-05-28 13:19:25 +02:00
|
|
|
*/
|
2015-12-18 17:09:05 +01:00
|
|
|
public static final String SCOPE = "scope";
|
|
|
|
|
2015-05-28 13:19:25 +02:00
|
|
|
/**
|
2015-12-18 17:09:05 +01:00
|
|
|
* @return the Operation Result of the accounted operation.
|
|
|
|
*/
|
2017-09-18 15:08:46 +02:00
|
|
|
@JsonIgnore
|
2015-12-18 17:09:05 +01:00
|
|
|
public OperationResult getOperationResult();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the Operation Result related to the accounted Usage Record
|
|
|
|
* @param operationResult the Operation Result to set
|
|
|
|
* @throws InvalidValueException
|
2015-05-28 13:19:25 +02:00
|
|
|
*/
|
2015-12-18 17:09:05 +01:00
|
|
|
public void setOperationResult(OperationResult operationResult) throws InvalidValueException;
|
2015-05-28 13:19:25 +02:00
|
|
|
|
|
|
|
/**
|
2015-06-25 17:41:20 +02:00
|
|
|
* Return the user (or the Consumer Identity, that in the S2S
|
|
|
|
* communication is another service)
|
2015-05-28 13:19:25 +02:00
|
|
|
* @return Consumer ID
|
|
|
|
*/
|
2017-09-18 15:08:46 +02:00
|
|
|
@JsonIgnore
|
2015-05-28 13:19:25 +02:00
|
|
|
public String getConsumerId();
|
|
|
|
|
|
|
|
/**
|
2015-06-25 17:41:20 +02:00
|
|
|
* Set the user (or the Consumer Identity, that in the S2S
|
|
|
|
* communication is another service)
|
2015-05-28 13:19:25 +02:00
|
|
|
* @param consumerId Consumer ID
|
|
|
|
* @throws InvalidValueException
|
|
|
|
*/
|
|
|
|
public void setConsumerId(String consumerId) throws InvalidValueException;
|
|
|
|
|
|
|
|
/**
|
2015-06-25 17:41:20 +02:00
|
|
|
* Return the scope of this {#UsageRecord}
|
|
|
|
* @return The scope of this {#UsageRecord}
|
2015-05-28 13:19:25 +02:00
|
|
|
*/
|
2017-09-18 15:08:46 +02:00
|
|
|
@JsonIgnore
|
2015-06-23 17:47:38 +02:00
|
|
|
public String getScope();
|
2015-05-28 13:19:25 +02:00
|
|
|
|
|
|
|
/**
|
2015-12-18 17:09:05 +01:00
|
|
|
* Set the scope of the {#UsageRecord}
|
|
|
|
* @param scope the scope of the {#UsageRecord}
|
2015-05-28 13:19:25 +02:00
|
|
|
* @throws InvalidValueException
|
|
|
|
*/
|
2015-06-23 17:47:38 +02:00
|
|
|
public void setScope(String scope) throws InvalidValueException;
|
2015-05-28 13:19:25 +02:00
|
|
|
|
|
|
|
}
|