use of org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem 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.mdm.repository.model.mdmproperties.WorkspaceRootItem in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method assertItem.
public static Item assertItem(Item item) {
if (item == null) {
throw new IllegalArgumentException();
}
if (item instanceof WorkspaceRootItem) {
return item;
}
Property property = item.getProperty();
if (property != null) {
Resource eResource = item.eResource();
if (eResource == null || eResource.getResourceSet() == null) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
try {
IRepositoryViewObject newViewObj = factory.getLastVersion(property.getId());
property = newViewObj.getProperty();
if (property != null) {
eResource = property.getItem().eResource();
if (eResource == null || eResource.getResourceSet() == null) {
property = factory.reload(property);
newViewObj = new RepositoryViewObject(property);
}
}
ContainerCacheService.put(newViewObj);
return newViewObj.getProperty().getItem();
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
}
}
return item;
}
use of org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method getCategoryViewObjectsWithRecycle.
public static IRepositoryViewObject[] getCategoryViewObjectsWithRecycle() {
if (rootViewObj == null) {
//
rootViewObj = null;
Property prop = PropertiesFactory.eINSTANCE.createProperty();
prop.setId(EcoreUtil.generateUUID());
ItemState state = PropertiesFactory.eINSTANCE.createItemState();
WorkspaceRootItem item = MdmpropertiesFactory.eINSTANCE.createWorkspaceRootItem();
item.setState(state);
prop.setItem(item);
rootViewObj = new WSRootRepositoryObject(prop);
//
IRepositoryViewObject[] cvos = getCategoryViewObjects();
List<IRepositoryViewObject> newViewObjs = rootViewObj.getChildren();
for (IRepositoryViewObject viewObj : cvos) {
newViewObjs.add(viewObj);
}
//
newViewObjs.add(getCategoryViewObject(RepositoryNodeConfigurationManager.getRecycleBinNodeConfiguration()));
}
return new IRepositoryViewObject[] { rootViewObj };
}
Aggregations