Search in sources :

Example 36 with FolderRepositoryObject

use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.

the class RepositoryResourceUtil method adapt2ResourceElement.

public static Object[] adapt2ResourceElement(IRepositoryViewObject viewObj) {
    if (viewObj == null) {
        return null;
    }
    try {
        if (viewObj instanceof WSRootRepositoryObject) {
            Project project = ProjectManager.getInstance().getCurrentProject();
            IProject prj = ResourceUtils.getProject(project);
            return new Object[] { prj };
        } else {
            ERepositoryObjectType type = viewObj.getRepositoryObjectType();
            if (viewObj instanceof FolderRepositoryObject) {
                if (type == IServerObjectRepositoryType.TYPE_EVENTMANAGER) {
                    return new Object[] { getFolder(IServerObjectRepositoryType.TYPE_TRANSFORMERV2), getFolder(IServerObjectRepositoryType.TYPE_ROUTINGRULE) };
                } else {
                    return new Object[] { getFolder(viewObj) };
                }
            } else {
                Item item = viewObj.getProperty().getItem();
                // $NON-NLS-1$
                IFile itemFile = findReferenceFile(type, item, "item");
                if (type == IServerObjectRepositoryType.TYPE_DATAMODEL) {
                    // $NON-NLS-1$
                    IFile xsdFile = findReferenceFile(type, item, "xsd");
                    return new Object[] { xsdFile, itemFile };
                } else if (type == IServerObjectRepositoryType.TYPE_WORKFLOW) {
                    // $NON-NLS-1$
                    IFile configFile = findReferenceFile(type, item, "conf");
                    return new Object[] { configFile };
                } else {
                    return new Object[] { itemFile };
                }
            }
        }
    } catch (PersistenceException e) {
        log.error(e.getMessage(), e);
    }
    return null;
}
Also used : IProject(org.eclipse.core.resources.IProject) Project(org.talend.core.model.general.Project) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) TDQMatchRuleItem(org.talend.dataquality.properties.TDQMatchRuleItem) WorkspaceRootItem(org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem) Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IFile(org.eclipse.core.resources.IFile) PersistenceException(org.talend.commons.exception.PersistenceException) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryObject(org.talend.core.model.repository.RepositoryObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) WSRootRepositoryObject(org.talend.mdm.repository.models.WSRootRepositoryObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IProject(org.eclipse.core.resources.IProject) WSRootRepositoryObject(org.talend.mdm.repository.models.WSRootRepositoryObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 37 with FolderRepositoryObject

use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.

the class RepositoryResourceUtil method getCategoryViewObject.

public static IRepositoryViewObject getCategoryViewObject(IRepositoryNodeConfiguration conf) {
    Property prop = PropertiesFactory.eINSTANCE.createProperty();
    prop.setId(EcoreUtil.generateUUID());
    // 
    ContainerItem item = MdmpropertiesFactory.eINSTANCE.createContainerItem();
    item.setType(FolderType.SYSTEM_FOLDER_LITERAL);
    ERepositoryObjectType type = conf.getResourceProvider().getRepositoryObjectType(item);
    if (type == null) {
        return null;
    }
    item.setRepObjType(type);
    ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
    itemState.setDeleted(false);
    // $NON-NLS-1$
    itemState.setPath("");
    item.setState(itemState);
    item.setLabel(conf.getLabelProvider().getCategoryLabel(item.getRepObjType()));
    // 
    prop.setItem(item);
    // 
    FolderRepositoryObject containerObject = new FolderRepositoryObject(prop);
    ContainerCacheService.putContainer(containerObject);
    return containerObject;
}
Also used : ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) ItemState(org.talend.core.model.properties.ItemState) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) 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