use of com.amalto.workbench.utils.XtentisException in project tmdm-studio-se by Talend.
the class RepositoryWebServiceAdapter method getMDMService.
public static TMDMService getMDMService(Shell shell, MDMServerDef lastserverDef) {
if (lastserverDef == null) {
MessageDialog.openWarning(null, Messages.Warning_text, Messages.RepositoryWebServiceAdapter_DeployFirst);
return null;
}
SelectServerDefDialog dialog = new SelectServerDefDialog(shell);
dialog.create();
dialog.setSelectServer(lastserverDef);
try {
if (dialog.open() == IDialogConstants.OK_ID) {
MDMServerDef serverDef = dialog.getSelectedServerDef();
TMDMService port = RepositoryWebServiceAdapter.getMDMService(serverDef);
return port;
}
} catch (XtentisException e) {
log.error(e.getMessage(), e);
}
return null;
}
use of com.amalto.workbench.utils.XtentisException in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method getBusinessConceptKey.
public static WSConceptKey getBusinessConceptKey(WSGetBusinessConceptKey businessConcepKey) throws XtentisException {
String pk = businessConcepKey.getWsDataModelPK().getPk();
String concept = businessConcepKey.getConcept();
WSDataModelE dataModel = RepositoryQueryService.findDataModelByName(pk);
if (dataModel != null) {
try {
XSDSchema xsdSchema = Util.getXSDSchema(dataModel.getXsdSchema());
for (XSDIdentityConstraintDefinition idDef : xsdSchema.getIdentityConstraintDefinitions()) {
if (idDef.getName().equals(concept)) {
WSConceptKey key = new WSConceptKey();
//
XSDXPathDefinition selector = idDef.getSelector();
key.setSelector(selector.getValue());
//
EList<XSDXPathDefinition> fields = idDef.getFields();
List<String> keyFields = new ArrayList<String>();
for (XSDXPathDefinition pathDef : fields) {
keyFields.add(pathDef.getValue());
}
key.getFields().clear();
key.getFields().addAll(keyFields);
return key;
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
return null;
}
use of com.amalto.workbench.utils.XtentisException in project tmdm-studio-se by Talend.
the class XSDDeleteConceptAction method checkContainFK.
protected boolean checkContainFK(String fkName) throws Exception {
// add by ymli. fix buy 0010029
Set<String> list = Util.getForeignKeys();
if (list == null) {
TMDMService service = null;
try {
service = Util.getMDMService(page.getXObject());
} catch (XtentisException e) {
log.error(e.getMessage(), e);
}
list = new HashSet<String>();
Util.getForeingKeyInDataModel(list, page.getXObject().getParent(), service);
Util.setForeignKeys(list);
}
return list.contains(fkName);
}
use of com.amalto.workbench.utils.XtentisException 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.utils.XtentisException in project tmdm-studio-se by Talend.
the class ServerDefDialog method buttonPressed.
@Override
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
if (!validateInput()) {
return;
}
updateUI2Model(serverDef);
}
if (buttonId == CHECK_CONNECTION_ID) {
if (!validateInput()) {
return;
}
MDMServerDef tmpServerDef = MdmmetadataFactory.eINSTANCE.createMDMServerDef();
tmpServerDef.setAlgorithm(PasswordUtil.ALGORITHM_COMMON_V2);
updateUI2Model(tmpServerDef);
try {
ServerDefService.checkMDMConnection(tmpServerDef.getDecryptedServerDef());
setMessage(Messages.ServerExplorer_ConnectSuccessful);
} catch (MissingJarsException e) {
return;
} catch (XtentisException e) {
setErrorMessage(Messages.ServerExplorer_ConnectFailed);
} catch (MalformedURLException e) {
setErrorMessage(Messages.ServerExplorer_ConnectFailed);
}
}
super.buttonPressed(buttonId);
}
Aggregations