use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class DataModelMainPage2 method doSave.
@Override
protected void doSave(WSDataModel wsObject) throws Exception {
XObjectEditorInput2 editorInput = (XObjectEditorInput2) getEditorInput();
MDMServerObjectItem serverObjectItem = (MDMServerObjectItem) editorInput.getInputItem();
//
updateSchemaToItem(serverObjectItem);
xsdSchema = ((SchemaTreeContentProvider) viewer.getContentProvider()).getXsdSchema();
Item newItem = RepositoryResourceUtil.assertItem(serverObjectItem);
if (newItem != serverObjectItem) {
editorInput.updateViewObject(ContainerCacheService.get(newItem.getProperty()));
getEditorSite();
serverObjectItem = (MDMServerObjectItem) newItem;
}
EObject eObj = Bean2EObjUtil.getInstance().convertFromBean2EObj(wsObject, serverObjectItem.getMDMServerObject());
if (eObj != null) {
RepositoryResourceUtil.saveItem(serverObjectItem);
}
refreshDirtyCue();
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class RenameViewAction method renameViewObject.
private void renameViewObject(IRepositoryViewObject viewObj) {
MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
MDMServerObject serverObject = item.getMDMServerObject();
IProxyRepositoryFactory factory = getFactory();
try {
if (serverObject != null) {
String oldName = serverObject.getName();
RenameViewDialog dialog = getRenameDialog(oldName);
int returnCode = dialog.open();
if (returnCode == IDialogConstants.OK_ID) {
String newName = dialog.getValue();
if (RepositoryTransformUtil.getInstance().getViewType(oldName) == TYPE_WEBFILTER) {
newName = PREFIX_VIEW_UPPER + newName;
} else {
if (newName.startsWith(PREFIX_VIEW_UPPER)) {
viewTypeChanged = true;
item.getState().setPath(IPath.SEPARATOR + PATH_WEBFILTER);
}
}
if (newName != null && factory.isEditableAndLockIfPossible(item)) {
serverObject.setName(newName);
viewObj.getProperty().setLabel(newName);
viewObj.getProperty().setDisplayName(newName);
factory.save(viewObj.getProperty().getItem(), false);
MDMServerDef lastServerDef = RepositoryResourceUtil.getLastServerDef(viewObj);
if (lastServerDef != null) {
CommandManager.getInstance().pushCommand(ICommand.CMD_RENAME, viewObj.getId(), new String[] { oldName, newName });
}
}
commonViewer.refresh(viewObj);
}
}
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
} finally {
try {
factory.unlock(item);
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
} catch (LoginException e) {
log.error(e.getMessage(), e);
}
}
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class ConsistencyService method updateDigestValue.
public void updateDigestValue(MDMServerDef serverDef, IRepositoryViewObject viewObj) throws XtentisException {
Item item = viewObj.getProperty().getItem();
if (item instanceof MDMServerObjectItem) {
TMDMService service = RepositoryWebServiceAdapter.getMDMService(serverDef);
updateLocalDigestValue(viewObj);
// key
String type = viewObj.getRepositoryObjectType().getKey();
String objectName = getObjectName(viewObj);
WSDigestKey key = new WSDigestKey(objectName, type);
// value
WSDigest value = new WSDigest(getLocalDigestValue(item), 0L, key);
WSLong timeValue = service.updateDigest(value);
//
if (timeValue != null) {
updateLocalTimestamp(item, timeValue.getValue());
}
if (!viewObj.getRepositoryObjectType().equals(IServerObjectRepositoryType.TYPE_MATCH_RULE_MAPINFO)) {
item = RepositoryResourceUtil.assertItem(item);
Property property = item.getProperty();
boolean eDeliver = property.eDeliver();
property.eSetDeliver(false);
RepositoryResourceUtil.saveItem(item);
property.eSetDeliver(eDeliver);
}
}
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class AbstractLabelProvider method getDescription.
public String getDescription(Object anElement) {
if (anElement instanceof IRepositoryViewObject) {
Property property = ((IRepositoryViewObject) anElement).getProperty();
Item item = property.getItem();
if (item instanceof MDMServerObjectItem) {
String label = getServerObjectItemText(item);
if (label != null) {
return label;
}
}
String label = property.getLabel();
return label;
}
return null;
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class AbstractLabelProvider method getServerObjectItemText.
protected String getServerObjectItemText(Item item) {
item = RepositoryResourceUtil.assertItem(item);
MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
if (serverObject != null) {
return serverObject.getName();
}
return null;
}
Aggregations