Added support for Context
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@133956 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b7c366e5da
commit
88c8e22ecb
|
@ -2,8 +2,6 @@ package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
|
|||
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.job.JobChartBasicPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.job.JobChartTopPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.service.ServiceChartBasicPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.service.ServiceChartTopPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ChartDrawException;
|
||||
|
|
|
@ -495,6 +495,14 @@ public class StorageChartBasicPanel extends SimpleContainer {
|
|||
|
||||
seriesOperationCount.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
/*seriesOperationCount.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
clickEvent.series().xAxis().
|
||||
clickEvent.series().name()
|
||||
}
|
||||
});*/
|
||||
|
||||
ArrayNumber dataDataVolume = seriesDataVolume.dataAsArrayNumber();
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.admin.accountingmanager.client.rpc;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesRequest;
|
||||
|
@ -66,6 +67,14 @@ public interface AccountingManagerService extends RemoteService {
|
|||
public ArrayList<FilterValue> getFilterValues(
|
||||
FilterValuesRequest filterValuesRequest) throws ServiceException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @throws ServiceException
|
||||
*/
|
||||
public Context getContext() throws ServiceException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param itemDescription
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.gcube.portlets.admin.accountingmanager.client.rpc;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesRequest;
|
||||
|
@ -58,20 +59,28 @@ public interface AccountingManagerServiceAsync {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param filterValuesRequest request values available
|
||||
* @param filterValuesRequest
|
||||
* request values available
|
||||
* @param callback
|
||||
*/
|
||||
void getFilterValues(FilterValuesRequest filterValuesRequest,
|
||||
AsyncCallback<ArrayList<FilterValue>> callback);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param itemDescription item description
|
||||
* @param callback
|
||||
*/
|
||||
void getContext(AsyncCallback<Context> callback);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param itemDescription
|
||||
* item description
|
||||
* @param callback
|
||||
*/
|
||||
void getPublicLink(ItemDescription itemDescription,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param accountingStateData
|
||||
|
@ -79,13 +88,12 @@ public interface AccountingManagerServiceAsync {
|
|||
*/
|
||||
void saveCSVOnWorkspace(AccountingType accountingType,
|
||||
AsyncCallback<ItemDescription> callback);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param callback return the list of enabled tabs
|
||||
* @param callback
|
||||
* return the list of enabled tabs
|
||||
*/
|
||||
void getEnableTabs(AsyncCallback<EnableTabs> callback);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.gcube.portlets.admin.accountingmanager.server.state.AccountingStateDa
|
|||
import org.gcube.portlets.admin.accountingmanager.server.storage.StorageUtil;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesRequest;
|
||||
|
@ -216,6 +217,35 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Context getContext() throws ServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||
String token = SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: " + token);
|
||||
|
||||
Context context=SessionUtil.getContext(aslSession);
|
||||
logger.debug("getContext(): "+context);
|
||||
|
||||
return context;
|
||||
|
||||
} catch (ServiceException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
logger.error("getContext(): " + e.getLocalizedMessage(), e);
|
||||
throw new ServiceException(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemDescription saveCSVOnWorkspace(AccountingType accountingType)
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
*/
|
||||
package org.gcube.portlets.admin.accountingmanager.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
|
@ -12,8 +15,12 @@ import org.gcube.portlets.admin.accountingmanager.server.state.AccountingState;
|
|||
import org.gcube.portlets.admin.accountingmanager.server.state.AccountingStateData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.SessionExpiredException;
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -104,4 +111,61 @@ public class SessionUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static Context getContext(ASLSession aslSession) throws ServiceException {
|
||||
|
||||
try {
|
||||
logger.info("Current context is " + aslSession.getScope());
|
||||
ArrayList<String> contexts = new ArrayList<>();
|
||||
contexts.add(aslSession.getScope());
|
||||
|
||||
GroupManager gm = new LiferayGroupManager();
|
||||
long currentGroupId = gm
|
||||
.getGroupIdFromInfrastructureScope(aslSession.getScope());
|
||||
GCubeGroup currentGroup = gm.getGroup(currentGroupId);
|
||||
|
||||
// three cases
|
||||
if (gm.isVRE(currentGroupId)) {
|
||||
|
||||
// do nothing
|
||||
|
||||
} else if (gm.isVO(currentGroupId)) {
|
||||
|
||||
// iterate over its vres
|
||||
List<GCubeGroup> children = currentGroup.getChildren();
|
||||
for (GCubeGroup gCubeGroup : children) {
|
||||
contexts.add(gm.getInfrastructureScope(gCubeGroup
|
||||
.getGroupId()));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// is root
|
||||
List<GCubeGroup> children = currentGroup.getChildren();
|
||||
for (GCubeGroup gCubeGroup : children) {
|
||||
contexts.add(gm.getInfrastructureScope(gCubeGroup
|
||||
.getGroupId()));
|
||||
|
||||
// get the vo children
|
||||
List<GCubeGroup> childrenVO = gCubeGroup.getChildren();
|
||||
for (GCubeGroup voChildren : childrenVO) {
|
||||
contexts.add(gm.getInfrastructureScope(voChildren
|
||||
.getGroupId()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add the current scope too
|
||||
Context context=new Context(contexts);
|
||||
|
||||
|
||||
return context;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error retrieving context!", e);
|
||||
throw new ServiceException("Error retrieving context!", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.admin.accountingmanager.server.amservice;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandGetFilterKeys;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandGetFilterValues;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandTop;
|
||||
|
@ -14,6 +15,7 @@ import org.gcube.portlets.admin.accountingmanager.server.amservice.query.Account
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery4Task;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryBuilder;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryDirector;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
|
@ -52,6 +54,8 @@ public class AccountingCaller implements AccountingCallerInterface {
|
|||
return accountingCommand.execute();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public SeriesResponse getSeries(AccountingType accountingType,
|
||||
SeriesRequest seriesRequest)
|
||||
|
@ -84,6 +88,10 @@ public class AccountingCaller implements AccountingCallerInterface {
|
|||
AccountingQueryTop accountingQueryTop = (AccountingQueryTop) query;
|
||||
AccountingCommandTop accountingCommandTop=new AccountingCommandTop(accountingQueryTop,accountingType);
|
||||
return accountingCommandTop.execute();
|
||||
case Context:
|
||||
AccountingQueryContext accountingQueryContext = (AccountingQueryContext) query;
|
||||
AccountingCommandContext accountingCommandContext=new AccountingCommandContext(accountingQueryContext,accountingType);
|
||||
return accountingCommandContext.execute();
|
||||
default:
|
||||
throw new ServiceException(
|
||||
"Error in invocation: Operation not supported");
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQueryFactory;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4JobContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4PortletContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4ServiceContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4StorageContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4TaskContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponseBuilder;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponseDirector;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class AccountingCommandContext implements AccountingCommand<SeriesResponse> {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(AccountingCommandContext.class);
|
||||
|
||||
private AccountingQueryContext accountingQueryContext;
|
||||
private AccountingType accountingType;
|
||||
|
||||
public AccountingCommandContext(AccountingQueryContext accountingQueryContext,
|
||||
AccountingType accountingType) {
|
||||
this.accountingQueryContext = accountingQueryContext;
|
||||
this.accountingType = accountingType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SeriesResponse execute() throws ServiceException {
|
||||
try {
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
|
||||
.getInstance();
|
||||
|
||||
logger.debug("Query Context: "
|
||||
+ accountingQueryContext.getContext());
|
||||
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
Context context=accountingQueryContext.getContext();
|
||||
|
||||
if(context==null){
|
||||
throw new ServiceException(
|
||||
"Error retrieving context param: null!");
|
||||
}
|
||||
|
||||
contextSM= apq.getContextTimeSeries(accountingQueryContext.getType(),
|
||||
accountingQueryContext.getTemporalConstraint(),
|
||||
accountingQueryContext.getFilters(),
|
||||
context.getContexts(),
|
||||
true);
|
||||
|
||||
|
||||
if (contextSM == null) {
|
||||
throw new ServiceException(
|
||||
"Error retrieving info for context: sorted map is null!");
|
||||
}
|
||||
|
||||
logger.debug("ContextSM: " + contextSM);
|
||||
|
||||
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(
|
||||
accountingType, context, contextSM);
|
||||
|
||||
SeriesResponseDirector seriesResponseDirector = new SeriesResponseDirector();
|
||||
seriesResponseDirector
|
||||
.setSeriesResponseBuilder(seriesResponseBuilder);
|
||||
seriesResponseDirector.constructSeriesResponse();
|
||||
SeriesResponse seriesResponse = seriesResponseDirector
|
||||
.getSeriesResponse();
|
||||
|
||||
if (seriesResponse == null) {
|
||||
throw new ServiceException("Error creating series response!");
|
||||
}
|
||||
logger.debug("SeriesResponse Created: " + seriesResponse);
|
||||
return seriesResponse;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error in AccountingCommandTop(): "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("No data available!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private SeriesResponseBuilder getSeriesResponseBuilder(
|
||||
AccountingType accountingType, Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM)
|
||||
throws ServiceException {
|
||||
if (accountingType == null) {
|
||||
throw new ServiceException("Error accounting type is null");
|
||||
}
|
||||
|
||||
switch (accountingType) {
|
||||
case JOB:
|
||||
return new SeriesResponse4JobContext(context,contextSM);
|
||||
case PORTLET:
|
||||
return new SeriesResponse4PortletContext(context, contextSM);
|
||||
case SERVICE:
|
||||
return new SeriesResponse4ServiceContext(context, contextSM);
|
||||
case STORAGE:
|
||||
return new SeriesResponse4StorageContext(context, contextSM);
|
||||
case TASK:
|
||||
return new SeriesResponse4TaskContext(context, contextSM);
|
||||
default:
|
||||
throw new ServiceException("Error request type is unknow!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -46,7 +46,7 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
|||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
|
||||
.getInstance();
|
||||
|
||||
logger.debug("Qyery TopValues: "
|
||||
logger.debug("Query TopValues: "
|
||||
+ accountingQueryTop.getFilterKey().getKey());
|
||||
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord;
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -110,9 +111,28 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterContext.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(
|
||||
AggregatedJobUsageRecord.class,
|
||||
accountingFilterContext.getContexts(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.accounting.datamodel.aggregation.AggregatedPortletUsageRecord;
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -109,9 +110,28 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
|||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterContext.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(
|
||||
AggregatedPortletUsageRecord.class,
|
||||
accountingFilterContext.getContexts(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -110,9 +111,29 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterContext.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(
|
||||
AggregatedServiceUsageRecord.class,
|
||||
accountingFilterContext.getContexts(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -110,9 +111,28 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterContext.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(
|
||||
AggregatedStorageUsageRecord.class,
|
||||
accountingFilterContext.getContexts(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.accounting.datamodel.aggregation.AggregatedTaskUsageRecord;
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -109,9 +110,29 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
|||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterContext.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(
|
||||
AggregatedTaskUsageRecord.class,
|
||||
accountingFilterContext.getContexts(),
|
||||
temporalConstraint,
|
||||
filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class AccountingQueryContext extends AccountingQuery {
|
||||
private Class<? extends AggregatedUsageRecord<?, ?>> type;
|
||||
private Context context;
|
||||
private TemporalConstraint temporalConstraint;
|
||||
private ArrayList<Filter> filters;
|
||||
|
||||
public AccountingQueryContext(
|
||||
Class<? extends AggregatedUsageRecord<?, ?>> type, Context context,
|
||||
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Context;
|
||||
this.type = type;
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
this.filters = filters;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public Class<? extends AggregatedUsageRecord<?, ?>> getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Class<? extends AggregatedUsageRecord<?, ?>> type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public TemporalConstraint getTemporalConstraint() {
|
||||
return temporalConstraint;
|
||||
}
|
||||
|
||||
public void setTemporalConstraint(TemporalConstraint temporalConstraint) {
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
}
|
||||
|
||||
public ArrayList<Filter> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(ArrayList<Filter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingQueryContext [type=" + type + ", context=" + context
|
||||
+ ", temporalConstraint=" + temporalConstraint + ", filters="
|
||||
+ filters + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -5,11 +5,9 @@ import java.util.List;
|
|||
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Context Series Response 4 Job
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4JobContext extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4JobContext.class);
|
||||
private Context context;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
public SeriesResponse4JobContext(Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM) {
|
||||
this.context=context;
|
||||
this.contextSM = contextSM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if (contextSM == null || contextSM.isEmpty()) {
|
||||
logger.error("Error creating series for job accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
ArrayList<SeriesJobDataContext> seriesJobDataContextList = new ArrayList<>();
|
||||
|
||||
for (Filter contextValue : contextSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesJobData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = contextSM.get(contextValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
Long duration = jso
|
||||
.getLong(AggregatedServiceUsageRecord.DURATION);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedServiceUsageRecord.OPERATION_COUNT);
|
||||
Long maxInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
||||
Long minInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
||||
|
||||
series.add(new SeriesJobData(info.getCalendar().getTime(),
|
||||
operationCount, duration, maxInvocationTime,
|
||||
minInvocationTime));
|
||||
|
||||
}
|
||||
SeriesJobDataContext seriesJobDataContext = new SeriesJobDataContext(
|
||||
contextValue.getValue(), series);
|
||||
seriesJobDataContextList.add(seriesJobDataContext);
|
||||
|
||||
}
|
||||
|
||||
SeriesJobContext seriesJobContext = new SeriesJobContext(context,
|
||||
seriesJobDataContextList);
|
||||
SeriesJob seriesService = new SeriesJob(seriesJobContext);
|
||||
|
||||
seriesResponseSpec.setSr(seriesService);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for job accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for job accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -6,17 +6,12 @@ import java.util.SortedMap;
|
|||
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.NumberedFilter;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedPortletUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesPortlet;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet.SeriesPortletContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet.SeriesPortletData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet.SeriesPortletDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Context Series Response 4 Portlet
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4PortletContext extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4PortletContext.class);
|
||||
private Context context;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
public SeriesResponse4PortletContext(Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM) {
|
||||
this.context = context;
|
||||
this.contextSM = contextSM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if (contextSM == null || contextSM.isEmpty()) {
|
||||
logger.error("Error creating series for portlet accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
ArrayList<SeriesPortletDataContext> seriesPortletDataContextList = new ArrayList<>();
|
||||
|
||||
for (Filter contextValue : contextSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesPortletData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = contextSM.get(contextValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
// Long duration =
|
||||
// jso.getLong(AggregatedPortletUsageRecord.DURATION);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedPortletUsageRecord.OPERATION_COUNT);
|
||||
// Long maxInvocationTime =
|
||||
// jso.getLong(AggregatedPortletUsageRecord.MAX_INVOCATION_TIME);
|
||||
// Long minInvocationTime =
|
||||
// jso.getLong(AggregatedPortletUsageRecord.MIN_INVOCATION_TIME);
|
||||
|
||||
series.add(new SeriesPortletData(info.getCalendar()
|
||||
.getTime(), operationCount));
|
||||
}
|
||||
SeriesPortletDataContext seriesPortletDataContext = new SeriesPortletDataContext(
|
||||
contextValue.getValue(), series);
|
||||
seriesPortletDataContextList.add(seriesPortletDataContext);
|
||||
|
||||
}
|
||||
|
||||
SeriesPortletContext seriesPortletContext = new SeriesPortletContext(
|
||||
context, seriesPortletDataContextList);
|
||||
SeriesPortlet seriesPortlet = new SeriesPortlet(
|
||||
seriesPortletContext);
|
||||
|
||||
seriesResponseSpec.setSr(seriesPortlet);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for portlet accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for portlet accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Context Series Response 4 Service
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4ServiceContext extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4ServiceContext.class);
|
||||
private Context context;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
public SeriesResponse4ServiceContext(Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM) {
|
||||
this.context = context;
|
||||
this.contextSM = contextSM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if (contextSM == null || contextSM.isEmpty()) {
|
||||
logger.error("Error creating series for service accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
ArrayList<SeriesServiceDataContext> seriesServiceDataContextList = new ArrayList<>();
|
||||
|
||||
for (Filter contextValue : contextSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesServiceData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = contextSM.get(contextValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
Long duration = jso
|
||||
.getLong(AggregatedServiceUsageRecord.DURATION);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedServiceUsageRecord.OPERATION_COUNT);
|
||||
Long maxInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
||||
Long minInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
||||
|
||||
series.add(new SeriesServiceData(info.getCalendar()
|
||||
.getTime(), operationCount, duration,
|
||||
maxInvocationTime, minInvocationTime));
|
||||
|
||||
}
|
||||
SeriesServiceDataContext seriesServiceDataContext = new SeriesServiceDataContext(
|
||||
contextValue.getValue(), series);
|
||||
seriesServiceDataContextList.add(seriesServiceDataContext);
|
||||
|
||||
}
|
||||
|
||||
SeriesServiceContext seriesServiceContext = new SeriesServiceContext(context,
|
||||
seriesServiceDataContextList);
|
||||
SeriesService seriesService = new SeriesService(
|
||||
seriesServiceContext);
|
||||
|
||||
seriesResponseSpec.setSr(seriesService);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for service accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for service accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Context Series Response 4 Storage
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4StorageContext extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4StorageContext.class);
|
||||
private Context context;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
public SeriesResponse4StorageContext(Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM) {
|
||||
this.context = context;
|
||||
this.contextSM = contextSM;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if (contextSM == null || contextSM.isEmpty()) {
|
||||
logger.error("Error creating series for storage accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
ArrayList<SeriesStorageDataContext> seriesStorageDataContextList = new ArrayList<>();
|
||||
|
||||
for (Filter contextValue : contextSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesStorageData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = contextSM.get(contextValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
Long dataVolume = jso
|
||||
.getLong(AggregatedStorageUsageRecord.DATA_VOLUME);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedStorageUsageRecord.OPERATION_COUNT);
|
||||
series.add(new SeriesStorageData(info.getCalendar()
|
||||
.getTime(), dataVolume, operationCount));
|
||||
|
||||
}
|
||||
SeriesStorageDataContext seriesStorageDataContext = new SeriesStorageDataContext(
|
||||
contextValue.getValue(), series);
|
||||
seriesStorageDataContextList.add(seriesStorageDataContext);
|
||||
|
||||
}
|
||||
|
||||
SeriesStorageContext seriesStorageContext = new SeriesStorageContext(
|
||||
context, seriesStorageDataContextList);
|
||||
SeriesStorage seriesStorage = new SeriesStorage(
|
||||
seriesStorageContext);
|
||||
|
||||
seriesResponseSpec.setSr(seriesStorage);
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for storage accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for storage accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedTaskUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesTask;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.SeriesTaskContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.SeriesTaskData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.SeriesTaskDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Context Series Response 4 Task
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4TaskContext extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4TaskContext.class);
|
||||
private Context context;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
public SeriesResponse4TaskContext(Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM) {
|
||||
this.context = context;
|
||||
this.contextSM = contextSM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if (contextSM == null || contextSM.isEmpty()) {
|
||||
logger.error("Error creating series for task accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
ArrayList<SeriesTaskDataContext> seriesTaskDataContextList = new ArrayList<>();
|
||||
|
||||
for (Filter contextValue : contextSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesTaskData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = contextSM.get(contextValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
// Long duration =
|
||||
// jso.getLong(AggregatedTaskUsageRecord.DURATION);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedTaskUsageRecord.OPERATION_COUNT);
|
||||
// Long maxInvocationTime =
|
||||
// jso.getLong(AggregatedTaskUsageRecord.MAX_INVOCATION_TIME);
|
||||
// Long minInvocationTime =
|
||||
// jso.getLong(AggregatedTaskUsageRecord.MIN_INVOCATION_TIME);
|
||||
|
||||
series.add(new SeriesTaskData(info.getCalendar().getTime(),
|
||||
operationCount));
|
||||
}
|
||||
SeriesTaskDataContext seriesTaskDataContext = new SeriesTaskDataContext(
|
||||
contextValue.getValue(), series);
|
||||
seriesTaskDataContextList.add(seriesTaskDataContext);
|
||||
|
||||
}
|
||||
|
||||
SeriesTaskContext seriesTaskContext = new SeriesTaskContext(
|
||||
context, seriesTaskDataContextList);
|
||||
SeriesTask seriesTask = new SeriesTask(seriesTaskContext);
|
||||
|
||||
seriesResponseSpec.setSr(seriesTask);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for portlet accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for portlet accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class AccountingFilterContext extends AccountingFilterDefinition
|
||||
implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6805006183397381154L;
|
||||
private Context context;
|
||||
private ArrayList<AccountingFilter> filters;
|
||||
|
||||
public AccountingFilterContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
context = null;
|
||||
filters = null;
|
||||
|
||||
}
|
||||
|
||||
public AccountingFilterContext(Context context,
|
||||
ArrayList<AccountingFilter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Context;
|
||||
this.context = context;
|
||||
this.filters = filters;
|
||||
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<AccountingFilter> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(ArrayList<AccountingFilter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingFilterContext [context=" + context + ", filters="
|
||||
+ filters + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
|
||||
public enum ChartType {
|
||||
|
||||
Basic("Basic"),Top("Top");
|
||||
Basic("Basic"),Top("Top"), Context("Context");
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class Context implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2453517525713556421L;
|
||||
private ArrayList<String> contexts;
|
||||
|
||||
public Context() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Context(ArrayList<String> contexts) {
|
||||
super();
|
||||
this.contexts = contexts;
|
||||
}
|
||||
|
||||
public ArrayList<String> getContexts() {
|
||||
return contexts;
|
||||
}
|
||||
|
||||
public void setContexts(ArrayList<String> contexts) {
|
||||
this.contexts = contexts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Context [contexts=" + contexts + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.job;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesJobContext extends SeriesJobDefinition {
|
||||
|
||||
private static final long serialVersionUID = -2350334263342186590L;
|
||||
private Context context;
|
||||
private ArrayList<SeriesJobDataContext> seriesJobDataContextList;
|
||||
|
||||
public SeriesJobContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
}
|
||||
|
||||
public SeriesJobContext(Context context,
|
||||
ArrayList<SeriesJobDataContext> seriesJobDataContextList) {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
this.context = context;
|
||||
this.seriesJobDataContextList = seriesJobDataContextList;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesJobDataContext> getSeriesJobDataContextList() {
|
||||
return seriesJobDataContextList;
|
||||
}
|
||||
|
||||
public void setSeriesJobDataContextList(
|
||||
ArrayList<SeriesJobDataContext> seriesJobDataContextList) {
|
||||
this.seriesJobDataContextList = seriesJobDataContextList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesJobContext [context=" + context
|
||||
+ ", seriesJobDataContextList=" + seriesJobDataContextList
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.job;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesJobDataContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6043106605633429465L;
|
||||
private String context;
|
||||
private ArrayList<SeriesJobData> series;
|
||||
|
||||
public SeriesJobDataContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesJobDataContext(String context, ArrayList<SeriesJobData> series) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesJobData> getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(ArrayList<SeriesJobData> series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesJobDataContext [context=" + context + ", series="
|
||||
+ series + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesPortletContext extends SeriesPortletDefinition {
|
||||
|
||||
private static final long serialVersionUID = -2350334263342186590L;
|
||||
private Context context;
|
||||
private ArrayList<SeriesPortletDataContext> seriesPortletDataContextList;
|
||||
|
||||
public SeriesPortletContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
}
|
||||
|
||||
public SeriesPortletContext(Context context,
|
||||
ArrayList<SeriesPortletDataContext> seriesPortletDataContextList) {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
this.context = context;
|
||||
this.seriesPortletDataContextList = seriesPortletDataContextList;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesPortletDataContext> getSeriesPortletDataContextList() {
|
||||
return seriesPortletDataContextList;
|
||||
}
|
||||
|
||||
public void setSeriesPortletDataContextList(
|
||||
ArrayList<SeriesPortletDataContext> seriesPortletDataContextList) {
|
||||
this.seriesPortletDataContextList = seriesPortletDataContextList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesPortletContext [context=" + context
|
||||
+ ", seriesPortletDataContextList="
|
||||
+ seriesPortletDataContextList + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesPortletDataContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6043106605633429465L;
|
||||
private String context;
|
||||
private ArrayList<SeriesPortletData> series;
|
||||
|
||||
public SeriesPortletDataContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesPortletDataContext(String context,
|
||||
ArrayList<SeriesPortletData> series) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesPortletData> getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(ArrayList<SeriesPortletData> series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesPortletDataContext [context=" + context + ", series="
|
||||
+ series + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesServiceContext extends SeriesServiceDefinition {
|
||||
|
||||
private static final long serialVersionUID = -2350334263342186590L;
|
||||
private Context context;
|
||||
private ArrayList<SeriesServiceDataContext> seriesServiceDataContextList;
|
||||
|
||||
public SeriesServiceContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
|
||||
}
|
||||
|
||||
public SeriesServiceContext(Context context,
|
||||
ArrayList<SeriesServiceDataContext> seriesServiceDataContextList) {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
this.context = context;
|
||||
this.seriesServiceDataContextList = seriesServiceDataContextList;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesServiceDataContext> getSeriesServiceDataContextList() {
|
||||
return seriesServiceDataContextList;
|
||||
}
|
||||
|
||||
public void setSeriesServiceDataContextList(
|
||||
ArrayList<SeriesServiceDataContext> seriesServiceDataContextList) {
|
||||
this.seriesServiceDataContextList = seriesServiceDataContextList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesServiceContext [context=" + context
|
||||
+ ", seriesServiceDataContextList="
|
||||
+ seriesServiceDataContextList + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesServiceDataContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6043106605633429465L;
|
||||
private String context;
|
||||
private ArrayList<SeriesServiceData> series;
|
||||
|
||||
public SeriesServiceDataContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesServiceDataContext(String context,
|
||||
ArrayList<SeriesServiceData> series) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesServiceData> getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(ArrayList<SeriesServiceData> series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesServiceDataContext [context=" + context + ", series="
|
||||
+ series + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.storage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesStorageContext extends SeriesStorageDefinition {
|
||||
|
||||
private static final long serialVersionUID = -5477545972037227361L;
|
||||
private Context context;
|
||||
private ArrayList<SeriesStorageDataContext> seriesStorageDataContextList;
|
||||
|
||||
public SeriesStorageContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
|
||||
}
|
||||
|
||||
public SeriesStorageContext(Context context,
|
||||
ArrayList<SeriesStorageDataContext> seriesStorageDataContextList) {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
this.context=context;
|
||||
this.seriesStorageDataContextList = seriesStorageDataContextList;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesStorageDataContext> getSeriesStorageDataContextList() {
|
||||
return seriesStorageDataContextList;
|
||||
}
|
||||
|
||||
public void setSeriesStorageDataContextList(
|
||||
ArrayList<SeriesStorageDataContext> seriesStorageDataContextList) {
|
||||
this.seriesStorageDataContextList = seriesStorageDataContextList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesStorageContext [context=" + context
|
||||
+ ", seriesStorageDataContextList="
|
||||
+ seriesStorageDataContextList + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.storage;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesStorageDataContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -627227653308818605L;
|
||||
private String context;
|
||||
private ArrayList<SeriesStorageData> series;
|
||||
|
||||
public SeriesStorageDataContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesStorageDataContext(String context,
|
||||
ArrayList<SeriesStorageData> series) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesStorageData> getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(ArrayList<SeriesStorageData> series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesStorageDataContext [context=" + context + ", series="
|
||||
+ series + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.task;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesTaskContext extends SeriesTaskDefinition {
|
||||
|
||||
private static final long serialVersionUID = 6805210072384752359L;
|
||||
private Context context;
|
||||
private ArrayList<SeriesTaskDataContext> seriesTaskDataContextList;
|
||||
|
||||
public SeriesTaskContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
|
||||
}
|
||||
|
||||
public SeriesTaskContext(Context context,
|
||||
ArrayList<SeriesTaskDataContext> seriesTaskDataTopList) {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
this.context = context;
|
||||
this.seriesTaskDataContextList = seriesTaskDataTopList;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesTaskDataContext> getSeriesTaskDataContextList() {
|
||||
return seriesTaskDataContextList;
|
||||
}
|
||||
|
||||
public void setSeriesTaskDataContextList(
|
||||
ArrayList<SeriesTaskDataContext> seriesTaskDataContextList) {
|
||||
this.seriesTaskDataContextList = seriesTaskDataContextList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesTaskContext [context=" + context
|
||||
+ ", seriesTaskDataContextList=" + seriesTaskDataContextList
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.task;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SeriesTaskDataContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6799983693606904130L;
|
||||
private String context;
|
||||
private ArrayList<SeriesTaskData> series;
|
||||
|
||||
public SeriesTaskDataContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesTaskDataContext(String context,
|
||||
ArrayList<SeriesTaskData> series) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesTaskData> getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(ArrayList<SeriesTaskData> series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesTaskDataContext [context=" + context + ", series="
|
||||
+ series + "]";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue