use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.
the class AbstractRemoveCommandStackAction method removeFolderObject.
private void removeFolderObject(FolderRepositoryObject viewObj) {
Project project = ProjectManager.getInstance().getCurrentProject();
ContainerItem containerItem = (ContainerItem) viewObj.getProperty().getItem();
String path = containerItem.getState().getPath();
ERepositoryObjectType repObjType = containerItem.getRepObjType();
// ContainerCacheService.removeContainer(repObjType, path);
for (IRepositoryViewObject childObj : viewObj.getChildren()) {
if (childObj instanceof FolderRepositoryObject) {
removeFolderObject((FolderRepositoryObject) childObj);
} else {
removeServerObject(childObj);
}
}
try {
factory.deleteFolder(project, repObjType, new Path(path), false);
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
}
use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.
the class ContainerCacheService method putContainer.
public static void putContainer(IRepositoryViewObject viewObj) {
Item item = viewObj.getProperty().getItem();
if (item instanceof ContainerItem) {
ERepositoryObjectType repObjType = ((ContainerItem) item).getRepObjType();
Map<String, IRepositoryViewObject> map = containerMap.get(repObjType);
if (map == null) {
map = new HashMap<String, IRepositoryViewObject>();
containerMap.put(repObjType, map);
}
//
String path = correctPath(item.getState().getPath());
map.put(path, viewObj);
}
}
use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.
the class ContainerCacheService method getParent.
public static IRepositoryViewObject getParent(IRepositoryViewObject obj) {
ERepositoryObjectType type = obj.getRepositoryObjectType();
Item item = obj.getProperty().getItem();
String path = item.getState().getPath();
if (item instanceof ContainerItem) {
if (path.length() > 1) {
int pos = path.lastIndexOf(DIVIDE);
if (pos >= 0) {
path = path.substring(0, pos);
}
} else {
return null;
}
}
return get(type, path);
}
use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.
the class AbstractContentProvider method getChildren.
public Object[] getChildren(Object element) {
Item item = RepositoryResourceUtil.getItemFromRepViewObj(element);
if (item != null && item instanceof ContainerItem) {
ContainerItem containerItem = (ContainerItem) item;
// recycle
if (RepositoryResourceUtil.isDeletedFolder(item, ((IRepositoryViewObject) element).getRepositoryObjectType())) {
AbstractContentProvider recycleContentProvider = (AbstractContentProvider) RepositoryNodeConfigurationManager.getRecycleBinNodeConfiguration().getContentProvider();
return recycleContentProvider.getChildren(element);
}
//
FolderType containerType = containerItem.getType();
List<IRepositoryViewObject> children = ((FolderRepositoryObject) element).getChildren();
if (containerType == FolderType.SYSTEM_FOLDER_LITERAL) {
List<IRepositoryViewObject> viewObjects = getViewObjFromSystemFolder(containerItem);
if (viewObjects != null) {
children.clear();
children.addAll(viewObjects);
return viewObjects.toArray();
}
}
if (containerType == FolderType.FOLDER_LITERAL || containerType == FolderType.STABLE_SYSTEM_FOLDER_LITERAL) {
List<IRepositoryViewObject> viewObjects = getViewObjFromFolder(containerItem);
if (viewObjects != null) {
children.clear();
children.addAll(viewObjects);
return viewObjects.toArray();
}
}
// if (containerType == FolderType.STABLE_SYSTEM_FOLDER_LITERAL) {
// List<IRepositoryViewObject> children = ((ContainerRepositoryObject) element).getChildren();
// if (children != null) {
// return children.toArray();
// }
// }
}
return new Object[0];
}
use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.
the class ViewActionProvider method getActions.
@Override
public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj) {
List<AbstractRepositoryAction> actions = super.getActions(viewObj);
Item item = viewObj.getProperty().getItem();
String path = item.getState().getPath();
if (path.isEmpty()) {
actions.remove(createFolderAction);
}
if ((item instanceof ContainerItem) && (path.equals(IPath.SEPARATOR + IViewNodeConstDef.PATH_SEARCHFILTER) || path.equals(IPath.SEPARATOR + IViewNodeConstDef.PATH_WEBFILTER))) {
actions.remove(removeFromRepositoryAction);
}
if (RepositoryResourceUtil.hasContainerItem(viewObj, FolderType.SYSTEM_FOLDER_LITERAL, FolderType.FOLDER_LITERAL)) {
addAction(actions, addAction, viewObj);
}
if (viewObj.getProperty().getItem() instanceof MDMServerObjectItem) {
int index = actions.indexOf(mdmEditPropertyAction);
if (index != -1) {
actions.add(index, editViewProcessPropertyAction);
actions.remove(mdmEditPropertyAction);
}
addAction(actions, renameViewAction, viewObj);
addAction(actions, browseViewAction, viewObj);
// deploy
addAction(actions, deployToAction, viewObj);
addAction(actions, deployToLastServerAction, viewObj);
addAction(actions, deployAnotherToAction, viewObj);
addAction(actions, undeployAction, viewObj);
}
addAction(actions, deployAllAction, viewObj);
return actions;
}
Aggregations