Updated Rules

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@114235 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-04-17 16:52:25 +00:00
parent d500602289
commit 1137642a65
14 changed files with 539 additions and 85 deletions

View File

@ -2,120 +2,122 @@ package org.gcube.portlets.user.td.gwtservice.server;
/**
*
* @author "Giancarlo Panichi"
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class SessionConstants {
public static final String SCOPE_TO_CURRENT_TRID_MAP = "SCOPE_TO_CURRENT_TRID_MAP";
public static final String SCOPE_TO_CURRENT_TABULAR_RESOURCE_MAP = "SCOPE_TO_CURRENT_TABULAR_RESOURCE_MAP";
public static final String SCOPE_TO_CURRENT_TABULAR_RESOURCES_OPEN_MAP = "SCOPE_TO_CURRENT_TABULAR_RESOURCES_OPEN_MAP";
public static final String SCOPE_TO_OPERATIONS_TASKS_STARTED_MAP="SCOPE_TO_OPERATIONS_TASKS_STARTED_MAP";
public static final String SCOPE_TO_OPERATIONS_TASKS_IN_BACKGROUND_MAP="SCOPE_TO_OPERATIONS_TASKS_IN_BACKGROUND_MAP";
public static final String SCOPE_TO_OPERATIONS_TASKS_ABORTED_MAP="SCOPE_TO_OPERATIONS_TASKS_ABORTED_MAP";
public static final String SCOPE_TO_OPERATIONS_TASKS_HIDDEN_MAP="SCOPE_TO_OPERATIONS_TASKS_HIDDEN_MAP";
public static final String SCOPE_TO_OPERATIONS_TASKS_STARTED_MAP = "SCOPE_TO_OPERATIONS_TASKS_STARTED_MAP";
public static final String SCOPE_TO_OPERATIONS_TASKS_IN_BACKGROUND_MAP = "SCOPE_TO_OPERATIONS_TASKS_IN_BACKGROUND_MAP";
public static final String SCOPE_TO_OPERATIONS_TASKS_ABORTED_MAP = "SCOPE_TO_OPERATIONS_TASKS_ABORTED_MAP";
public static final String SCOPE_TO_OPERATIONS_TASKS_HIDDEN_MAP = "SCOPE_TO_OPERATIONS_TASKS_HIDDEN_MAP";
public static final String SCOPE_TO_TABULAR_RESOURCE_LIST_MAP = "SCOPE_TO_TABULAR_RESOURCE_LIST_MAP";
public static final String TDOPEN_SESSION = "TDOPEN_SESSION";
public static final String FILE_UPLOAD_MONITOR = "FILE_UPLOAD_MONITOR";
public static final String TR_TASK_MANAGER = "TR_TASK_MANAGER";
public static final String SDMX_REGISTRY_SOURCE = "SDMX_REGISTRY_SOURCE";
public static final String SDMX_CLIENT_ATTRIBUTE = "SDMX_CLIENT";
public static final String SDMX_IMPORT_SESSION = "SDMX_IMPORT";
public static final String SDMX_IMPORT_TABULAR_RESOURCE = "SDMX_IMPORT_TABULAR_RESOURCE";
public static final String SDMX_EXPORT_SESSION = "SDMX_EXPORT_SESSION";
public static final String CSV_IMPORT_SESSION = "CSV_IMPORT";
public static final String CSV_IMPORT_FILE_UPLOAD_SESSION = "CSV_IMPORT_FILE_UPLOAD";
public static final String CSV_IMPORT_TABULAR_RESOURCE = "CSV_IMPORT_TABULAR_RESOURCE";
public static final String CSV_IMPORT_TABULAR_RESOURCE = "CSV_IMPORT_TABULAR_RESOURCE";
public static final String CSV_EXPORT_SESSION = "CSV_EXPORT_SESSION";
public static final String CSV_EXPORT_END = "CSV_EXPORT_END";
public static final String JSON_EXPORT_SESSION = "JSON_EXPORT_SESSION";
public static final String JSON_EXPORT_END = "JSON_EXPORT_END";
public static final String CLONE_TABULAR_RESOURCE_SESSION = "CLONE_TABULAR_RESOURCE_SESSION";
public static final String CHANGE_COLUMN_TYPE_SESSION = "CHANGE_COLUMN_TYPE_SESSION";
public static final String ADD_COLUMN_SESSION = "ADD_COLUMN_SESSION";
public static final String DELETE_COLUMN_SESSION = "DELETE_COLUMN_SESSION";
public static final String FILTER_COLUMN_SESSION = "FILTER_COLUMN_SESSION";
public static final String REPLACE_COLUMN_BY_EXPRESSION_SESSION = "REPLACE_COLUMN_BY_EXPRESSION_SESSION";
public static final String EDIT_ROW_SESSION = "EDIT_ROW_SESSION";
public static final String TASK_RESUBMIT_SESSION = "TASK_RESUBMIT_SESSION";
public static final String TASK_RESUME_SESSION = "TASK_RESUME_SESSION";
public static final String REPLACE_COLUMN_SESSION = "REPLACE_COLUMN_SESSION";
public static final String GROUPBY_SESSION = "GROUPBY_SESSION";
public static final String TIME_AGGREGATION_SESSION = "TIME_AGGREGATION_SESSION";
public static final String UNION_SESSION = "UNION_SESSION";
public static final String CHANGE_COLUMNS_POSITION_SESSION = "CHANGE_COLUMNS_POSITION_SESSION";
public static final String REPLACE_BY_EXTERNAL_SESSION = "REPLACE_BY_EXTERNAL_SESSION";
public static final String STATISTICAL_OPERATION_SESSION = "STATISTICAL_OPERATION_SESSION";
public static final String NORMALIZATION_SESSION = "NORMALIZATION_SESSION";
public static final String DENORMALIZATION_SESSION = "DENORMALIZATION_SESSION";
public static final String REPLACE_BATCH_COLUMN_SESSION = "REPLACE_BATCH_COLUMN_SESSION";
public static final String CHANGE_THE_COLUMN_LABEL_SESSION = "CHANGE_THE_COLUMN_LABEL_SESSION";
public static final String CHANGE_TABLE_TYPE_SESSION = "CHANGE_TABLE_TYPE_SESSION";
public static final String DELETE_ROWS_SESSION = "DELETE_ROWS_SESSION";
public static final String DUPLICATES_ROWS_SESSION = "DUPLICATES_ROWS_SESSION";
public static final String MAP_CREATION_SESSION = "MAP_CREATION_SESSION";
public static final String TEMPLATE_APPLY_SESSION = "TEMPLATE_APPLY_SESSION";
public static final String CODELISTS_PAGING_LOADED = "CODELISTS_PAGING_LOADED";
public static final String CODELISTS_PAGING_LOADED_FILTERED_COPY = "CODELISTS_PAGING_LOADED_FILTERED_COPY";
public static final String CODELISTS_PAGING_LOADED_FILTER = "CODELISTS_PAGING_LOADED_FILTER";
public static final String ROLLBACK_SESSION = "ROLLBACK_SESSION";
public static final String EXTRACT_CODELIST_SESSION = "EXTRACT_CODELIST_SESSION";
public static final String SPLIT_COLUMN_SESSION = "SPLIT_COLUMN_SESSION";
public static final String MERGE_COLUMN_SESSION = "MERGE_COLUMN_SESSION";
public static final String CODELIST_MAPPING_SESSION = "CODELIST_MAPPING_SESSION";
public static final String CODELIST_MAPPING_FILE_UPLOAD_SESSION = "CODELIST_MAPPING_FILE_UPLOAD_SESSION";
public static final String CHART_TOPRATING_SESSION = "CHART_TOPRATING_SESSION";
public static final String RESOURCE_SAVE_SESSION = "RESOURCE_SAVE_SESSION";
public static final String GEOSPATIAL_CREATE_COORDINATES_SESSION = "GEOSPATIAL_CREATE_COORDINATES_SESSION";
public static final String GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION = "GEOSPATIAL_DOWNSCALE_CSQUARE_SESSION";
public static final String GEOMETRY_CREATE_POINT_SESSION = "GEOMETRY_CREATE_POINT_SESSION";
public static final String RULES_ON_COLUMN_APPLY_SESSION = "RULES_ON_COLUMN_APPLY_SESSION";
}

View File

@ -17,6 +17,7 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession;
import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.chart.ChartTopRatingSession;
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
@ -30,6 +31,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialDownsca
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RulesOnColumnApplySession;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
@ -87,10 +89,9 @@ public class SessionUtil {
ASLSession session;
if (username == null) {
logger.warn("no user found in session, using test one");
throw new TDGWTSessionExpiredException("Session Expired!");
/*throw new TDGWTSessionExpiredException("Session Expired!");*/
// Remove comment for Test
/*
username = Constants.DEFAULT_USER;
String scope = Constants.DEFAULT_SCOPE;
@ -98,7 +99,7 @@ public class SessionUtil {
session = SessionManager.getInstance().getASLSession(
httpSession.getId(), username);
session.setScope(scope);
*/
} else {
session = SessionManager.getInstance().getASLSession(
httpSession.getId(), username);
@ -1089,6 +1090,38 @@ public class SessionUtil {
replaceColumnByExpressionSession);
}
//
public static RulesOnColumnApplySession getRulesOnColumnApplySession(
HttpSession httpSession) {
RulesOnColumnApplySession rulesOnColumnApplySession = (RulesOnColumnApplySession) httpSession
.getAttribute(SessionConstants.RULES_ON_COLUMN_APPLY_SESSION);
if (rulesOnColumnApplySession != null) {
return rulesOnColumnApplySession;
} else {
rulesOnColumnApplySession = new RulesOnColumnApplySession();
httpSession.setAttribute(
SessionConstants.RULES_ON_COLUMN_APPLY_SESSION,
rulesOnColumnApplySession);
return rulesOnColumnApplySession;
}
}
public static void setRulesOnColumnApplySession(
HttpSession httpSession,
RulesOnColumnApplySession rulesOnColumnApplySession) {
RulesOnColumnApplySession rules = (RulesOnColumnApplySession) httpSession
.getAttribute(SessionConstants.RULES_ON_COLUMN_APPLY_SESSION);
if (rules != null) {
httpSession
.removeAttribute(SessionConstants.RULES_ON_COLUMN_APPLY_SESSION);
}
httpSession.setAttribute(
SessionConstants.RULES_ON_COLUMN_APPLY_SESSION,
rulesOnColumnApplySession);
}
//
public static TaskResubmitSession getTaskResubmitSession(

View File

@ -42,6 +42,7 @@ import org.gcube.common.resources.gcore.utils.Group;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken;
import org.gcube.data.analysis.tabulardata.commons.utils.Licence;
import org.gcube.data.analysis.tabulardata.commons.webservice.exception.NoSuchTemplateException;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.TabularResourceType;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.TemplateDescription;
@ -90,12 +91,12 @@ import org.gcube.data.analysis.tabulardata.model.table.TableId;
import org.gcube.data.analysis.tabulardata.model.table.type.CodelistTableType;
import org.gcube.data.analysis.tabulardata.model.time.PeriodType;
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTemplateException;
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
import org.gcube.data.analysis.tabulardata.service.operation.Job;
import org.gcube.data.analysis.tabulardata.service.operation.Task;
import org.gcube.data.analysis.tabulardata.service.operation.TaskId;
import org.gcube.data.analysis.tabulardata.service.operation.TaskResult;
import org.gcube.data.analysis.tabulardata.service.rules.RuleId;
import org.gcube.data.analysis.tabulardata.service.tabular.HistoryStep;
import org.gcube.data.analysis.tabulardata.service.tabular.HistoryStepId;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource;
@ -192,6 +193,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.monitor.BackgroundOperationM
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorCreator;
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.RulesOnColumnApplySession;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
@ -4872,7 +4875,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
* @param trId
* @throws TDGWTServiceException
*/
private void checkTRId(TRId trId) throws TDGWTServiceException {
protected void checkTRId(TRId trId) throws TDGWTServiceException {
if (trId == null) {
logger.error("TRId is null");
new TDGWTServiceException(NO_VALID_TABULAR_RESOURCE_ID_PRESENT);
@ -4890,7 +4893,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
* @param trId
* @throws TDGWTServiceException
*/
private void checkTabularResourceLocked(TabularResource tabularResource)
protected void checkTabularResourceLocked(TabularResource tabularResource)
throws TDGWTServiceException {
try {
@ -4915,7 +4918,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
* @param trId
* @throws TDGWTServiceException
*/
private void checkTabularResourceIsFinal(TabularResource tabularResource)
protected void checkTabularResourceIsFinal(TabularResource tabularResource)
throws TDGWTServiceException {
try {
if (tabularResource.isFinalized()) {
@ -4939,7 +4942,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
* @param trId
* @throws TDGWTServiceException
*/
private void checkTabularResourceIsFlow(TabularResource tabularResource)
protected void checkTabularResourceIsFlow(TabularResource tabularResource)
throws TDGWTServiceException {
try {
@ -9382,5 +9385,82 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
*
* @param rulesOnColumnApplySession
* @param session
* @return
* @throws TDGWTServiceException
*/
public String startRulesOnColumnApply(
RulesOnColumnApplySession rulesOnColumnApplySession,
HttpSession session) throws TDGWTServiceException {
try {
// HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getAslSession(session);
SessionUtil.setRulesOnColumnApplySession(session, rulesOnColumnApplySession);
if (rulesOnColumnApplySession == null) {
logger.error("RulesOnColumnApplySession is null");
throw new TDGWTServiceException(
"Error in apply rules on column: RulesOnColumnApplySession is null");
}
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService();
checkTRId(rulesOnColumnApplySession.getTrId());
TabularResourceId tabularResourceId = new TabularResourceId(
Long.valueOf(rulesOnColumnApplySession
.getTrId().getId()));
TabularResource tabularResource = service
.getTabularResource(tabularResourceId);
checkTabularResourceIsFlow(tabularResource);
checkTabularResourceLocked(tabularResource);
checkTabularResourceIsFinal(tabularResource);
ColumnData column=rulesOnColumnApplySession.getColumn();
if(column==null){
logger.error("Error in apply rules on column: No column selected.");
throw new TDGWTServiceException(
"Error in apply rules on column: No column selected.");
}
ArrayList<RuleDescriptionData> rules=rulesOnColumnApplySession.getRules();
ArrayList<RuleId> ruleIds=new ArrayList<RuleId>();
for(RuleDescriptionData r:rules){
RuleId ruleId=new RuleId(r.getId());
ruleIds.add(ruleId);
}
Task trTask = service.applyColumnRule(tabularResourceId, column.getColumnId(),ruleIds );
logger.debug("Rules On Column Apply: TaskId "
+ trTask.getId());
TaskWrapper taskWrapper = new TaskWrapper(trTask,
UIOperationsId.RuleOnColumnApply,
rulesOnColumnApplySession.getTrId());
SessionUtil.setStartedTask(session, taskWrapper);
return trTask.getId().getValue();
} catch (TDGWTServiceException e) {
throw e;
} catch (SecurityException e) {
e.printStackTrace();
throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS);
} catch (Throwable e) {
e.printStackTrace();
throw new TDGWTServiceException(
"Error in apply rules on column: "
+ e.getLocalizedMessage());
}
}
}

View File

@ -6,9 +6,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.workspace.Workspace;
@ -16,8 +14,7 @@ import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.common.homelibrary.util.WorkspaceUtil;
import org.gcube.contentmanagement.blobstorage.service.IClient;
import org.gcube.contentmanager.storageclient.model.protocol.smp.Handler;
import org.gcube.contentmanager.storageclient.model.protocol.smp.SMPURLConnection;
import org.gcube.contentmanager.storageclient.model.protocol.smp.SMPUrl;
import org.gcube.contentmanager.storageclient.wrapper.AccessType;
import org.gcube.contentmanager.storageclient.wrapper.MemoryType;
import org.gcube.contentmanager.storageclient.wrapper.StorageClient;
@ -31,6 +28,7 @@ import org.slf4j.LoggerFactory;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class FilesStorage {
public static final Logger logger = LoggerFactory
@ -90,9 +88,11 @@ public class FilesStorage {
try {
org.gcube.common.homelibrary.home.workspace.folder.items.File gcubeItem = ((org.gcube.common.homelibrary.home.workspace.folder.items.File) wi);
SMPUrl smsHome= new SMPUrl(gcubeItem.getPublicLink());
/*
Handler.activateProtocol();
URL smsHome = null;
smsHome = new URL(gcubeItem.getPublicLink());
smsHome = new URL(gcubeItem.getPublicLink());*/
logger.debug("smsHome: [host:" + smsHome.getHost() + " path:"
+ smsHome.getPath() + " ref:" + smsHome.getRef()
+ " userinfo:" + smsHome.getUserInfo() + " ]");
@ -145,6 +145,9 @@ public class FilesStorage {
try {
org.gcube.common.homelibrary.home.workspace.folder.items.File gcubeItem = ((org.gcube.common.homelibrary.home.workspace.folder.items.File) wi);
SMPUrl smsHome= new SMPUrl(gcubeItem.getPublicLink());
/*
Handler.activateProtocol();
URL smsHome = null;
smsHome = new URL(null, gcubeItem.getPublicLink(),
@ -157,8 +160,7 @@ public class FilesStorage {
}
});
// new URL(gcubeItem.getPublicLink());
*/
logger.debug("smsHome: [host:" + smsHome.getHost() + " path:"
+ smsHome.getPath() + " ref:" + smsHome.getRef()
+ " userinfo:" + smsHome.getUserInfo() + " ]");
@ -191,7 +193,9 @@ public class FilesStorage {
throws TDGWTServiceException {
InputStream is = null;
try {
SMPUrl smsHome= new SMPUrl(uri);
/*
Handler.activateProtocol();
URL smsHome = null;
smsHome = new URL(null, uri, new URLStreamHandler() {
@ -202,7 +206,7 @@ public class FilesStorage {
return new SMPURLConnection(u);
}
});
});*/
logger.debug("smsHome: [host:" + smsHome.getHost() + " path:"
+ smsHome.getPath() + " ref:" + smsHome.getRef()
@ -238,8 +242,10 @@ public class FilesStorage {
InputStream is = null;
try {
Handler.activateProtocol();
URL smsHome = null;
SMPUrl smsHome= new SMPUrl(uri);
/*
URL smsHome = new SMPUrl();
smsHome = new URL(null, uri, new URLStreamHandler() {
@Override
@ -248,11 +254,12 @@ public class FilesStorage {
return new SMPURLConnection(u);
}
});
});*/
logger.debug("smsHome: [host:" + smsHome.getHost() + " path:"
+ smsHome.getPath() + " ref:" + smsHome.getRef()
+ " userinfo:" + smsHome.getUserInfo() + " ]");
URLConnection uc = null;
uc = (URLConnection) smsHome.openConnection();
is = uc.getInputStream();

View File

@ -1,8 +1,8 @@
package org.gcube.portlets.user.td.gwtservice.server.trservice;
import org.gcube.data.analysis.tabulardata.commons.webservice.exception.NoSuchOperationException;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationDefinition;
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchOperationException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.gcube.data.analysis.tabulardata.commons.webservice.exception.NoSuchTableException;
import org.gcube.data.analysis.tabulardata.expression.Expression;
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.Equals;
import org.gcube.data.analysis.tabulardata.model.column.Column;
@ -22,7 +23,6 @@ import org.gcube.data.analysis.tabulardata.query.parameters.select.QueryColumn;
import org.gcube.data.analysis.tabulardata.query.parameters.select.QueryColumn.Function;
import org.gcube.data.analysis.tabulardata.query.parameters.select.QuerySelect;
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTableException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ConditionCode;
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurrences;

View File

@ -0,0 +1,131 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule;
import java.io.Serializable;
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleColumnType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class RuleDescriptionData implements Serializable {
private static final long serialVersionUID = 2238695825091799598L;
private long id;
private String name;
private String description;
private String owner;
private RuleScopeType scope;
private TDRuleColumnType tdRuleColumnType;
private C_Expression expression;
public RuleDescriptionData() {
super();
}
public RuleDescriptionData(long id, String name, String description, String owner,
RuleScopeType scope,
C_Expression expression) {
super();
this.id = id;
this.name = name;
this.description = description;
this.owner=owner;
this.scope = scope;
this.tdRuleColumnType = null;
this.expression = expression;
}
public RuleDescriptionData(long id, String name, String description,String owner,
RuleScopeType scope, TDRuleColumnType tdRuleColumnType,
C_Expression expression) {
super();
this.id = id;
this.name = name;
this.description = description;
this.owner=owner;
this.scope = scope;
this.tdRuleColumnType = tdRuleColumnType;
this.expression = expression;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public RuleScopeType getScope() {
return scope;
}
public void setScope(RuleScopeType scope) {
this.scope = scope;
}
public TDRuleColumnType getTdRuleColumnType() {
return tdRuleColumnType;
}
public void setTdRuleColumnType(TDRuleColumnType tdRuleColumnType) {
this.tdRuleColumnType = tdRuleColumnType;
}
public C_Expression getExpression() {
return expression;
}
public void setExpression(C_Expression expression) {
this.expression = expression;
}
public String getReadableExpression() {
if (expression != null) {
return expression.getReadableExpression();
} else {
return "";
}
}
@Override
public String toString() {
return "RuleDescriptionData [id=" + id + ", name=" + name
+ ", description=" + description + ", owner=" + owner
+ ", scope=" + scope + ", tdRuleColumnType=" + tdRuleColumnType
+ ", expression=" + expression + "]";
}
}

View File

@ -0,0 +1,37 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public enum RuleScopeType {
TABLE("Table"), COLUMN("Column");
/**
* @param text
*/
private RuleScopeType(final String id) {
this.id = id;
}
private final String id;
@Override
public String toString() {
return id;
}
public static RuleScopeType get(String ruleScopeType) {
for(RuleScopeType ws:values()){
if(ws.id.compareTo(ruleScopeType)==0){
return ws;
}
}
return null;
}
}

View File

@ -0,0 +1,67 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule;
import java.io.Serializable;
import java.util.ArrayList;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class RulesOnColumnApplySession implements Serializable {
private static final long serialVersionUID = -7746819321348425711L;
private TRId trId;
private ColumnData column;
private ArrayList<RuleDescriptionData> rules;
public RulesOnColumnApplySession() {
super();
}
public RulesOnColumnApplySession(TRId trId, ColumnData column,
ArrayList<RuleDescriptionData> rules) {
super();
this.trId = trId;
this.column = column;
this.rules = rules;
}
public TRId getTrId() {
return trId;
}
public void setTrId(TRId trId) {
this.trId = trId;
}
public ColumnData getColumn() {
return column;
}
public void setColumn(ColumnData column) {
this.column = column;
}
public ArrayList<RuleDescriptionData> getRules() {
return rules;
}
public void setRules(ArrayList<RuleDescriptionData> rules) {
this.rules = rules;
}
@Override
public String toString() {
return "RulesOnColumnApplySession [trId=" + trId + ", column=" + column
+ ", rules=" + rules + "]";
}
}

View File

@ -0,0 +1,41 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule.type;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TDBaseColumnRuleType extends TDRuleColumnType {
private static final long serialVersionUID = -2967788094664606371L;
private ColumnDataType columnDataType;
public TDBaseColumnRuleType(){
super();
}
public TDBaseColumnRuleType(ColumnDataType columnDataType) {
super();
this.columnDataType = columnDataType;
}
public ColumnDataType getColumnDataType() {
return columnDataType;
}
public void setColumnDataType(ColumnDataType columnDataType) {
this.columnDataType = columnDataType;
}
@Override
public String toString() {
return "TDBaseColumnRuleType [columnDataType=" + columnDataType + "]";
}
}

View File

@ -0,0 +1,41 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule.type;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.DimensionReferenceData;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TDDimensionColumnRuleType extends TDRuleColumnType {
private static final long serialVersionUID = -2967788094664606371L;
private DimensionReferenceData dimensionReferenceData;
public TDDimensionColumnRuleType() {
super();
}
public TDDimensionColumnRuleType(
DimensionReferenceData dimensionReferenceData) {
super();
this.dimensionReferenceData = dimensionReferenceData;
}
public DimensionReferenceData getDimensionReferenceData() {
return dimensionReferenceData;
}
public void setDimensionReferenceData(
DimensionReferenceData dimensionReferenceData) {
this.dimensionReferenceData = dimensionReferenceData;
}
@Override
public String toString() {
return "TDDimensionColumnRuleType [dimensionReferenceData="
+ dimensionReferenceData + "]";
}
}

View File

@ -0,0 +1,25 @@
package org.gcube.portlets.user.td.gwtservice.shared.rule.type;
import java.io.Serializable;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TDRuleColumnType implements Serializable {
/**
*
*/
private static final long serialVersionUID = 8230123565752504602L;
public TDRuleColumnType(){
}
}

View File

@ -3,13 +3,12 @@ package org.gcube.portlets.user.td.gwtservice.client;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken;
import org.gcube.data.analysis.tabulardata.commons.webservice.exception.NoSuchTableException;
import org.gcube.data.analysis.tabulardata.commons.webservice.exception.NoSuchTabularResourceException;
import org.gcube.data.analysis.tabulardata.model.column.Column;
import org.gcube.data.analysis.tabulardata.model.column.ColumnLocalId;
import org.gcube.data.analysis.tabulardata.model.table.Table;
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.exception.InvalidTabularResourceException;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTableException;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTabularResourceException;
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
@ -44,10 +43,6 @@ public class TestServiceColumn {
System.out.println("No such tabular resource with id: " + trId);
e.printStackTrace();
return;
} catch (InvalidTabularResourceException e) {
System.out.println("Invalid tabular resource with id: " + trId);
e.printStackTrace();
return;
} catch (NoSuchTableException e) {
System.out.println("No such last table for: " + trId);
e.printStackTrace();

View File

@ -3,12 +3,11 @@ package org.gcube.portlets.user.td.gwtservice.client;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken;
import org.gcube.data.analysis.tabulardata.commons.webservice.exception.NoSuchTableException;
import org.gcube.data.analysis.tabulardata.commons.webservice.exception.NoSuchTabularResourceException;
import org.gcube.data.analysis.tabulardata.model.table.Table;
import org.gcube.data.analysis.tabulardata.model.table.TableId;
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.exception.InvalidTabularResourceException;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTableException;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTabularResourceException;
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
@ -44,10 +43,6 @@ public class TestServiceTable {
System.out.println("No such tabular resource with id: " + trId);
e.printStackTrace();
return;
} catch (InvalidTabularResourceException e) {
System.out.println("Invalid tabular resource with id: " + trId);
e.printStackTrace();
return;
} catch (NoSuchTableException e) {
System.out.println("No such last table for: " + trId);
e.printStackTrace();