Search in sources :

Example 11 with MDMServerObject

use of org.talend.mdm.repository.model.mdmserverobject.MDMServerObject in project tmdm-studio-se by Talend.

the class RepositoryProcessesNamesHolder method getExternalInfo.

@Override
public String[] getExternalInfo() {
    List<IRepositoryViewObject> viewObjs = RepositoryResourceUtil.findAllViewObjects(IServerObjectRepositoryType.TYPE_TRANSFORMERV2);
    String[] names = new String[viewObjs.size()];
    int i = 0;
    for (IRepositoryViewObject viewObj : viewObjs) {
        Property prop = viewObj.getProperty();
        if (prop.getItem() instanceof MDMServerObjectItem) {
            MDMServerObject serverObject = ((MDMServerObjectItem) prop.getItem()).getMDMServerObject();
            if (serverObject != null) {
                names[i] = serverObject.getName();
            }
        } else {
            names[i] = prop.getLabel();
        }
        i++;
    }
    return names;
}
Also used : MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Property(org.talend.core.model.properties.Property) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)

Example 12 with MDMServerObject

use of org.talend.mdm.repository.model.mdmserverobject.MDMServerObject 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;
}
Also used : Item(org.talend.core.model.properties.Item) WSResourceItem(org.talend.mdm.repository.model.mdmproperties.WSResourceItem) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) PersistenceException(org.talend.commons.exception.PersistenceException) LoginException(org.talend.commons.exception.LoginException) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 13 with MDMServerObject

use of org.talend.mdm.repository.model.mdmserverobject.MDMServerObject 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());
}
Also used : MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TreeObject(com.amalto.workbench.models.TreeObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)

Example 14 with MDMServerObject

use of org.talend.mdm.repository.model.mdmserverobject.MDMServerObject 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());
}
Also used : MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TreeObject(com.amalto.workbench.models.TreeObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)

Example 15 with MDMServerObject

use of org.talend.mdm.repository.model.mdmserverobject.MDMServerObject 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());
}
Also used : MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TreeObject(com.amalto.workbench.models.TreeObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)

Aggregations

MDMServerObject (org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)37 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)33 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)19 Item (org.talend.core.model.properties.Item)13 TreeObject (com.amalto.workbench.models.TreeObject)11 Property (org.talend.core.model.properties.Property)11 PersistenceException (org.talend.commons.exception.PersistenceException)9 Test (org.junit.Test)7 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)7 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)7 ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)7 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)7 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 LoginException (org.talend.commons.exception.LoginException)6 EObject (org.eclipse.emf.ecore.EObject)5 ArrayList (java.util.ArrayList)4 FolderItem (org.talend.core.model.properties.FolderItem)4 TMDMService (com.amalto.workbench.webservices.TMDMService)3 LinkedList (java.util.LinkedList)3 ItemState (org.talend.core.model.properties.ItemState)3