use of org.talend.core.ui.documentation.generation.InternalNodeComponentHandler in project tdi-studio-se by Talend.
the class HTMLDocGenerator method handleXMLFile.
/**
* Generates the xml file base on an instance of <code>ExportFileResource</code> and the temporary folder path.
*
* @param resource
* @param tempFolderPath
* @param version
*/
private void handleXMLFile(ExportFileResource resource, String tempFolderPath, String... version) throws Exception {
Item item = resource.getItem();
// Check if generate Job Extra / Stats&Logs Setting Info
if (item instanceof ProcessItem) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMRProcessService.class)) {
IMRProcessService mrProcessService = (IMRProcessService) GlobalServiceRegister.getDefault().getService(IMRProcessService.class);
generateExtraSetting = !mrProcessService.isMapReduceItem(item);
generateStatsLogsSetting = generateExtraSetting;
} else if (isRouteProcess(item)) {
generateStatsLogsSetting = generateExtraSetting = !isRouteProcess(item);
}
} else if (item instanceof JobletProcessItem) {
generateStatsLogsSetting = false;
}
targetConnectionMap = new HashMap<String, List>();
sourceConnectionMap = new HashMap<String, List>();
getSourceAndTargetConnection(item);
Document document = DocumentHelper.createDocument();
Element projectElement = generateProjectInfo(document);
Element jobElement = generateJobInfo(item, projectElement, version);
// This two element see feature 4162
generateContextInfo(item, jobElement);
generateJobSettingInfo(item, jobElement);
List<List> allList = seperateNodes(item);
if (allList == null || allList.size() != 3) {
return;
}
List<INode> allComponentsList = allList.get(0);
List<INode> internalNodeComponentsList = allList.get(1);
List<INode> externalNodeComponentsList = allList.get(2);
if (allComponentsList.size() > 0) {
// Generates information for 'Component List' part in exported HTML file.
generateAllComponentsSummaryInfo(item, jobElement, allComponentsList);
}
//$NON-NLS-1$
Element internalNodeElement = jobElement.addElement("internalNodeComponents");
//$NON-NLS-1$
Element externalNodeElement = jobElement.addElement("externalNodeComponents");
if (internalNodeComponentsList.size() > 0) {
InternalNodeComponentHandler internalNodeComponentHandler = new InternalNodeComponentHandler(this.picFilePathMap, internalNodeElement, internalNodeComponentsList, this.sourceConnectionMap, this.targetConnectionMap, this.designerCoreService, this.repositoryConnectionItemMap, this.repositoryDBIdAndNameMap, externalNodeHTMLMap);
// Generates internal node components information.
internalNodeComponentHandler.generateComponentInfo();
}
if (externalNodeComponentsList.size() > 0) {
ExternalNodeComponentHandler externalNodeComponentHandler = new ExternalNodeComponentHandler(this.picFilePathMap, externalNodeElement, externalNodeComponentsList, this.sourceConnectionMap, this.targetConnectionMap, this.designerCoreService, this.repositoryConnectionItemMap, this.repositoryDBIdAndNameMap, externalNodeHTMLMap);
// Generates external node components(tMap etc.) information.
externalNodeComponentHandler.generateComponentInfo();
}
// Generates all connection information(include internal node and external node).
EList connectionList = null;
if (item instanceof ProcessItem) {
connectionList = ((ProcessItem) item).getProcess().getConnection();
} else if (item instanceof JobletProcessItem) {
connectionList = (((JobletProcessItem) item).getJobletProcess().getConnection());
}
if (connectionList != null && connectionList.size() != 0) {
generateConnectionsInfo(jobElement, connectionList);
}
//$NON-NLS-1$
String versionPath = "_";
if (version != null && version.length == 1) {
versionPath = versionPath + version[0];
} else {
versionPath = versionPath + item.getProperty().getVersion();
}
String filePath = tempFolderPath + File.separatorChar + item.getProperty().getLabel() + versionPath + IHTMLDocConstants.XML_FILE_SUFFIX;
// This element see feature 4382
if (item instanceof ProcessItem) {
generateSourceCodeInfo((ProcessItem) item, jobElement);
}
XMLHandler.generateXMLFile(tempFolderPath, filePath, document);
}
Aggregations