use of org.talend.mdm.repository.model.mdmproperties.WSTransformerV2Item in project tmdm-studio-se by Talend.
the class ViewProcessImportHandler method beforeCreatingItem.
@Override
protected void beforeCreatingItem(ImportItem selectedImportItem) {
Item item = selectedImportItem.getItem();
String statePath = item.getState().getPath();
if (item instanceof WSViewItem) {
if (RepositoryTransformUtil.getInstance().getViewType(item.getProperty().getLabel()) == IViewNodeConstDef.TYPE_WEBFILTER) {
if (!statePath.startsWith(IPath.SEPARATOR + IViewNodeConstDef.PATH_WEBFILTER)) {
item.getState().setPath(IPath.SEPARATOR + IViewNodeConstDef.PATH_WEBFILTER + statePath);
}
} else {
if (!statePath.startsWith(IPath.SEPARATOR + IViewNodeConstDef.PATH_SEARCHFILTER)) {
item.getState().setPath(IPath.SEPARATOR + IViewNodeConstDef.PATH_SEARCHFILTER + statePath);
}
}
OperatorUpdatorProvider.instance().updateOperator(item);
}
if (item instanceof WSTransformerV2Item) {
String processName = item.getProperty().getLabel();
int processType = RepositoryTransformUtil.getInstance().getProcessType(processName);
switch(processType) {
case ITransformerV2NodeConsDef.TYPE_BEFORESAVE:
if (!statePath.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_BEFORESAVE)) {
item.getState().setPath(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_BEFORESAVE + statePath);
}
break;
case ITransformerV2NodeConsDef.TYPE_BEFOREDEL:
if (!statePath.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_BEFOREDEL)) {
item.getState().setPath(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_BEFOREDEL + statePath);
}
break;
case ITransformerV2NodeConsDef.TYPE_ENTITYACTION:
if (!statePath.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_ENTITYACTION)) {
item.getState().setPath(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_ENTITYACTION + statePath);
}
break;
case ITransformerV2NodeConsDef.TYPE_WELCOMEACTION:
if (!statePath.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_WELCOMEACTION)) {
item.getState().setPath(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_WELCOMEACTION + statePath);
}
break;
case ITransformerV2NodeConsDef.TYPE_SMARTVIEW:
if (!statePath.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_SMARTVIEW)) {
item.getState().setPath(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_SMARTVIEW + statePath);
}
break;
case ITransformerV2NodeConsDef.TYPE_OTHER:
if (!statePath.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_OTHER)) {
item.getState().setPath(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_OTHER + statePath);
}
break;
default:
break;
}
}
}
Aggregations