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;
}
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;
}
Aggregations