Search in sources :

Example 31 with FolderRepositoryObject

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();
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 32 with FolderRepositoryObject

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;
}
Also used : ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 33 with FolderRepositoryObject

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);
        }
    }
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 34 with FolderRepositoryObject

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);
            }
        }
    }
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryNode(org.talend.repository.model.RepositoryNode) MDMRepositoryNode(org.talend.mdm.repository.core.bridge.MDMRepositoryNode) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 35 with FolderRepositoryObject

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;
}
Also used : ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) ItemState(org.talend.core.model.properties.ItemState) Property(org.talend.core.model.properties.Property) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Aggregations

FolderRepositoryObject (org.talend.mdm.repository.models.FolderRepositoryObject)37 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)32 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)16 ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)14 ArrayList (java.util.ArrayList)7 Item (org.talend.core.model.properties.Item)7 Property (org.talend.core.model.properties.Property)7 PersistenceException (org.talend.commons.exception.PersistenceException)6 ItemState (org.talend.core.model.properties.ItemState)6 TreeItem (org.eclipse.swt.widgets.TreeItem)5 LinkedList (java.util.LinkedList)4 Project (org.talend.core.model.general.Project)4 RepositoryViewObject (org.talend.core.model.repository.RepositoryViewObject)4 IProject (org.eclipse.core.resources.IProject)3 Path (org.eclipse.core.runtime.Path)3 FolderItem (org.talend.core.model.properties.FolderItem)3 WSRootRepositoryObject (org.talend.mdm.repository.models.WSRootRepositoryObject)3 List (java.util.List)2 Matcher (java.util.regex.Matcher)2 IFolder (org.eclipse.core.resources.IFolder)2