Search in sources :

Example 1 with MDMItem

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

the class RepositoryNodeActionProviderAdapter method getActions.

@Override
public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj) {
    List<AbstractRepositoryAction> actions = new LinkedList<AbstractRepositoryAction>();
    // 
    Item item = viewObj.getProperty().getItem();
    if (item instanceof MDMItem) {
        if (item instanceof ContainerItem) {
            FolderType type = ((FolderItem) item).getType();
            switch(type.getValue()) {
                case FolderType.SYSTEM_FOLDER:
                    addAction(actions, createFolderAction, viewObj);
                    addAction(actions, pasteAction, viewObj);
                    actions.add(importServerObjectAction);
                    actions.add(importObjectAction);
                    break;
                case FolderType.STABLE_SYSTEM_FOLDER:
                    break;
                case FolderType.FOLDER:
                    addAction(actions, createFolderAction, viewObj);
                    if (!((ContainerItem) item).getRepObjType().equals(ERepositoryObjectType.PROCESS)) {
                        actions.add(removeFromRepositoryAction);
                    }
                    addAction(actions, pasteAction, viewObj);
                    break;
            }
        } else if (item instanceof MDMServerObjectItem) {
            addAction(actions, removeFromRepositoryAction, viewObj);
            addAction(actions, mdmEditPropertyAction, viewObj);
            addAction(actions, openVersionAction, viewObj);
            addAction(actions, copyAction, viewObj);
            addAction(actions, pasteAction, viewObj);
            addAction(actions, duplicateAction, viewObj);
            if (exAdapter != null) {
                exAdapter.addActions(actions, viewObj);
            }
        } else if (item instanceof WorkspaceRootItem) {
            // fix bug TMDM-3168
            actions.add(importObjectAction);
        }
    }
    if (enableDebug) {
        // for debug digestValue
        addAction(actions, debugDigestValueAction, viewObj);
    }
    // 
    actions.add(refreshAction);
    actions.add(exportObjectAction);
    // action provider
    for (IRepositoryNodeActionProvider provider : getExtendActionProviders()) {
        List<AbstractRepositoryAction> providerActions = provider.getActions(viewObj);
        if (providerActions != null) {
            actions.addAll(providerActions);
        }
    }
    if (viewObj.getRepositoryObjectType() != null && IServerObjectRepositoryType.TYPE_EVENTMANAGER.equals(viewObj.getRepositoryObjectType())) {
        actions.add(emAction);
    }
    // 
    return actions;
}
Also used : MDMItem(org.talend.mdm.repository.model.mdmproperties.MDMItem) AbstractRepositoryAction(org.talend.mdm.repository.core.AbstractRepositoryAction) WorkspaceRootItem(org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem) Item(org.talend.core.model.properties.Item) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) FolderItem(org.talend.core.model.properties.FolderItem) MDMItem(org.talend.mdm.repository.model.mdmproperties.MDMItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) WorkspaceRootItem(org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) FolderItem(org.talend.core.model.properties.FolderItem) IRepositoryNodeActionProvider(org.talend.mdm.repository.core.IRepositoryNodeActionProvider) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) LinkedList(java.util.LinkedList) FolderType(org.talend.core.model.properties.FolderType)

Example 2 with MDMItem

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

the class AbstractCommand method init.

@Override
public void init(IRepositoryViewObject viewObj) {
    this.viewObject = viewObj;
    this.commandId = viewObject.getId();
    // 
    Item item = viewObj.getProperty().getItem();
    if (item != null) {
        if (item instanceof MDMServerObjectItem) {
            objName = ((MDMServerObjectItem) item).getMDMServerObject().getName();
            lastName = objName;
        } else if (item instanceof ProcessItem) {
            objName = viewObj.getLabel();
            lastName = objName;
        } else if (item instanceof MDMItem) {
            objName = viewObj.getLabel();
            lastName = objName;
        }
    }
}
Also used : MDMItem(org.talend.mdm.repository.model.mdmproperties.MDMItem) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) MDMItem(org.talend.mdm.repository.model.mdmproperties.MDMItem) ProcessItem(org.talend.core.model.properties.ProcessItem) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)

Aggregations

Item (org.talend.core.model.properties.Item)2 MDMItem (org.talend.mdm.repository.model.mdmproperties.MDMItem)2 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)2 LinkedList (java.util.LinkedList)1 FolderItem (org.talend.core.model.properties.FolderItem)1 FolderType (org.talend.core.model.properties.FolderType)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 AbstractRepositoryAction (org.talend.mdm.repository.core.AbstractRepositoryAction)1 IRepositoryNodeActionProvider (org.talend.mdm.repository.core.IRepositoryNodeActionProvider)1 ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)1 WorkspaceRootItem (org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem)1