use of com.amalto.workbench.models.TreeObject in project tmdm-studio-se by Talend.
the class OpenObjectAction method doSelectServer.
public boolean doSelectServer(Item item, IRepositoryViewEditorInput editorInput) {
MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
if (serverObject.getType() == TreeObject.DATA_CLUSTER) {
// Data Cluster
MDMServerDef lastServerDef = RepositoryResourceUtil.getLastServerDef(item);
MDMServerDef serverDef = openServerDialog(lastServerDef);
if (serverDef != null) {
XObjectBrowserInput input = (XObjectBrowserInput) editorInput;
TreeObject xobject = (TreeObject) input.getModel();
if (xobject != null && xobject.getWsKey() != null) {
TreeParent serverRoot = getServerRoot(serverDef);
xobject.setWsKey(new WSDataClusterPK(xobject.getWsKey().toString()));
xobject.setServerRoot(serverRoot);
return true;
}
}
return false;
}
return true;
}
use of com.amalto.workbench.models.TreeObject in project tmdm-studio-se by Talend.
the class ConsistencyService method queryServerDigestValue.
public <T> Map<T, WSDigest> queryServerDigestValue(MDMServerDef serverDef, Collection<T> objs) throws XtentisException {
Map<T, WSDigest> result = new LinkedHashMap<T, WSDigest>();
TMDMService service = RepositoryWebServiceAdapter.getMDMService(serverDef);
if (isSupportConsistency(service)) {
for (T obj : objs) {
String type = null;
String objectName = null;
if (obj instanceof IRepositoryViewObject) {
IRepositoryViewObject viewObj = (IRepositoryViewObject) obj;
type = viewObj.getRepositoryObjectType().getKey();
objectName = viewObj.getLabel();
} else if (obj instanceof TreeObject) {
TreeObject treeObj = (TreeObject) obj;
ERepositoryObjectType repositoryObjectType = RepositoryQueryService.getRepositoryObjectType(treeObj.getType());
if (repositoryObjectType != null) {
type = repositoryObjectType.getKey();
objectName = getObjectName(treeObj);
}
}
if (type != null && objectName != null) {
WSDigest digest = service.getDigest(new WSDigestKey(objectName, type));
result.put(obj, digest);
}
}
}
return result;
}
use of com.amalto.workbench.models.TreeObject in project tmdm-studio-se by Talend.
the class Bean2EObjUtil method wrapEObjWithTreeObject.
public TreeObject wrapEObjWithTreeObject(EObject eobj) {
if (eobj instanceof MDMServerObject) {
MDMServerObject serverObject = (MDMServerObject) eobj;
Object wsObj = convertFromEObj2Bean(eobj);
return wrapEObjWithTreeObject(eobj, wsObj);
}
return null;
}
use of com.amalto.workbench.models.TreeObject in project tmdm-studio-se by Talend.
the class TreeObjectCheckTreeViewer method initConsistencyData.
private Map<TreeObject, ConsistencyData> initConsistencyData(MDMServerDef serverDef, List<TreeObject> treeObjs) {
Map<TreeObject, ConsistencyData> map = new HashMap<TreeObject, ConsistencyData>();
try {
ConsistencyService consistencyService = ConsistencyService.getInstance();
Map<TreeObject, WSDigest> serverDigestValues = consistencyService.queryServerDigestValue(serverDef, treeObjs);
if (treeObjs.size() > 0 && serverDigestValues.isEmpty()) {
return map;
}
for (TreeObject treeObject : treeObjs) {
ConsistencyData consistencyData = new ConsistencyData();
WSDigest serverDigestTime = serverDigestValues.get(treeObject);
consistencyData.setServerDigestTime(serverDigestTime);
String objName = getTreeObjectName(treeObject);
ERepositoryObjectType viewType = RepositoryQueryService.getRepositoryObjectType(treeObject.getType());
if (viewType == null) {
continue;
}
if (viewType == IServerObjectRepositoryType.TYPE_RESOURCE || viewType == IServerObjectRepositoryType.TYPE_JOB || viewType == IServerObjectRepositoryType.TYPE_WORKFLOW) {
consistencyData.setCompareResult(CompareResultEnum.NOT_SUPPORT);
} else {
IRepositoryViewObject viewObj = RepositoryResourceUtil.findViewObjectByName(viewType, objName);
if (viewObj == null) {
consistencyData.setCompareResult(CompareResultEnum.NOT_EXIST_IN_LOCAL);
} else {
consistencyService.updateCurrentDigestValue(viewObj);
Item item = viewObj.getProperty().getItem();
String ld = consistencyService.getLocalDigestValue(item);
String cd = consistencyService.getCurrentDigestValue(item);
long localTimestamp = consistencyService.getLocalTimestamp(item);
// key
String type = viewObj.getRepositoryObjectType().getKey();
String objectName = viewObj.getLabel();
WSDigestKey key = new WSDigestKey(objectName, type);
consistencyData.setLocalDigestTime(new WSDigest(ld, localTimestamp, key));
// init compare result;
CompareResultEnum result;
if (serverDigestTime == null || serverDigestTime.getDigestValue() == null) {
result = CompareResultEnum.NOT_EXIST_IN_SERVER;
} else {
String rd = serverDigestTime.getDigestValue();
result = consistencyService.getCompareResult(cd, ld, rd);
}
consistencyData.setCompareResult(result);
}
}
map.put(treeObject, consistencyData);
}
} catch (WebServiceException e) {
log.error(e.getMessage(), e);
} catch (XtentisException e) {
log.error(e.getMessage(), e);
}
return map;
}
use of com.amalto.workbench.models.TreeObject in project tmdm-studio-se by Talend.
the class StoredProcedureMainPage method createCompDropTarget.
private void createCompDropTarget() {
DropTarget dropTarget = new DropTarget(procedureViewer.getTextWidget(), DND.DROP_MOVE | DND.DROP_LINK);
dropTarget.setTransfer(new TreeObjectTransfer[] { TreeObjectTransfer.getInstance() });
dropTarget.addDropListener(new DropTargetAdapter() {
@Override
public void dragEnter(DropTargetEvent event) {
}
@Override
public void dragLeave(DropTargetEvent event) {
}
@Override
public void dragOver(DropTargetEvent event) {
event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
}
@Override
public void drop(DropTargetEvent event) {
if (event.data instanceof TreeObject[]) {
procedureViewer.getTextWidget().setText(procedureViewer.getTextWidget().getText() + ((TreeObject[]) event.data)[0].getDisplayName());
}
}
});
}
Aggregations