use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class MdmPropertiesWizard method performFinish.
@Override
public boolean performFinish() {
if (alreadyEditedByUser) {
return false;
}
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
Item item = object.getProperty().getItem();
String newName = object.getLabel();
MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
if (serverObject != null) {
String oldName = serverObject.getName();
try {
if (newName != null && factory.isEditableAndLockIfPossible(item)) {
serverObject.setName(newName);
item = RepositoryResourceUtil.assertItem(item);
factory.save(item, false);
MDMServerDef lastServerDef = RepositoryResourceUtil.getLastServerDef(item);
if (!oldName.equals(newName) && lastServerDef != null) {
CommandManager.getInstance().pushCommand(ICommand.CMD_RENAME, object.getId(), new String[] { oldName, newName });
}
}
} catch (PersistenceException e) {
MessageBoxExceptionHandler.process(e);
return false;
} finally {
try {
factory.unlock(item);
} catch (PersistenceException e) {
MessageBoxExceptionHandler.process(e);
return false;
} catch (LoginException e) {
MessageBoxExceptionHandler.process(e);
return false;
}
}
}
return true;
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class ViewBrowserInput method init.
protected void init(Item item) {
MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
Object treeObject = Bean2EObjUtil.getInstance().wrapEObjWithTreeObject(serverObject);
setModel(treeObject);
setName(serverObject.getName());
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class XObjectBrowserInput2 method init.
protected void init(Item item) {
MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
Object treeObject = Bean2EObjUtil.getInstance().wrapEObjWithTreeObject(serverObject);
setModel(treeObject);
setName(serverObject.getName());
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class XObjectEditorInput2 method init.
protected void init(Item item) {
MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
Object treeObject = Bean2EObjUtil.getInstance().wrapEObjWithTreeObject(serverObject);
setModel(treeObject);
setName(serverObject.getName());
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class ConsistencyServiceTest method testGetLocalDigestValue.
@Test
public void testGetLocalDigestValue() {
assertNull(ConsistencyService.getInstance().getLocalDigestValue(null));
// $NON-NLS-1$
String localDigestValue = "local_digest_value_0123";
MDMServerObject mockMDMServerObj = Mockito.mock(MDMServerObject.class);
Mockito.when(mockMDMServerObj.getDigestValue()).thenReturn(localDigestValue);
MDMServerObjectItem mockItem = Mockito.mock(MDMServerObjectItem.class);
Mockito.when(mockItem.getMDMServerObject()).thenReturn(mockMDMServerObj);
//
assertEquals(localDigestValue, ConsistencyService.getInstance().getLocalDigestValue(mockItem));
EMap mockProperties = Mockito.mock(EMap.class);
// $NON-NLS-1$
Mockito.when(mockProperties.get(eq("digestValue"))).thenReturn(localDigestValue);
Property mockProperty = Mockito.mock(Property.class);
Mockito.when(mockProperty.getAdditionalProperties()).thenReturn(mockProperties);
ProcessItem mockProcessItem = Mockito.mock(ProcessItem.class);
Mockito.when(mockProcessItem.getProperty()).thenReturn(mockProperty);
//
assertEquals(localDigestValue, ConsistencyService.getInstance().getLocalDigestValue(mockProcessItem));
}
Aggregations