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));
}
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;
}
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;
}
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;
}
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));
}
Aggregations