use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.
the class DeleteAction method doRun.
@Override
protected void doRun() {
super.doRun();
List<IRepositoryNode> remainNodes = getRemainNodes();
if (!remainNodes.isEmpty()) {
for (IRepositoryNode node : remainNodes) {
IRepositoryViewObject viewObj = node.getObject();
if (viewObj instanceof FolderRepositoryObject) {
removeFolderObject(viewObj);
} else {
removeServerObject(viewObj);
}
}
}
commonViewer.refresh();
}
use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.
the class RepositoryDropAssistant method validate.
public boolean validate(int operation, IRepositoryViewObject dragViewObj, IRepositoryViewObject dropViewObj) {
if (dragViewObj == null || dropViewObj == null) {
return false;
}
//
if (dragViewObj instanceof FolderRepositoryObject) {
return false;
}
ERepositoryObjectType dragType = dragViewObj.getRepositoryObjectType();
// can't support job object
if (dragType == ERepositoryObjectType.PROCESS) {
return false;
}
if (dropViewObj instanceof FolderRepositoryObject) {
if (((ContainerItem) dropViewObj.getProperty().getItem()).getType().getValue() == FolderType.STABLE_SYSTEM_FOLDER) {
return false;
}
} else {
return false;
}
// can't move to self folder
if (operation == DND.DROP_MOVE) {
IRepositoryViewObject dragParent = getParentRepositoryViewObject(dragViewObj);
if (dragParent.equals(dropViewObj)) {
return false;
}
}
// can't move/copy to different node folder
ERepositoryObjectType dropType = dropViewObj.getRepositoryObjectType();
if (dragType != null && !dragType.equals(dropType)) {
return false;
}
if (dragType == IServerObjectRepositoryType.TYPE_VIEW) {
boolean viewValid = validateForView(dragViewObj, dropViewObj);
return viewValid;
}
if (dragType == IServerObjectRepositoryType.TYPE_TRANSFORMERV2) {
boolean processValid = validateForProcess(dragViewObj, dropViewObj);
return processValid;
}
return true;
}
use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.
the class AbstractBridgeRepositoryAction method refreshParentContainer.
protected void refreshParentContainer() {
Object object = getSelectedObject().get(0);
if (object instanceof IRepositoryViewObject) {
IRepositoryViewObject parent = ContainerCacheService.getParent((IRepositoryViewObject) object);
if (parent != null && parent instanceof FolderRepositoryObject) {
commonViewer.refresh(parent);
commonViewer.expandToLevel(parent, 1);
}
}
}
use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method addChildrenToNode.
/**
* convert viewObj's children to RepositoryNode type and add to node as its children
*
* @param viewObj
* @param node RepositoryNode Object corresponding to viewObj
*/
private static void addChildrenToNode(IRepositoryViewObject viewObj, RepositoryNode node) {
if (viewObj instanceof FolderRepositoryObject) {
List<IRepositoryViewObject> children = findViewObjects(viewObj.getRepositoryObjectType(), viewObj.getProperty().getItem());
if (children != null && children.size() > 0) {
for (IRepositoryViewObject child : children) {
RepositoryNode convertToNode = convertToNode(child);
convertToNode.setParent(node);
node.getChildren().add(convertToNode);
}
}
}
}
use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method createDeletedFolderViewObject.
public static FolderRepositoryObject createDeletedFolderViewObject(ERepositoryObjectType type, String path, String folderName, FolderRepositoryObject parentConObj) {
Property prop = PropertiesFactory.eINSTANCE.createProperty();
prop.setId(EcoreUtil.generateUUID());
//
ContainerItem item = MdmpropertiesFactory.eINSTANCE.createContainerItem();
item.setType(FolderType.FOLDER_LITERAL);
item.setLabel(folderName);
item.setRepObjType(type);
ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
itemState.setPath(path);
item.setState(itemState);
//
prop.setItem(item);
prop.setLabel(folderName);
itemState.setDeleted(true);
FolderRepositoryObject containerRepositoryObject = new FolderRepositoryObject(prop);
// update cache
ContainerCacheService.putContainer(containerRepositoryObject);
//
parentConObj.getChildren().add(containerRepositoryObject);
return containerRepositoryObject;
}
Aggregations