2015-06-09 14:03:59 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2015-12-18 17:09:05 +01:00
|
|
|
package org.gcube.accounting.datamodel.aggregation;
|
2015-06-09 14:03:59 +02:00
|
|
|
|
2015-06-09 15:53:21 +02:00
|
|
|
import java.io.Serializable;
|
2015-11-30 18:34:48 +01:00
|
|
|
import java.util.Calendar;
|
2015-06-09 15:53:21 +02:00
|
|
|
import java.util.Map;
|
2015-06-09 14:03:59 +02:00
|
|
|
|
|
|
|
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
2015-07-29 14:41:28 +02:00
|
|
|
import org.gcube.accounting.datamodel.basetypes.AbstractPortletUsageRecord;
|
|
|
|
import org.gcube.accounting.datamodel.usagerecords.PortletUsageRecord;
|
2015-12-18 17:09:05 +01:00
|
|
|
import org.gcube.documentstore.exception.InvalidValueException;
|
|
|
|
import org.gcube.documentstore.exception.NotAggregatableRecordsExceptions;
|
2016-01-13 16:18:59 +01:00
|
|
|
import org.gcube.documentstore.records.aggregation.AggregationUtility;
|
2015-06-09 14:03:59 +02:00
|
|
|
|
|
|
|
/**
|
2015-06-23 17:47:38 +02:00
|
|
|
* This Class is for library internal use only
|
2016-10-12 14:15:28 +02:00
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
2015-06-09 14:03:59 +02:00
|
|
|
*/
|
2015-07-29 14:41:28 +02:00
|
|
|
public class AggregatedPortletUsageRecord extends AbstractPortletUsageRecord implements AggregatedUsageRecord<AggregatedPortletUsageRecord, PortletUsageRecord> {
|
2015-06-09 14:03:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generated Serial version UID
|
|
|
|
*/
|
|
|
|
private static final long serialVersionUID = 7445526162102677455L;
|
2015-12-18 17:09:05 +01:00
|
|
|
|
2015-07-29 14:41:28 +02:00
|
|
|
public AggregatedPortletUsageRecord(){
|
2015-06-09 14:03:59 +02:00
|
|
|
super();
|
|
|
|
}
|
2015-06-09 15:53:21 +02:00
|
|
|
|
2016-01-28 18:29:11 +01:00
|
|
|
public AggregatedPortletUsageRecord(Map<String, ? extends Serializable> properties) throws InvalidValueException{
|
2015-06-09 15:53:21 +02:00
|
|
|
super(properties);
|
2015-12-18 17:09:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
public AggregatedPortletUsageRecord(PortletUsageRecord portletUsageRecord) throws InvalidValueException {
|
|
|
|
throw new UnsupportedOperationException();
|
2015-06-09 15:53:21 +02:00
|
|
|
}
|
2015-06-23 17:47:38 +02:00
|
|
|
|
2015-11-19 16:19:51 +01:00
|
|
|
@Override
|
|
|
|
public int getOperationCount() {
|
|
|
|
return super.getOperationCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setOperationCount(int operationCount) throws InvalidValueException {
|
|
|
|
super.setOperationCount(operationCount);
|
|
|
|
}
|
|
|
|
|
2015-11-30 18:34:48 +01:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public Calendar getStartTime() {
|
2015-12-02 11:08:14 +01:00
|
|
|
return super.getStartTimeAsCalendar();
|
2015-11-30 18:34:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void setStartTime(Calendar startTime) throws InvalidValueException {
|
|
|
|
super.setStartTime(startTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
2015-12-02 11:08:14 +01:00
|
|
|
public Calendar getEndTime() {
|
|
|
|
return super.getEndTimeAsCalendar();
|
2015-11-30 18:34:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void setEndTime(Calendar endTime) throws InvalidValueException {
|
|
|
|
super.setEndTime(endTime);
|
|
|
|
}
|
2015-06-23 17:47:38 +02:00
|
|
|
|
2015-12-18 17:09:05 +01:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public AggregatedPortletUsageRecord aggregate(
|
|
|
|
AggregatedPortletUsageRecord record)
|
|
|
|
throws NotAggregatableRecordsExceptions {
|
2016-01-13 16:18:59 +01:00
|
|
|
try {
|
2016-02-19 11:49:07 +01:00
|
|
|
/* TODO
|
2016-01-13 16:18:59 +01:00
|
|
|
AggregationUtility<AggregatedPortletUsageRecord> aggregationUtility = new AggregationUtility<AggregatedPortletUsageRecord>(this);
|
|
|
|
aggregationUtility.aggregate(record);
|
2016-02-19 11:49:07 +01:00
|
|
|
} catch(NotAggregatableRecordsExceptions e){
|
|
|
|
throw e; */
|
|
|
|
} catch(Exception ex){
|
|
|
|
throw new NotAggregatableRecordsExceptions(ex);
|
2016-01-13 16:18:59 +01:00
|
|
|
}
|
|
|
|
//return this;
|
|
|
|
|
2015-12-18 17:09:05 +01:00
|
|
|
throw new UnsupportedOperationException();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public AggregatedPortletUsageRecord aggregate(PortletUsageRecord record)
|
|
|
|
throws NotAggregatableRecordsExceptions {
|
2016-01-13 16:18:59 +01:00
|
|
|
try {
|
|
|
|
return aggregate(new AggregatedPortletUsageRecord(record));
|
|
|
|
} catch (InvalidValueException e) {
|
|
|
|
throw new NotAggregatableRecordsExceptions(e.getCause());
|
|
|
|
}
|
2015-12-18 17:09:05 +01:00
|
|
|
}
|
|
|
|
|
2016-01-13 16:18:59 +01:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public boolean isAggregable(AggregatedPortletUsageRecord record) throws NotAggregatableRecordsExceptions {
|
|
|
|
AggregationUtility<AggregatedPortletUsageRecord> aggregationUtility = new AggregationUtility<AggregatedPortletUsageRecord>(this);
|
|
|
|
return aggregationUtility.isAggregable(record);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public boolean isAggregable(PortletUsageRecord record) throws NotAggregatableRecordsExceptions {
|
|
|
|
try {
|
|
|
|
return isAggregable(new AggregatedPortletUsageRecord(record));
|
|
|
|
} catch (InvalidValueException e) {
|
|
|
|
throw new NotAggregatableRecordsExceptions(e.getCause());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-18 17:09:05 +01:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public Class<PortletUsageRecord> getAggregable() {
|
|
|
|
return PortletUsageRecord.class;
|
|
|
|
}
|
|
|
|
|
2015-06-09 14:03:59 +02:00
|
|
|
}
|