Updated Ambiguous

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@98560 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-07-10 16:16:46 +00:00
parent 494670918f
commit fa70ac92dc
9 changed files with 508 additions and 65 deletions

View File

@ -5146,3 +5146,67 @@ Compiling...
Compilation completed in 0.00 seconds Compilation completed in 0.00 seconds
Removing invalidated units Removing invalidated units
Finding entry point classes Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
40% complete (ETR: 8 seconds)
50% complete (ETR: 6 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 15.25 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
30% complete (ETR: 10 seconds)
30% complete (ETR: 10 seconds)
30% complete (ETR: 10 seconds)
30% complete (ETR: 11 seconds)
40% complete (ETR: 9 seconds)
50% complete (ETR: 7 seconds)
60% complete (ETR: 5 seconds)
70% complete (ETR: 4 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 14.96 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes

View File

@ -5,6 +5,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.ComboBox; import com.sencha.gxt.widget.core.client.form.ComboBox;
/** /**
@ -45,4 +47,27 @@ public class ChangeColumnTypeDialog extends Window {
} }
/**
* {@inheritDoc}
*/
@Override
protected void initTools() {
super.initTools();
closeBtn.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
close();
}
});
}
public void close() {
hide();
}
} }

View File

@ -8,6 +8,7 @@ import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingDialo
import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingListProperties; import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingListProperties;
import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingListener; import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingListener;
import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog; import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog;
import org.gcube.portlets.user.td.columnwidget.client.progress.ProgressDialogListener;
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPropertiesCombo; import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPropertiesCombo;
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataTypeProperties; import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataTypeProperties;
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnTypeCodeProperties; import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnTypeCodeProperties;
@ -28,7 +29,10 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; 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.ColumnDataType;
@ -77,7 +81,7 @@ import com.sencha.gxt.widget.core.client.info.Info;
* *
*/ */
public class ChangeColumnTypePanel extends FramedPanel implements public class ChangeColumnTypePanel extends FramedPanel implements
CodelistSelectionListener, ColumnMappingListener { CodelistSelectionListener, ColumnMappingListener, ProgressDialogListener{
protected String WIDTH = "640px"; protected String WIDTH = "640px";
protected String HEIGHT = "520px"; protected String HEIGHT = "520px";
protected EventBus eventBus; protected EventBus eventBus;
@ -927,8 +931,9 @@ public class ChangeColumnTypePanel extends FramedPanel implements
} }
public void onSuccess(Void result) { public void onSuccess(Void result) {
changeColumnTypeProgressDialog = new ChangeColumnTypeProgressDialog( callChangeColumnTypeProgressDialog();
changeColumnTypeSession, eventBus);
} }
}); });
@ -1085,4 +1090,46 @@ public class ChangeColumnTypePanel extends FramedPanel implements
} }
public void close() {
if (parent != null) {
parent.close();
}
}
protected void callChangeColumnTypeProgressDialog(){
changeColumnTypeProgressDialog = new ChangeColumnTypeProgressDialog(
eventBus);
changeColumnTypeProgressDialog.addProgressDialogListener(this);
changeColumnTypeProgressDialog.show();
}
@Override
public void operationComplete(TRId trId) {
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.CHANGECOLUMNTYPE, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
close();
}
@Override
public void operationFailed(Throwable caught, String reason) {
UtilsGXT3.alert("Error in Change Column Type", reason);
close();
}
@Override
public void operationStopped(TRId trId, String reason, String details) {
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.CHANGECOLUMNTYPE, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
close();
}
} }

View File

@ -2,14 +2,10 @@ package org.gcube.portlets.user.td.columnwidget.client;
import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.EntryPoint;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
/** /**
* *
@ -21,10 +17,10 @@ public class ColumnWidgetEntry implements EntryPoint {
public void onModuleLoad() { public void onModuleLoad() {
EventBus eventBus= new SimpleEventBus(); //EventBus eventBus= new SimpleEventBus();
TRId trId=new TRId(); TRId trId=new TRId();
//For example Tabular Resource 1 and table 1 //For example Tabular Resource 7 and table 402
trId.setId("7"); trId.setId("7");
trId.setTableId("402"); trId.setTableId("402");
@ -37,9 +33,11 @@ public class ColumnWidgetEntry implements EntryPoint {
/*ChangeColumnTypeDialog changeColumnType=new ChangeColumnTypeDialog(trId,eventBus); /*ChangeColumnTypeDialog changeColumnType=new ChangeColumnTypeDialog(trId,eventBus);
changeColumnType.show(); changeColumnType.show();
*/ */
ChangeColumnTypeSession changeColumnTypeSession=null;
ChangeColumnTypeProgressDialog c=new ChangeColumnTypeProgressDialog(changeColumnTypeSession, eventBus); /*ChangeColumnTypeProgressDialog c=new ChangeColumnTypeProgressDialog(eventBus);
c.addProgressDialogListener(changeColumnType);
c.show(); c.show();
*/
/*DialogCodelistSelection dcs=new DialogCodelistSelection(); /*DialogCodelistSelection dcs=new DialogCodelistSelection();
dcs.show(); dcs.show();

View File

@ -1,5 +1,8 @@
package org.gcube.portlets.user.td.columnwidget.client.batch; package org.gcube.portlets.user.td.columnwidget.client.batch;
import java.util.ArrayList;
import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog;
import org.gcube.portlets.user.td.columnwidget.client.progress.ProgressDialogListener; import org.gcube.portlets.user.td.columnwidget.client.progress.ProgressDialogListener;
import org.gcube.portlets.user.td.columnwidget.client.progress.ReplaceBatchColumnProgressDialog; import org.gcube.portlets.user.td.columnwidget.client.progress.ReplaceBatchColumnProgressDialog;
import org.gcube.portlets.user.td.columnwidget.client.progress.ResumeDialogListener; import org.gcube.portlets.user.td.columnwidget.client.progress.ResumeDialogListener;
@ -11,7 +14,14 @@ import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS; import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession; import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ConditionCode;
import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow;
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnSession; 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.column.mapping.ColumnMappingData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
@ -19,6 +29,9 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestProperties; import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestProperties;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; 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.ColumnTypeMap;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
@ -42,6 +55,8 @@ public class ReplaceBatchDialog extends Window implements
protected RequestProperties requestProperties; protected RequestProperties requestProperties;
protected EventBus eventBus; protected EventBus eventBus;
protected String taskId; protected String taskId;
private InvocationS invocationS;
private ConditionCode conditionCode; // For Curation
public ReplaceBatchDialog(TRId trId, String columnName, EventBus eventBus) { public ReplaceBatchDialog(TRId trId, String columnName, EventBus eventBus) {
this.trId = trId; this.trId = trId;
@ -61,11 +76,14 @@ public class ReplaceBatchDialog extends Window implements
this.trId = trId; this.trId = trId;
this.requestProperties = requestProperties; this.requestProperties = requestProperties;
this.eventBus = eventBus; this.eventBus = eventBus;
invocationS = (InvocationS) requestProperties.getMap().get(
InvocationS invocationS=(InvocationS) requestProperties.getMap().get(
Constants.REQUEST_PROPERTIES_INVOCATIONS); Constants.REQUEST_PROPERTIES_INVOCATIONS);
taskId = invocationS.getTaskId(); taskId = invocationS.getTaskId();
conditionCode = (ConditionCode) requestProperties.getMap().get(
Constants.REQUEST_PROPERTIES_CONDITIONCODE);
Log.debug("Resume TaskId:" + taskId); Log.debug("Resume TaskId:" + taskId);
initWindow(); initWindow();
@ -79,12 +97,56 @@ public class ReplaceBatchDialog extends Window implements
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
setResizable(false); setResizable(false);
setHeadingText("Replace Batch");
setClosable(true); setClosable(true);
setModal(true); setModal(true);
forceLayoutOnResize = true; forceLayoutOnResize = true;
getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch()); if (conditionCode == null) {
setHeadingText("Replace Batch");
getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch());
} else {
switch(conditionCode){
case AllowedColumnType:
break;
case AmbiguousValueOnExternalReference:
setHeadingText("Resolve Ambiguous Values");
break;
case CastValidation:
break;
case CodeNamePresence:
break;
case DuplicateTupleValidation:
break;
case DuplicateValueInColumn:
break;
case GenericTupleValidity:
break;
case GenericValidity:
break;
case MaxOneCodenameForDataLocale:
break;
case MissingValueOnExternalReference:
setHeadingText("Resolve Value on External Reference");
break;
case MustContainAtLeastOneDimension:
break;
case MustContainAtLeastOneMeasure:
break;
case MustHaveDataLocaleMetadataAndAtLeastOneLabel:
break;
case OnlyOneCodeColumn:
break;
case OnlyOneCodenameColumn:
break;
case ValidPeriodFormat:
break;
default:
setHeadingText("Replace Batch");
getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch());
break;
}
}
} }
/** /**
@ -110,6 +172,54 @@ public class ReplaceBatchDialog extends Window implements
protected void startBatchReplace( protected void startBatchReplace(
ReplaceBatchColumnSession replaceBatchColumnSession) { ReplaceBatchColumnSession replaceBatchColumnSession) {
if (conditionCode == null) {
callStartReplaceBatchColumn(replaceBatchColumnSession);
} else {
switch (conditionCode) {
case AllowedColumnType:
break;
case AmbiguousValueOnExternalReference:
callChangeColumnType(replaceBatchColumnSession);
break;
case CastValidation:
break;
case CodeNamePresence:
break;
case DuplicateTupleValidation:
break;
case DuplicateValueInColumn:
break;
case GenericTupleValidity:
break;
case GenericValidity:
break;
case MaxOneCodenameForDataLocale:
break;
case MissingValueOnExternalReference:
callStartReplaceBatchColumn(replaceBatchColumnSession);
break;
case MustContainAtLeastOneDimension:
break;
case MustContainAtLeastOneMeasure:
break;
case MustHaveDataLocaleMetadataAndAtLeastOneLabel:
break;
case OnlyOneCodeColumn:
break;
case OnlyOneCodenameColumn:
break;
case ValidPeriodFormat:
break;
default:
callStartReplaceBatchColumn(replaceBatchColumnSession);
break;
}
}
}
protected void callStartReplaceBatchColumn(
ReplaceBatchColumnSession replaceBatchColumnSession) {
TDGWTServiceAsync.INSTANCE.startReplaceBatchColumn( TDGWTServiceAsync.INSTANCE.startReplaceBatchColumn(
replaceBatchColumnSession, new AsyncCallback<Void>() { replaceBatchColumnSession, new AsyncCallback<Void>() {
@ -134,7 +244,6 @@ public class ReplaceBatchDialog extends Window implements
} }
}); });
} }
protected void callReplaceBatchColumnProgressDialog() { protected void callReplaceBatchColumnProgressDialog() {
@ -147,6 +256,7 @@ public class ReplaceBatchDialog extends Window implements
@Override @Override
public void operationComplete(TRId trId) { public void operationComplete(TRId trId) {
this.trId = trId;
if (taskId == null) { if (taskId == null) {
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED; ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent( ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
@ -154,8 +264,56 @@ public class ReplaceBatchDialog extends Window implements
eventBus.fireEvent(changeTableRequestEvent); eventBus.fireEvent(changeTableRequestEvent);
hide(); hide();
} else { } else {
this.trId=trId; if (conditionCode == null) {
StartTaskResume(); StartTaskResume();
} else {
switch (conditionCode) {
case AllowedColumnType:
break;
case AmbiguousValueOnExternalReference:
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.COLUMNREPLACEBATCH, trId,
why);
eventBus.fireEvent(changeTableRequestEvent);
hide();
break;
case CastValidation:
break;
case CodeNamePresence:
break;
case DuplicateTupleValidation:
break;
case DuplicateValueInColumn:
break;
case GenericTupleValidity:
break;
case GenericValidity:
break;
case MaxOneCodenameForDataLocale:
break;
case MissingValueOnExternalReference:
StartTaskResume();
break;
case MustContainAtLeastOneDimension:
break;
case MustContainAtLeastOneMeasure:
break;
case MustHaveDataLocaleMetadataAndAtLeastOneLabel:
break;
case OnlyOneCodeColumn:
break;
case OnlyOneCodenameColumn:
break;
case ValidPeriodFormat:
break;
default:
StartTaskResume();
break;
}
}
} }
} }
@ -176,9 +334,11 @@ public class ReplaceBatchDialog extends Window implements
} }
protected void StartTaskResume(){ protected void StartTaskResume() {
TaskResumeSession taskResumeSession=new TaskResumeSession(trId,taskId); TaskResumeSession taskResumeSession = new TaskResumeSession(trId,
TDGWTServiceAsync.INSTANCE.startTaskResume(taskResumeSession, new AsyncCallback<Void>() { taskId);
TDGWTServiceAsync.INSTANCE.startTaskResume(taskResumeSession,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) { if (caught instanceof TDGWTSessionExpiredException) {
@ -188,7 +348,8 @@ public class ReplaceBatchDialog extends Window implements
Log.error("Task Resume failed:" Log.error("Task Resume failed:"
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error on task resume", UtilsGXT3.alert("Error on task resume",
"Error on task resume (taskId="+taskId+")"); "Error on task resume (taskId=" + taskId
+ ")");
} }
close(); close();
@ -202,17 +363,14 @@ public class ReplaceBatchDialog extends Window implements
}); });
} }
protected void callForTaskResume() {
protected void callForTaskResume(){ TaskResumeProgressDialog dialog = new TaskResumeProgressDialog(eventBus);
TaskResumeProgressDialog dialog = new TaskResumeProgressDialog(
eventBus);
dialog.addResumeDialogListener(this); dialog.addResumeDialogListener(this);
dialog.show(); dialog.show();
} }
@Override @Override
public void resumeComplete(TRId trId) { public void resumeComplete(TRId trId) {
ChangeTableWhy why = ChangeTableWhy.TABLECURATION; ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
@ -220,14 +378,14 @@ public class ReplaceBatchDialog extends Window implements
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why); ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
eventBus.fireEvent(changeTableRequestEvent); eventBus.fireEvent(changeTableRequestEvent);
hide(); hide();
} }
@Override @Override
public void resumeFailed(Throwable caught, String reason) { public void resumeFailed(Throwable caught, String reason) {
UtilsGXT3.alert("Error in Task Resume", reason); UtilsGXT3.alert("Error in Task Resume", reason);
hide(); hide();
} }
@Override @Override
@ -237,7 +395,73 @@ public class ReplaceBatchDialog extends Window implements
ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why); ChangeTableRequestType.COLUMNREPLACEBATCH, trId, why);
eventBus.fireEvent(changeTableRequestEvent); eventBus.fireEvent(changeTableRequestEvent);
hide(); hide();
}
private void callChangeColumnType(
ReplaceBatchColumnSession replaceBatchColumnSession) {
Log.debug("ReplaceBatchColumnSession: "+replaceBatchColumnSession.toString());
ColumnData col = replaceBatchColumnSession.getColumnData();
ColumnTypeCode colTypeCode = ColumnTypeMap.getColumnTypeCode(col
.getTypeCode());
ColumnDataType colDataType = ColumnTypeMap.getColumnDataType(col
.getDataTypeName());
ColumnData codelistColumnReference = replaceBatchColumnSession
.getConnection();
ArrayList<ReplaceEntry> replaceEntryList = replaceBatchColumnSession
.getReplaceEntryList();
ArrayList<ColumnMappingData> mapping = new ArrayList<ColumnMappingData>();
for (ReplaceEntry re : replaceEntryList) {
DimensionRow sourceArg = new DimensionRow(re.getRowId(),
re.getValue());
DimensionRow targetArg = re.getReplacementDimensionRow();
ColumnMappingData columnMappingData = new ColumnMappingData(
sourceArg, targetArg);
mapping.add(columnMappingData);
}
ColumnMappingList columnMappingList = new ColumnMappingList("1", "map",
mapping);
ChangeColumnTypeSession changeColumnTypeSession = new ChangeColumnTypeSession(
col, colTypeCode, colDataType, ColumnTypeCode.DIMENSION,
ColumnDataType.Integer, codelistColumnReference,
columnMappingList);
Log.debug("ChangeColumnTypeSession: "+changeColumnTypeSession.toString());
TDGWTServiceAsync.INSTANCE.startChangeColumnType(
changeColumnTypeSession, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.debug("Change Column Type Error: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Change Column Type Error ",
"Error in invocation of change column type operation!");
}
}
public void onSuccess(Void result) {
callChangeColumnTypeProgressDialog();
}
});
}
protected void callChangeColumnTypeProgressDialog() {
ChangeColumnTypeProgressDialog changeColumnTypeProgressDialog = new ChangeColumnTypeProgressDialog(
eventBus);
changeColumnTypeProgressDialog.addProgressDialogListener(this);
changeColumnTypeProgressDialog.show();
} }
} }

View File

@ -174,6 +174,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
this.eventBus = eventBus; this.eventBus = eventBus;
this.conditionCode=null; this.conditionCode=null;
this.validationColumnColumnId=null; this.validationColumnColumnId=null;
connection = null; connection = null;
hasValidationColumns = false; hasValidationColumns = false;
Log.debug("Create BatchReplacePanel(): [" + trId.toString() Log.debug("Create BatchReplacePanel(): [" + trId.toString()
@ -651,16 +652,74 @@ public class ReplaceBatchPanel extends FramedPanel implements
return records; return records;
} }
//
protected ReplaceEntry getRecord(Occurrences entry) { protected ReplaceEntry getRecord(Occurrences entry) {
ReplaceEntry data = null; ReplaceEntry data = null;
if (column.isViewColumn()) { if (conditionCode == null) {
data = new ReplaceEntry(entry.getValue(), entry.getRowId(), if (column.isViewColumn()) {
entry.getNumber(), null, null); data = new ReplaceEntry(entry.getValue(), entry.getRowId(),
entry.getNumber(), null, null);
} else {
data = new ReplaceEntry(entry.getValue(), entry.getNumber(), null,
null);
}
} else { } else {
data = new ReplaceEntry(entry.getValue(), entry.getNumber(), null, switch (conditionCode) {
null); case AllowedColumnType:
break;
case AmbiguousValueOnExternalReference:
data = new ReplaceEntry(entry.getValue(), entry.getRowId(),
entry.getNumber(), null, null);
break;
case CastValidation:
break;
case CodeNamePresence:
break;
case DuplicateTupleValidation:
break;
case DuplicateValueInColumn:
break;
case GenericTupleValidity:
break;
case GenericValidity:
break;
case MaxOneCodenameForDataLocale:
break;
case MissingValueOnExternalReference:
if (column.isViewColumn()) {
data = new ReplaceEntry(entry.getValue(), entry.getRowId(),
entry.getNumber(), null, null);
} else {
data = new ReplaceEntry(entry.getValue(), entry.getNumber(), null,
null);
}
break;
case MustContainAtLeastOneDimension:
break;
case MustContainAtLeastOneMeasure:
break;
case MustHaveDataLocaleMetadataAndAtLeastOneLabel:
break;
case OnlyOneCodeColumn:
break;
case OnlyOneCodenameColumn:
break;
case ValidPeriodFormat:
break;
default:
if (column.isViewColumn()) {
data = new ReplaceEntry(entry.getValue(), entry.getRowId(),
entry.getNumber(), null, null);
} else {
data = new ReplaceEntry(entry.getValue(), entry.getNumber(), null,
null);
}
break;
}
} }
return data; return data;
} }
@ -708,7 +767,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
protected void startReplaceBatch( protected void startReplaceBatch(
ArrayList<ReplaceEntry> effectiveReplaceList) { ArrayList<ReplaceEntry> effectiveReplaceList) {
ReplaceBatchColumnSession replaceBatchColumnSession = new ReplaceBatchColumnSession( ReplaceBatchColumnSession replaceBatchColumnSession = new ReplaceBatchColumnSession(
trId, column, effectiveReplaceList, column.isViewColumn()); trId, column, effectiveReplaceList, column.isViewColumn(),connection);
parent.startBatchReplace(replaceBatchColumnSession); parent.startBatchReplace(replaceBatchColumnSession);
} }

View File

@ -2,7 +2,6 @@ package org.gcube.portlets.user.td.columnwidget.client.mapping;
import java.util.ArrayList; import java.util.ArrayList;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList;
@ -75,7 +74,7 @@ public class ColumnMappingDialog extends Window {
setClosable(true); setClosable(true);
setModal(true); setModal(true);
forceLayoutOnResize = true; forceLayoutOnResize = true;
getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch()); //getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch());
} }

View File

@ -20,7 +20,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/** /**
* TaskResumeProgressDialog is a Dialog that show progress of resume a Task * AddColumnProgressDialog is a Dialog that show progress of AddColumn
* *
* @author "Giancarlo Panichi" <a * @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
@ -38,7 +38,6 @@ public class AddColumnProgressDialog extends Window implements
protected TextButton ok; protected TextButton ok;
protected TRId trId; protected TRId trId;
private String reason; private String reason;
private String details; private String details;
public AddColumnProgressDialog( public AddColumnProgressDialog(

View File

@ -1,12 +1,9 @@
package org.gcube.portlets.user.td.columnwidget.client.progress; package org.gcube.portlets.user.td.columnwidget.client.progress;
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -30,19 +27,20 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
*/ */
public class ChangeColumnTypeProgressDialog extends Window implements public class ChangeColumnTypeProgressDialog extends Window implements
ChangeColumnTypeProgressListener { ChangeColumnTypeProgressListener {
protected ArrayList<ProgressDialogListener> listeners = new ArrayList<ProgressDialogListener>();
public static final int STATUS_POLLING_DELAY = 1000; public static final int STATUS_POLLING_DELAY = 1000;
protected String WIDTH = "400px"; protected String WIDTH = "400px";
protected String HEIGHT = "120px"; protected String HEIGHT = "120px";
protected ChangeColumnTypeSession changeColumnTypeSession;
protected EventBus eventBus; protected EventBus eventBus;
protected ChangeColumnTypeProgressUpdater progressUpdater; protected ChangeColumnTypeProgressUpdater progressUpdater;
protected TextButton ok; protected TextButton ok;
protected TRId trId; protected TRId trId;
private ChangeTableWhy why; private String reason;
private String details;
public ChangeColumnTypeProgressDialog( public ChangeColumnTypeProgressDialog(EventBus eventBus) {
ChangeColumnTypeSession changeColumnTypeSession, EventBus eventBus) {
this.changeColumnTypeSession = changeColumnTypeSession;
this.eventBus = eventBus; this.eventBus = eventBus;
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
@ -87,52 +85,65 @@ public class ChangeColumnTypeProgressDialog extends Window implements
ok.setVisible(false); ok.setVisible(false);
} }
public void addProgressDialogListener(ProgressDialogListener listener) {
listeners.add(listener);
}
public void removeProgressDialogListener(ProgressDialogListener listener) {
listeners.remove(listener);
}
@Override
public void operationInitializing() { public void operationInitializing() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override
public void operationUpdate(float elaborated) { public void operationUpdate(float elaborated) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override
public void operationComplete(TRId trId) { public void operationComplete(TRId trId) {
Log.debug("Operation Complete return: " + trId.toString()); Log.debug("Operation Complete return: " + trId.toString());
this.trId = trId; this.trId = trId;
why = ChangeTableWhy.TABLEUPDATED; fireOperationComplete(trId);
updateInvocation(); hide();
} }
@Override
public void operationFailed(Throwable caught, String reason, public void operationFailed(Throwable caught, String reason,
String failureDetails) { String failureDetails) {
if (caught instanceof TDGWTSessionExpiredException) { if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
ok.setVisible(true); fireOperationFailed(caught,reason);
this.trId = null; hide();
UtilsGXT3.alert("Error changing the column type", reason);
} }
} }
public void updateInvocation() { public void updateInvocation() {
if (trId != null) { if (trId != null) {
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent( fireOperationStopped(trId, reason, details);
ChangeTableRequestType.CHANGECOLUMNTYPE, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
} }
hide(); hide();
} }
@Override @Override
public void operationStopped(TRId trId, String reason, String details) { public void operationStopped(TRId trId, String reason, String details) {
Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason
+ ", " + details + "]"); + ", " + details + "]");
ok.setVisible(true);
this.trId = trId; this.trId = trId;
why = ChangeTableWhy.TABLECURATION; this.reason=reason;
this.details=details;
ok.setVisible(true);
} }
@Override @Override
@ -146,4 +157,21 @@ public class ChangeColumnTypeProgressDialog extends Window implements
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
protected void fireOperationComplete(TRId trId) {
for (ProgressDialogListener listener : listeners)
listener.operationComplete(trId);
}
protected void fireOperationFailed(Throwable caught, String reason) {
for (ProgressDialogListener listener : listeners)
listener.operationFailed(caught, reason);
}
protected void fireOperationStopped(TRId trId, String reason, String details) {
for (ProgressDialogListener listener : listeners)
listener.operationStopped(trId,reason, details);
}
} }