use of org.talend.core.repository.model.ProxyRepositoryFactory in project tesb-studio-se by Talend.
the class KarafJavaScriptForESBWithMavenManager method analysisMavenModule.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void analysisMavenModule(Item item) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
ICamelDesignerCoreService camelService = (ICamelDesignerCoreService) GlobalServiceRegister.getDefault().getService(ICamelDesignerCoreService.class);
if (camelService.isInstanceofCamelRoutes(item)) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
List<String> mavenModules = getMavenModules();
mavenModules.clear();
talendJobsMap.clear();
EList nodes = ((CamelProcessItem) item).getProcess().getNode();
for (NodeType node : (List<NodeType>) nodes) {
if ("cTalendJob".equals(node.getComponentName())) {
// $NON-NLS-1$
String talendJobId = null;
String talendJobVersion = null;
String talendJobContextGroup = null;
EList elementParameters = node.getElementParameter();
for (ElementParameterType paramType : (List<ElementParameterType>) elementParameters) {
if ("SELECTED_JOB_NAME:PROCESS_TYPE_PROCESS".equals(paramType.getName())) {
// $NON-NLS-1$
talendJobId = ProcessUtils.getPureItemId(paramType.getValue());
} else if ("SELECTED_JOB_NAME:PROCESS_TYPE_VERSION".equals(paramType.getName())) {
// $NON-NLS-1$
talendJobVersion = paramType.getValue();
} else if ("SELECTED_JOB_NAME:PROCESS_TYPE_CONTEXT".equals(paramType.getName())) {
// $NON-NLS-1$
talendJobContextGroup = paramType.getValue();
}
if (talendJobId != null && talendJobVersion != null && talendJobContextGroup != null) {
// found
break;
}
}
if (talendJobId != null) {
if (talendJobVersion == null) {
talendJobVersion = RelationshipItemBuilder.LATEST_VERSION;
}
if (talendJobContextGroup == null) {
talendJobContextGroup = IContext.DEFAULT;
}
IRepositoryViewObject foundObject = null;
try {
if (RelationshipItemBuilder.LATEST_VERSION.equals(talendJobVersion)) {
foundObject = factory.getLastVersion(talendJobId);
} else {
// find out the fixing version
List<IRepositoryViewObject> allVersionObjects = factory.getAllVersion(talendJobId);
if (allVersionObjects != null) {
for (IRepositoryViewObject obj : allVersionObjects) {
if (obj.getVersion().equals(talendJobVersion)) {
foundObject = obj;
break;
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
if (foundObject != null) {
Property property = foundObject.getProperty();
if (property != null) {
talendJobsMap.put(talendJobId, foundObject);
talendJobContextGroupsMap.put(talendJobId, talendJobContextGroup);
// we do not export the referenced jobs literally,
// but get them for build from the Maven repository.
// Thus, we must not add module declarations for them.
// mavenModules.add(TALEND_JOBS_PATH + property.getLabel());
}
}
}
}
}
}
}
}
use of org.talend.core.repository.model.ProxyRepositoryFactory in project tmdm-studio-se by Talend.
the class JobResourceListener method removeLastServerInfo.
private void removeLastServerInfo(Item item) {
Property property = item.getProperty();
EMap additionalProperties = property.getAdditionalProperties();
if (additionalProperties != null && additionalProperties.containsKey(RepositoryResourceUtil.PROP_LAST_SERVER_DEF)) {
RepositoryResourceUtil.setLastServerDef(item, null);
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
try {
item = RepositoryResourceUtil.assertItem(item);
factory.save(item, true);
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
}
}
Aggregations