use of org.talend.core.model.update.EUpdateResult in project tdi-studio-se by Talend.
the class GenericUpdateManager method getDeletedOrReselectTablesMap.
@Override
public Map<String, EUpdateResult> getDeletedOrReselectTablesMap() {
Map<String, EUpdateResult> drMap = new HashMap<>();
List<IMetadataTable> newTables = getConversionMetadataTables(connectionItem.getConnection());
for (IMetadataTable oldTable : oldMetadataTable) {
String prefix = connectionItem.getProperty().getId() + UpdatesConstants.SEGMENT_LINE;
boolean isDeleted = true;
String oldtableLabel = oldTable.getLabel();
String oldtableId = oldTable.getId();
for (IMetadataTable newTable : newTables) {
String tableLabel = newTable.getLabel();
String tableId = newTable.getId();
if (tableLabel.equals(oldtableLabel)) {
isDeleted = false;
/* if table name is same but tableId is not same,means table has been deselect and reselect */
if (!tableId.equals(oldtableId)) {
// don't handle reload for generic
// drMap.put(prefix + tableLabel, EUpdateResult.RELOAD);
}
}
}
/* if can't find the name when looping the new tables,means the table has been removed */
if (isDeleted) {
drMap.put(prefix + oldtableLabel, EUpdateResult.DELETE);
}
}
return drMap;
}
use of org.talend.core.model.update.EUpdateResult in project tdi-studio-se by Talend.
the class UpdateCheckResult method getName.
@Override
@SuppressWarnings("unchecked")
public String getName() {
IUpdateItemType updateType = getUpdateType();
String displayName = updateType.getDisplayLabel();
if (updateType instanceof EUpdateItemType) {
switch((EUpdateItemType) updateType) {
case NODE_SCHEMA:
if (getResultType() == EUpdateResult.RENAME) {
List<Object> param = (List<Object>) getParameter();
String[] oldSourceIdAndChildName = UpdateManagerUtils.getSourceIdAndChildName((String) param.get(1));
String[] newSourceIdAndChildName = UpdateManagerUtils.getSourceIdAndChildName((String) param.get(2));
String display = UpdateManagerHelper.getRenamedDisplay(oldSourceIdAndChildName[1], newSourceIdAndChildName[1]);
if (display != null) {
displayName = display;
}
} else if (getResultType() == EUpdateResult.DELETE) {
// table delete by deselect
List<Object> param = (List<Object>) getParameter();
String tableDeleted = (String) param.get(0);
EUpdateResult status = (EUpdateResult) param.get(1);
String display = getDeleteOrReloadDisplay(tableDeleted, status);
if (display != null) {
displayName = display;
}
} else if (getResultType() == EUpdateResult.RELOAD) {
// table reload by deselect and reselect
List<Object> param = (List<Object>) getParameter();
String tableReload = (String) param.get(0);
EUpdateResult status = (EUpdateResult) param.get(1);
String display = getDeleteOrReloadDisplay(tableReload, status);
if (display != null) {
displayName = display;
}
} else {
if (getUpdateObject() instanceof INode && getParameter() instanceof List && PluginChecker.isEBCDICPluginLoaded()) {
IEBCDICProviderService service = (IEBCDICProviderService) GlobalServiceRegister.getDefault().getService(IEBCDICProviderService.class);
if (service != null && service.isEbcdicNode((INode) getUpdateObject())) {
List<Object> paramObjs = (List<Object>) getParameter();
if (paramObjs.size() >= 2) {
Object schemaName = paramObjs.get(1);
if (schemaName instanceof String) {
displayName = displayName + UpdateManagerUtils.addBrackets((String) schemaName);
}
}
}
}
}
break;
case NODE_PROPERTY:
case NODE_QUERY:
case JOBLET_SCHEMA:
case NODE_VALIDATION_RULE:
break;
case JOB_PROPERTY_EXTRA:
displayName = displayName + UpdateManagerUtils.addBrackets(EComponentCategory.EXTRA.getTitle());
break;
case JOB_PROPERTY_STATS_LOGS:
displayName = displayName + UpdateManagerUtils.addBrackets(EComponentCategory.STATSANDLOGS.getTitle());
break;
case JOB_PROPERTY_HEADERFOOTER:
displayName = displayName + UpdateManagerUtils.addBrackets(EComponentCategory.HEADERFOOTER.getTitle());
break;
case CONTEXT_GROUP:
if (getUpdateObject() != null && getUpdateObject() instanceof IContext) {
displayName = ((IContext) getUpdateObject()).getName();
}
break;
case CONTEXT:
// case JOBLET_CONTEXT:
{
String display = null;
switch(getResultType()) {
case RENAME:
List<Object> param = (List<Object>) getParameter();
display = UpdateManagerHelper.getRenamedDisplay((String) param.get(1), (String) param.get(2));
break;
default:
if (getUpdateObject() instanceof Collection) {
display = UpdateManagerHelper.getCollectionsDisplay(getUpdateObject(), false);
}
break;
}
if (display != null) {
displayName = display;
}
break;
}
case JOBLET_RENAMED:
{
List<Object> param = (List<Object>) getParameter();
String display = UpdateManagerHelper.getRenamedDisplay((String) param.get(1), (String) param.get(2));
if (display != null) {
displayName = display;
}
break;
}
case RELOAD:
case JUNIT_RELOAD:
if (getParameter() != null && getParameter() instanceof PropertyChangeEvent) {
PropertyChangeEvent event = (PropertyChangeEvent) getParameter();
// reload all compoennts.
if (event.getSource() != null && !(event.getSource() instanceof IProcess)) {
displayName = updateType.getDisplayLabel();
break;
}
}
break;
default:
}
return displayName;
} else {
return UpdateManagerProviderDetector.INSTANCE.getResultName(this);
}
}
use of org.talend.core.model.update.EUpdateResult in project tdi-studio-se by Talend.
the class UpdateViewerHelper method checkItemResultState.
private void checkItemResultState(Item item, boolean state) {
if (item == null) {
return;
}
List<IProcess2> openedProcesses = UpdateManagerUtils.getOpenedProcess();
boolean isOpened = openedProcesses.contains(item.getResultObject().getJob());
boolean jobletUpdate = false;
boolean jobletContext = false;
if (item.getParent() != null && item.getParent().getNode() != null && (item.getParent().getNode() instanceof Node) && ((Node) item.getParent().getNode()).isJoblet()) {
jobletUpdate = true;
}
IUpdateItemType jobletContextType = UpdateManagerProviderDetector.INSTANCE.getUpdateItemType(UpdateManagerHelper.TYPE_JOBLET_CONTEXT);
if (jobletContextType != null && item.getParent() != null && jobletContextType.equals(item.getParent().getType())) {
jobletContext = true;
}
// not checked
if (!state && !item.getResultObject().isReadOnly()) {
EUpdateResult resultType = item.getResultObject().getResultType();
if (resultType == EUpdateResult.UPDATE || resultType == EUpdateResult.ADD || resultType == EUpdateResult.DELETE) {
item.setChecked(false);
} else if ((jobletUpdate || jobletContext) && !isOpened && (resultType == EUpdateResult.JOBLET_UPDATE || resultType == EUpdateResult.RELOAD)) {
item.setChecked(state);
}
} else if (item.getResultObject().isReadOnly() && jobletUpdate) {
return;
} else {
// keep the checked
item.setChecked(true);
}
}
Aggregations