use of org.talend.mdm.repository.core.service.ConsistencyService in project tmdm-studio-se by Talend.
the class ConfirmConflictMessageDialog method buttonPressed.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
@Override
protected void buttonPressed(int buttonId) {
ConsistencyService service = ConsistencyService.getInstance();
if (buttonId == IDialogConstants.OK_ID) {
selectedStrategy = getSelectedStrategy();
} else if (buttonId == IDialogConstants.DETAILS_ID) {
setReturnCode(IDialogConstants.DETAILS_ID);
close();
return;
}
if (!rememberBun.getSelection()) {
service.setWarnUserWhenConflict(true);
} else {
service.setWarnUserWhenConflict(false);
service.setConflictStrategy(selectedStrategy);
}
super.buttonPressed(buttonId);
}
use of org.talend.mdm.repository.core.service.ConsistencyService in project tmdm-studio-se by Talend.
the class ConsistencyConflictDialog method getCompareResult.
private CompareResultEnum getCompareResult(IRepositoryViewObject viewObj) {
CompareResultEnum result = compareResultMap.get(viewObj);
if (result == null) {
ERepositoryObjectType viewType = viewObj.getRepositoryObjectType();
if (viewType == IServerObjectRepositoryType.TYPE_RESOURCE || viewType == IServerObjectRepositoryType.TYPE_JOB || viewType == IServerObjectRepositoryType.TYPE_WORKFLOW) {
result = CompareResultEnum.NOT_SUPPORT;
} else {
WSDigest dt = viewObjMap.get(viewObj);
if (dt == null) {
result = CompareResultEnum.NOT_EXIST_IN_SERVER;
} else {
Item item = viewObj.getProperty().getItem();
ConsistencyService service = ConsistencyService.getInstance();
String ld = service.getLocalDigestValue(item);
String cd = service.getCurrentDigestValue(item);
String rd = dt.getDigestValue();
result = service.getCompareResult(cd, ld, rd);
}
}
compareResultMap.put(viewObj, result);
}
return result;
}
use of org.talend.mdm.repository.core.service.ConsistencyService 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 org.talend.mdm.repository.core.service.ConsistencyService in project tmdm-studio-se by Talend.
the class RepositoryViewObjectCheckedWidget method getConsistencyData.
private synchronized ConsistencyData getConsistencyData(MDMServerDef serverDef, IRepositoryViewObject viewObj) {
if (!isServerOk) {
return null;
}
ConsistencyData consistencyData = consistencyMap.get(viewObj);
if (consistencyData != null) {
return consistencyData;
}
try {
ConsistencyService consistencyService = ConsistencyService.getInstance();
consistencyData = new ConsistencyData();
ERepositoryObjectType viewType = viewObj.getRepositoryObjectType();
if (viewType == null) {
return null;
}
if (viewType == IServerObjectRepositoryType.TYPE_RESOURCE || viewType == IServerObjectRepositoryType.TYPE_JOB || viewType == IServerObjectRepositoryType.TYPE_WORKFLOW) {
consistencyData.setCompareResult(CompareResultEnum.NOT_SUPPORT);
} else {
List<IRepositoryViewObject> viewObjs = new ArrayList<IRepositoryViewObject>();
viewObjs.add(viewObj);
Map<IRepositoryViewObject, WSDigest> digestValueResult = consistencyService.queryServerDigestValue(serverDef, viewObjs);
WSDigest serverDigestTime = digestValueResult.get(viewObj);
consistencyData.setServerDigestTime(serverDigestTime);
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);
}
consistencyMap.put(viewObj, consistencyData);
} catch (WebServiceException e) {
log.error(e.getMessage(), e);
} catch (XtentisException e) {
log.error(e.getMessage(), e);
}
return consistencyData;
}
Aggregations