Search in sources :

Example 1 with FolderType

use of org.talend.core.model.properties.FolderType in project tmdm-studio-se by Talend.

the class ContainerItemImpl method setType.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setType(FolderType newType) {
    FolderType oldType = type;
    type = newType == null ? TYPE_EDEFAULT : newType;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, MdmpropertiesPackage.CONTAINER_ITEM__TYPE, oldType, type));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) FolderType(org.talend.core.model.properties.FolderType)

Example 2 with FolderType

use of org.talend.core.model.properties.FolderType 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 3 with FolderType

use of org.talend.core.model.properties.FolderType in project tmdm-studio-se by Talend.

the class RepositoryResourceUtil method convertToNode.

public static RepositoryNode convertToNode(IRepositoryViewObject viewObj) {
    Item item = viewObj.getProperty().getItem();
    ENodeType type = ENodeType.REPOSITORY_ELEMENT;
    if (item instanceof ContainerItem) {
        FolderType folderType = ((ContainerItem) item).getType();
        switch(folderType.getValue()) {
            case FolderType.SYSTEM_FOLDER:
                type = ENodeType.SYSTEM_FOLDER;
                break;
            case FolderType.STABLE_SYSTEM_FOLDER:
                type = ENodeType.STABLE_SYSTEM_FOLDER;
                break;
            case FolderType.FOLDER:
                type = ENodeType.SIMPLE_FOLDER;
                break;
            default:
                break;
        }
    }
    ERepositoryObjectType repObjType = viewObj.getRepositoryObjectType();
    RepositoryNode node = new MDMRepositoryNode(viewObj, null, type);
    node.setProperties(EProperties.LABEL, viewObj.getLabel());
    node.setProperties(EProperties.CONTENT_TYPE, repObjType);
    addChildrenToNode(viewObj, node);
    return node;
}
Also used : ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) TDQMatchRuleItem(org.talend.dataquality.properties.TDQMatchRuleItem) WorkspaceRootItem(org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem) Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) MDMRepositoryNode(org.talend.mdm.repository.core.bridge.MDMRepositoryNode) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) RepositoryNode(org.talend.repository.model.RepositoryNode) MDMRepositoryNode(org.talend.mdm.repository.core.bridge.MDMRepositoryNode) FolderType(org.talend.core.model.properties.FolderType)

Example 4 with FolderType

use of org.talend.core.model.properties.FolderType in project tmdm-studio-se by Talend.

the class TISProcessActionProvider method getActions.

@Override
public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj) {
    List<AbstractRepositoryAction> actions = super.getActions(viewObj);
    Item item = viewObj.getProperty().getItem();
    if (item instanceof ContainerItem) {
        FolderType type = ((FolderItem) item).getType();
        switch(type.getValue()) {
            case FolderType.SYSTEM_FOLDER:
                addAction(actions, createProcessAction, viewObj);
                break;
            case FolderType.STABLE_SYSTEM_FOLDER:
                break;
            case FolderType.FOLDER:
                addAction(actions, createProcessAction, viewObj);
                addAction(actions, renameFolderAction, viewObj);
                addAction(actions, deleteAction, viewObj);
                break;
        }
    } else if (item instanceof ProcessItem) {
        addAction(actions, editProcessAction, viewObj);
        addAction(actions, readProcessAction, viewObj);
        addAction(actions, runProcessAction, viewObj);
        addAction(actions, openExistVersionProcessAction, viewObj);
        addAction(actions, editPropAction, viewObj);
        addAction(actions, deleteAction, viewObj);
        addAction(actions, generateTransformerAction, viewObj);
        addAction(actions, generateTriggerAction, viewObj);
        // deploy
        actions.add(deployToAction);
        addAction(actions, deployToLastServerAction, viewObj);
        addAction(actions, deployAnotherToAction, viewObj);
        addAction(actions, undeployAction, viewObj);
    }
    actions.add(deployAllAction);
    return actions;
}
Also used : AbstractRepositoryAction(org.talend.mdm.repository.core.AbstractRepositoryAction) ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) FolderItem(org.talend.core.model.properties.FolderItem) ProcessItem(org.talend.core.model.properties.ProcessItem) FolderType(org.talend.core.model.properties.FolderType)

Example 5 with FolderType

use of org.talend.core.model.properties.FolderType in project tmdm-studio-se by Talend.

the class RepositoryResourceUtilTest method testConvertToNode.

@Test
public void testConvertToNode() throws Exception {
    IRepositoryViewObject mockViewObject = mock(IRepositoryViewObject.class);
    Property mockProperty = mock(Property.class);
    ContainerItem mockContainerItem = mock(ContainerItem.class);
    when(mockViewObject.getProperty()).thenReturn(mockProperty);
    when(mockViewObject.getLabel()).thenReturn("mockViewObjectLabel");
    when(mockProperty.getItem()).thenReturn(mockContainerItem);
    int[] folderType = { FolderType.SYSTEM_FOLDER, FolderType.STABLE_SYSTEM_FOLDER, FolderType.FOLDER };
    ENodeType[] enodeType = { ENodeType.SYSTEM_FOLDER, ENodeType.STABLE_SYSTEM_FOLDER, ENodeType.SIMPLE_FOLDER };
    int randomInt = RandomUtils.nextInt() % 3;
    FolderType fType = mock(FolderType.class);
    // when(fType.getValue()).thenReturn(folderType[randomInt]);
    PowerMockito.stub(PowerMockito.method(FolderType.class, "getValue")).toReturn(folderType[randomInt]);
    when(mockContainerItem.getType()).thenReturn(fType);
    ERepositoryObjectType mockType = mock(ERepositoryObjectType.class);
    when(mockViewObject.getRepositoryObjectType()).thenReturn(mockType);
    RepositoryNode node = RepositoryResourceUtil.convertToNode(mockViewObject);
    assertNotNull(node);
    assertEquals(enodeType[randomInt], node.getType());
    assertEquals("mockViewObjectLabel", node.getProperties(EProperties.LABEL));
    assertEquals(mockType, node.getProperties(EProperties.CONTENT_TYPE));
}
Also used : ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) RepositoryNode(org.talend.repository.model.RepositoryNode) Property(org.talend.core.model.properties.Property) FolderType(org.talend.core.model.properties.FolderType) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

FolderType (org.talend.core.model.properties.FolderType)8 ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)6 Item (org.talend.core.model.properties.Item)5 FolderItem (org.talend.core.model.properties.FolderItem)3 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 AbstractRepositoryAction (org.talend.mdm.repository.core.AbstractRepositoryAction)2 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)2 WorkspaceRootItem (org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem)2 ENodeType (org.talend.repository.model.IRepositoryNode.ENodeType)2 RepositoryNode (org.talend.repository.model.RepositoryNode)2 LinkedList (java.util.LinkedList)1 BusinessProcessItem (org.talend.core.model.properties.BusinessProcessItem)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 Property (org.talend.core.model.properties.Property)1 TDQMatchRuleItem (org.talend.dataquality.properties.TDQMatchRuleItem)1 IRepositoryNodeActionProvider (org.talend.mdm.repository.core.IRepositoryNodeActionProvider)1