Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@97666 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
77c42ad7e3
commit
2b87495ef6
|
@ -19,7 +19,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.lang.SecurityException;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
|
@ -37,17 +36,14 @@ import org.gcube.common.resources.gcore.ServiceEndpoint.Profile;
|
|||
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.webservice.types.TaskStatus;
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.TemplateDescription;
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationDefinition;
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution;
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.tasks.ValidationDescriptor;
|
||||
import org.gcube.data.analysis.tabulardata.expression.Expression;
|
||||
import org.gcube.data.analysis.tabulardata.metadata.NoSuchMetadataException;
|
||||
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.column.ColumnReference;
|
||||
import org.gcube.data.analysis.tabulardata.model.column.ColumnType;
|
||||
import org.gcube.data.analysis.tabulardata.model.column.type.AnnotationColumnType;
|
||||
import org.gcube.data.analysis.tabulardata.model.column.type.CodeColumnType;
|
||||
|
@ -62,7 +58,6 @@ import org.gcube.data.analysis.tabulardata.model.metadata.column.DataLocaleMetad
|
|||
import org.gcube.data.analysis.tabulardata.model.metadata.column.ValidationReferencesMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.column.ViewColumnMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.DescriptionsMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.ImmutableLocalizedText;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.LocalizedText;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.NamesMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.TableDescriptorMetadata;
|
||||
|
@ -108,18 +103,19 @@ import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Code
|
|||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4DeleteColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4DeleteRows;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Duplicates;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4EditRow;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ExtractCodelist;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4LabelColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4MergeColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ReplaceBatch;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4ReplaceColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4SplitColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecutionDirector;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnTypeCodeMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExpressionGenerator;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExtractCodelistOperationMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExtractReferences;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.QueryService;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TDTypeValueMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ValueMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.OperationsId;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingMonitor;
|
||||
|
@ -165,7 +161,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateDeleteSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnViewData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.RefColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
||||
|
@ -173,7 +168,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurrences;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.OccurrencesForReplaceBatchColumnSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceEntry;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.clone.CloneTabularResourceSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession;
|
||||
|
@ -221,8 +215,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Codelist;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Dataset;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.RelationshipData;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
|
@ -3871,755 +3863,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve OperationExecution for change column type
|
||||
*
|
||||
* @param changeColumnTypeSession
|
||||
* @return
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service,
|
||||
ChangeColumnTypeSession changeColumnTypeSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(changeColumnTypeSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
ColumnTypeCode type = changeColumnTypeSession.getColumnTypeCodeTarget();
|
||||
|
||||
switch (type) {
|
||||
case ANNOTATION:
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ChangeToAnnotationColumn.toString(), service);
|
||||
invocation = new OperationExecution(changeColumnTypeSession
|
||||
.getColumnData().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case ATTRIBUTE:
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ChangeToAttributeColumn.toString(), service);
|
||||
|
||||
map.put(Constants.PARAMETER_TARGET_DATA_TYPE, ColumnDataTypeMap
|
||||
.map(changeColumnTypeSession.getColumnDataTypeTarget()));
|
||||
invocation = new OperationExecution(changeColumnTypeSession
|
||||
.getColumnData().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case CODE:
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ChangeToCodeColumn.toString(), service);
|
||||
invocation = new OperationExecution(changeColumnTypeSession
|
||||
.getColumnData().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case CODEDESCRIPTION:
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ChangeToCodeDescription.toString(), service);
|
||||
invocation = new OperationExecution(changeColumnTypeSession
|
||||
.getColumnData().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case CODENAME:
|
||||
DataLocaleMetadata locale = new DataLocaleMetadata(
|
||||
changeColumnTypeSession.getLocale());
|
||||
map.put(Constants.PARAMETER_ADDITIONAL_META, locale);
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ChangeToCodeName.toString(), service);
|
||||
invocation = new OperationExecution(changeColumnTypeSession
|
||||
.getColumnData().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case DIMENSION:
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ChangeToDimensionColumn.toString(), service);
|
||||
ColumnData col = changeColumnTypeSession
|
||||
.getCodelistColumnReference();
|
||||
logger.debug("ReferenceColumn To Set: " + col);
|
||||
ColumnLocalId cId = new ColumnLocalId(col.getColumnId());
|
||||
TRId trId = col.getTrId();
|
||||
logger.debug("trID: " + trId);
|
||||
long tabId = new Long(trId.getTableId());
|
||||
TableId tId = new TableId(tabId);
|
||||
ColumnReference columnReference = new ColumnReference(tId, cId);
|
||||
map.put(Constants.PARAMETER_REFERENCE_COLUMN, columnReference);
|
||||
|
||||
invocation = new OperationExecution(changeColumnTypeSession
|
||||
.getColumnData().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case MEASURE:
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ChangeToMeasureColumn.toString(), service);
|
||||
|
||||
map.put(Constants.PARAMETER_TARGET_DATA_TYPE, ColumnDataTypeMap
|
||||
.map(changeColumnTypeSession.getColumnDataTypeTarget()));
|
||||
invocation = new OperationExecution(changeColumnTypeSession
|
||||
.getColumnData().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case TIMEDIMENSION:
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ChangeToTimeDimensionColumn.toString(),
|
||||
service);
|
||||
|
||||
map.put(Constants.PARAMETER_PERIOD_FORMAT, changeColumnTypeSession
|
||||
.getTimeDimensionType().toString());
|
||||
invocation = new OperationExecution(changeColumnTypeSession
|
||||
.getColumnData().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve OperationExecution for change column type
|
||||
*
|
||||
* @param replaceColumnSession
|
||||
* @return
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service,
|
||||
ReplaceColumnSession replaceColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(replaceColumnSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
if (replaceColumnSession.isReplaceDimension()) {
|
||||
logger.debug("Is a Replace of view column");
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ReplaceColumnByExpression.toString(), service);
|
||||
|
||||
Expression condition = ExpressionGenerator
|
||||
.genReplaceValueParameterCondition(replaceColumnSession);
|
||||
Expression value = ExpressionGenerator
|
||||
.genReplaceValueParameterValue(replaceColumnSession);
|
||||
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION,
|
||||
condition);
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_VALUE,
|
||||
value);
|
||||
|
||||
invocation = new OperationExecution(replaceColumnSession
|
||||
.getColumnData().getColumnViewData()
|
||||
.getSourceTableDimensionColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
} else {
|
||||
logger.debug("Is a Replace of basic column");
|
||||
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ReplaceColumnByExpression.toString(), service);
|
||||
|
||||
Expression condition = ExpressionGenerator
|
||||
.genReplaceValueParameterCondition(replaceColumnSession);
|
||||
Expression value = ExpressionGenerator
|
||||
.genReplaceValueParameterValue(replaceColumnSession);
|
||||
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION,
|
||||
condition);
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_VALUE,
|
||||
value);
|
||||
|
||||
invocation = new OperationExecution(replaceColumnSession
|
||||
.getColumnData().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
}
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve OperationExecution for change column type
|
||||
*
|
||||
* @param replaceColumnSession
|
||||
* @return
|
||||
*/
|
||||
// TODO
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service,
|
||||
ExtractCodelistSession extractCodelistSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(extractCodelistSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
ExtractCodelistOperationMap extractMap = new ExtractCodelistOperationMap();
|
||||
ArrayList<Map<String, Object>> compositeValue = extractMap
|
||||
.genMap(extractCodelistSession);
|
||||
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ExtractCodelist.toString(), service);
|
||||
|
||||
map.put(Constants.PARAMETER_EXTRACT_CODELIST_COMPOSITE, compositeValue);
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve OperationExecution for change column type
|
||||
*
|
||||
* @param replaceColumnSession
|
||||
* @return
|
||||
*/
|
||||
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service, EditRowSession editRowSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(editRowSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
ValueMap valueMap = new ValueMap();
|
||||
ArrayList<Map<String, Object>> compositeValue = valueMap
|
||||
.genValueMap(editRowSession);
|
||||
|
||||
if (editRowSession.isNewRow()) {
|
||||
logger.debug("Is a add row");
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.AddRow.toString(), service);
|
||||
|
||||
map.put(Constants.PARAMETER_ADD_ROW_COMPOSITE, compositeValue);
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
} else {
|
||||
logger.debug("Is a edit row");
|
||||
|
||||
Expression exp = ExpressionGenerator.genEditRowParamaterCondition(
|
||||
service, editRowSession);
|
||||
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ModifyTuplesValuesByExpression.toString(),
|
||||
service);
|
||||
|
||||
map.put(Constants.PARAMETER_ADD_ROW_COMPOSITE, compositeValue);
|
||||
map.put(Constants.PARAMETER_EDIT_ROW_CONDITION, exp);
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
}
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve OperationExecution for replaceBatch
|
||||
*
|
||||
* @param replaceColumnSession
|
||||
* @return
|
||||
*/
|
||||
protected List<OperationExecution> retrieveOperationExecution(
|
||||
TabularDataService service,
|
||||
ReplaceBatchColumnSession replaceBatchColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
ArrayList<OperationExecution> invocations = new ArrayList<OperationExecution>();
|
||||
for (ReplaceEntry re : replaceBatchColumnSession.getReplaceEntryList()) {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(replaceBatchColumnSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
if (replaceBatchColumnSession.isReplaceDimension()) {
|
||||
logger.debug("Is a Replace of view column");
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ReplaceColumnByExpression.toString(),
|
||||
service);
|
||||
|
||||
Expression condition = ExpressionGenerator
|
||||
.genReplaceValueParameterCondition(
|
||||
replaceBatchColumnSession, re);
|
||||
Expression value = ExpressionGenerator
|
||||
.genReplaceBatchValueParameterValue(
|
||||
replaceBatchColumnSession, re);
|
||||
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION,
|
||||
condition);
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_VALUE,
|
||||
value);
|
||||
|
||||
invocation = new OperationExecution(replaceBatchColumnSession
|
||||
.getColumnData().getColumnViewData()
|
||||
.getSourceTableDimensionColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
} else {
|
||||
logger.debug("Is a Replace of basic column");
|
||||
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ReplaceColumnByExpression.toString(),
|
||||
service);
|
||||
|
||||
Expression condition = ExpressionGenerator
|
||||
.genReplaceValueParameterCondition(
|
||||
replaceBatchColumnSession, re);
|
||||
Expression value = ExpressionGenerator
|
||||
.genReplaceBatchValueParameterValue(
|
||||
replaceBatchColumnSession, re);
|
||||
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION,
|
||||
condition);
|
||||
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_VALUE,
|
||||
value);
|
||||
|
||||
invocation = new OperationExecution(replaceBatchColumnSession
|
||||
.getColumnData().getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
}
|
||||
invocations.add(invocation);
|
||||
}
|
||||
return invocations;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
* @param addColumnSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service, AddColumnSession addColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
logger.debug(addColumnSession.toString());
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
OperationDefinition operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.AddColumn.toString(), service);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
DefNewColumn defNewColumn = addColumnSession.getColumn();
|
||||
|
||||
ColumnTypeCode type = defNewColumn.getColumnType();
|
||||
|
||||
switch (type) {
|
||||
case ANNOTATION:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataTypeMap.map(ColumnDataType.Text));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
||||
TDTypeValueMap.map(ColumnDataType.Text,
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case ATTRIBUTE:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataTypeMap.map(defNewColumn.getColumnDataType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
||||
defNewColumn.getColumnDataType(),
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case CODE:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataTypeMap.map(ColumnDataType.Text));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
||||
TDTypeValueMap.map(ColumnDataType.Text,
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case CODEDESCRIPTION:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataTypeMap.map(ColumnDataType.Text));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
||||
TDTypeValueMap.map(ColumnDataType.Text,
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case CODENAME:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataTypeMap.map(ColumnDataType.Text));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE,
|
||||
TDTypeValueMap.map(ColumnDataType.Text,
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case DIMENSION:
|
||||
break;
|
||||
case MEASURE:
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE,
|
||||
ColumnTypeCodeMap.getColumnType(defNewColumn
|
||||
.getColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE,
|
||||
ColumnDataTypeMap.map(defNewColumn.getColumnDataType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(defNewColumn.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, TDTypeValueMap.map(
|
||||
defNewColumn.getColumnDataType(),
|
||||
defNewColumn.getDefaultValue()));
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
break;
|
||||
case TIMEDIMENSION:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
* @param deleteColumnSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected ArrayList<OperationExecution> retrieveOperationExecution(
|
||||
TabularDataService service, DeleteColumnSession deleteColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
logger.debug(deleteColumnSession.toString());
|
||||
|
||||
OperationDefinition operationDefinition;
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.RemoveColumn.toString(), service);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
ArrayList<OperationExecution> invocations = new ArrayList<OperationExecution>();
|
||||
for (ColumnData col : deleteColumnSession.getColumns()) {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
invocation = new OperationExecution(col.getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
invocations.add(invocation);
|
||||
}
|
||||
|
||||
return invocations;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
* @param duplicatesSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service, DuplicatesSession duplicatesSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(duplicatesSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
ArrayList<ColumnData> cols = duplicatesSession.getColumns();
|
||||
logger.debug("ReferenceColumn To Set: " + cols);
|
||||
ArrayList<ColumnReference> columnReferences = new ArrayList<ColumnReference>();
|
||||
|
||||
for (ColumnData col : cols) {
|
||||
ColumnLocalId cId = new ColumnLocalId(col.getColumnId());
|
||||
TRId trId = col.getTrId();
|
||||
logger.debug("trID: " + trId);
|
||||
long tabId = new Long(trId.getTableId());
|
||||
TableId tId = new TableId(tabId);
|
||||
ColumnReference columnReference = new ColumnReference(tId, cId);
|
||||
columnReferences.add(columnReference);
|
||||
}
|
||||
|
||||
switch (duplicatesSession.getDuplicateOp()) {
|
||||
case VALIDATE:
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.DuplicateTupleValidation.toString(), service);
|
||||
|
||||
map.put(Constants.PARAMETER_KEY, columnReferences);
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
break;
|
||||
case DELETE:
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.RemoveDuplicateTuples.toString(), service);
|
||||
|
||||
map.put(Constants.PARAMETER_KEY, columnReferences);
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
* @param labelColumnSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service, LabelColumnSession labelColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(labelColumnSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
ImmutableLocalizedText localizedText = new ImmutableLocalizedText(
|
||||
labelColumnSession.getLabel());
|
||||
|
||||
map.put(Constants.NAME_PARAMETER_ID, localizedText);
|
||||
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ColumnNameAdd.toString(), service);
|
||||
|
||||
invocation = new OperationExecution(labelColumnSession.getColumnData()
|
||||
.getColumnId(), operationDefinition.getOperationId(), map);
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
* @param changeTableTypeSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service,
|
||||
ChangeTableTypeSession changeTableTypeSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(changeTableTypeSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.ChangeTableType.toString(), service);
|
||||
map.put(Constants.PARAMETER_TABLE_TYPE, changeTableTypeSession
|
||||
.getTableType().toString());
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
* @param changeTableTypeSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service,
|
||||
CodelistMappingSession codelistMappingSession, String importUrl)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(codelistMappingSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.CodelistMappingImport.toString(), service);
|
||||
map.put(Constants.PARAMETER_URL, importUrl);
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
* @param changeTableTypeSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected ArrayList<OperationExecution> retrieveOperationExecution(
|
||||
TabularDataService service, SplitColumnSession splitColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
ArrayList<OperationExecution> invocations = new ArrayList<OperationExecution>();
|
||||
|
||||
logger.debug(splitColumnSession.toString());
|
||||
|
||||
OperationDefinition operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.AddColumn.toString(), service);
|
||||
|
||||
Map<String, Object> map1 = new HashMap<String, Object>();
|
||||
Map<String, Object> map2 = new HashMap<String, Object>();
|
||||
|
||||
ArrayList<Expression> expressions = splitColumnSession.getExpressions();
|
||||
|
||||
if (expressions == null || expressions.size() <= 1) {
|
||||
throw new TDGWTServiceException(
|
||||
"No valid expressions in splitColumnSession");
|
||||
}
|
||||
|
||||
map1.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE, ColumnTypeCodeMap
|
||||
.getColumnType(splitColumnSession.getFirstSplitColumnType()));
|
||||
map1.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE, ColumnDataTypeMap
|
||||
.map(splitColumnSession.getFirstSplitColumnDataType()));
|
||||
map1.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(splitColumnSession.getLabel1()));
|
||||
map1.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expressions.get(0));
|
||||
invocations.add(new OperationExecution(operationDefinition
|
||||
.getOperationId(), map1));
|
||||
map2.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE, ColumnTypeCodeMap
|
||||
.getColumnType(splitColumnSession.getSecondSplitColumnType()));
|
||||
map2.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE, ColumnDataTypeMap
|
||||
.map(splitColumnSession.getSecondSplitColumnDataType()));
|
||||
map2.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(splitColumnSession.getLabel2()));
|
||||
map2.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expressions.get(1));
|
||||
invocations.add(new OperationExecution(operationDefinition
|
||||
.getOperationId(), map2));
|
||||
|
||||
return invocations;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
* @param changeTableTypeSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service, MergeColumnSession mergeColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(mergeColumnSession.toString());
|
||||
|
||||
OperationDefinition operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.AddColumn.toString(), service);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
Expression expression = mergeColumnSession.getExpression();
|
||||
if (expression == null) {
|
||||
throw new TDGWTServiceException(
|
||||
"No valid expression in splitColumnSession");
|
||||
}
|
||||
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_COLUMN_TYPE, ColumnTypeCodeMap
|
||||
.getColumnType(mergeColumnSession.getMergeColumnType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_DATA_TYPE, ColumnDataTypeMap
|
||||
.map(mergeColumnSession.getMergeColumnDataType()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_LABEL,
|
||||
new ImmutableLocalizedText(mergeColumnSession.getLabel()));
|
||||
map.put(Constants.PARAMETER_ADD_COLUMN_VALUE, expression);
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param service
|
||||
* @param deleteRowsSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
protected OperationExecution retrieveOperationExecution(
|
||||
TabularDataService service, DeleteRowsSession deleteRowsSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
logger.debug(deleteRowsSession.toString());
|
||||
OperationDefinition operationDefinition;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
ArrayList<String> rows = deleteRowsSession.getRows();
|
||||
ArrayList<Integer> rowsInt = new ArrayList<Integer>();
|
||||
for (String r : rows) {
|
||||
try {
|
||||
Integer row = new Integer(r);
|
||||
rowsInt.add(row);
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error("Row:" + r + " is invalid Integer");
|
||||
}
|
||||
}
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.RemoveRowById.toString(), service);
|
||||
map.put(Constants.PARAMETER_ROW_ID, rowsInt);
|
||||
|
||||
invocation = new OperationExecution(
|
||||
operationDefinition.getOperationId(), map);
|
||||
|
||||
return invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -5113,8 +4356,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
OperationExecution invocation = retrieveOperationExecution(service,
|
||||
labelColumnSession);
|
||||
OpExecution4LabelColumn opEx=new OpExecution4LabelColumn(service, labelColumnSession);
|
||||
OpExecutionDirector director=new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
OperationExecution invocation = director.getOperationExecution();
|
||||
|
||||
if (invocation == null) {
|
||||
throw new TDGWTServiceException(
|
||||
"Error Changing the Column Label: Operation not supported for now!");
|
||||
|
@ -6400,8 +5647,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
OperationExecution invocation = retrieveOperationExecution(service,
|
||||
replaceColumnSession);
|
||||
OpExecution4ReplaceColumn opEx=new OpExecution4ReplaceColumn(service, replaceColumnSession);
|
||||
OpExecutionDirector director=new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
OperationExecution invocation = director.getOperationExecution();
|
||||
|
||||
if (invocation == null) {
|
||||
throw new TDGWTServiceException(
|
||||
"Error Replace Column Value invocation: Operation not supported");
|
||||
|
@ -6560,8 +5811,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
List<OperationExecution> invocations = retrieveOperationExecution(
|
||||
service, replaceBatchColumnSession);
|
||||
OpExecution4ReplaceBatch opEx=new OpExecution4ReplaceBatch(service, replaceBatchColumnSession);
|
||||
OpExecutionDirector director=new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
|
||||
List<OperationExecution> invocations = director.getListOperationExecution();
|
||||
|
||||
if (invocations == null) {
|
||||
throw new TDGWTServiceException("Operation not supported");
|
||||
}
|
||||
|
@ -7297,8 +6553,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
OperationExecution invocation = retrieveOperationExecution(service,
|
||||
editRowSession);
|
||||
OpExecution4EditRow opEx=new OpExecution4EditRow(service, editRowSession);
|
||||
OpExecutionDirector director=new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
OperationExecution invocation = director.getOperationExecution();
|
||||
|
||||
if (invocation == null) {
|
||||
throw new TDGWTServiceException(
|
||||
"Error in invocation: Operation not supported");
|
||||
|
@ -7792,8 +7052,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
OperationExecution invocation = retrieveOperationExecution(service,
|
||||
extractCodelistSession);
|
||||
OpExecution4ExtractCodelist opEx=new OpExecution4ExtractCodelist(service, extractCodelistSession);
|
||||
OpExecutionDirector director=new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
OperationExecution invocation = director.getOperationExecution();
|
||||
|
||||
if (invocation == null) {
|
||||
throw new TDGWTServiceException(
|
||||
"Error in invocation: Operation not supported");
|
||||
|
@ -7940,8 +7204,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
ArrayList<OperationExecution> invocations = retrieveOperationExecution(
|
||||
service, splitColumnSession);
|
||||
OpExecution4SplitColumn opEx=new OpExecution4SplitColumn(service, splitColumnSession);
|
||||
OpExecutionDirector director=new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
ArrayList<OperationExecution> invocations = director.getListOperationExecution();
|
||||
|
||||
if (invocations == null) {
|
||||
throw new TDGWTServiceException(
|
||||
"Error in invocation: Operation not supported");
|
||||
|
@ -8089,8 +7357,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
OperationExecution invocation = retrieveOperationExecution(service,
|
||||
mergeColumnSession);
|
||||
OpExecution4MergeColumn opEx=new OpExecution4MergeColumn(service, mergeColumnSession);
|
||||
OpExecutionDirector director=new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
OperationExecution invocation = director.getOperationExecution();
|
||||
|
||||
|
||||
if (invocation == null) {
|
||||
throw new TDGWTServiceException(
|
||||
"Error in invocation: Operation not supported");
|
||||
|
|
Loading…
Reference in New Issue