use of org.dom4j.Element in project tdi-studio-se by Talend.
the class DbMapComponentDocumentation method generateMapperTablesInfo.
/**
* This method used for generating all mapper tables information into xml file.
*
* @param externalNodeElement
* @param tables
* @param mapperTableType
*/
private void generateMapperTablesInfo(Element externalNodeElement, List<ExternalDbMapTable> tables, String mapperTableType) {
//$NON-NLS-1$
Element mapperTableElement = externalNodeElement.addElement("mapperTable");
//$NON-NLS-1$
mapperTableElement.addAttribute("type", HTMLDocUtils.checkString(mapperTableType));
Element tableElement = null;
for (ExternalDbMapTable table : tables) {
//$NON-NLS-1$
tableElement = mapperTableElement.addElement("table");
generateTableSummaryInfo(mapperTableElement, tableElement, table);
List<ExternalDbMapEntry> metadataTableEntries = table.getMetadataTableEntries();
if (!HTMLDocUtils.checkList(metadataTableEntries)) {
continue;
}
//$NON-NLS-1$
Element metadataTableEntriesElement = tableElement.addElement("metadataTableEntries");
for (ExternalDbMapEntry entry : metadataTableEntries) {
generateTablesEntriesInfo(metadataTableEntriesElement, entry);
}
/**
* generate custom Where clauses conditions entries
*/
List<ExternalDbMapEntry> customWhereConditionsEntries = table.getCustomWhereConditionsEntries();
if (!HTMLDocUtils.checkList(customWhereConditionsEntries)) {
continue;
}
//$NON-NLS-1$
Element customWhereConditionsEntriesElement = tableElement.addElement("customWhereConditionsEntries");
for (ExternalDbMapEntry entry : customWhereConditionsEntries) {
generateTablesEntriesInfo(customWhereConditionsEntriesElement, entry);
}
/**
* generate custom Other clauses conditions entries
*/
List<ExternalDbMapEntry> customOtherConditionsEntries = table.getCustomOtherConditionsEntries();
if (!HTMLDocUtils.checkList(customOtherConditionsEntries)) {
continue;
}
//$NON-NLS-1$
Element customOtherConditionsEntriesElement = tableElement.addElement("customOtherConditionsEntries");
for (ExternalDbMapEntry entry : customOtherConditionsEntries) {
generateTablesEntriesInfo(customOtherConditionsEntriesElement, entry);
}
}
}
use of org.dom4j.Element in project tdi-studio-se by Talend.
the class DbMapComponentDocumentation method generateTablesEntriesInfo.
/**
* Generates metadata tables entries information.
*
* @param metadataTableEntriesElement
* @param entry
*/
private void generateTablesEntriesInfo(Element metadataTableEntriesElement, ExternalDbMapEntry entry) {
//$NON-NLS-1$
Element entryElement = metadataTableEntriesElement.addElement("entry");
//$NON-NLS-1$
entryElement.addAttribute("name", HTMLDocUtils.checkString(entry.getName()));
//$NON-NLS-1$
entryElement.addAttribute("expression", HTMLDocUtils.checkString(entry.getExpression()));
//$NON-NLS-1$
entryElement.addAttribute("operator", HTMLDocUtils.checkString(entry.getOperator()));
//$NON-NLS-1$
entryElement.addAttribute("isJoin", String.valueOf(entry.isJoin()));
}
use of org.dom4j.Element in project tdi-studio-se by Talend.
the class MapperComponentDocumentation method generateTablesEntriesInfo.
/**
* Generates metadata tables entries information.
*
* @param metadataTableEntriesElement
* @param entry
*/
private void generateTablesEntriesInfo(Element metadataTableEntriesElement, ExternalMapperTableEntry entry) {
//$NON-NLS-1$
Element entryElement = metadataTableEntriesElement.addElement("entry");
//$NON-NLS-1$
entryElement.addAttribute("name", HTMLDocUtils.checkString(entry.getName()));
String type = HTMLDocUtils.checkString(entry.getType());
if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.JAVA) && type != "") {
//$NON-NLS-1$
type = JavaTypesManager.getTypeToGenerate(type, entry.isNullable());
}
//$NON-NLS-1$
entryElement.addAttribute("type", type);
//$NON-NLS-1$
entryElement.addAttribute("expression", HTMLDocUtils.checkString(entry.getExpression()));
//$NON-NLS-1$
entryElement.addAttribute("isNullable", String.valueOf(entry.isNullable()));
}
use of org.dom4j.Element in project tdi-studio-se by Talend.
the class MapperComponentDocumentation method generateParameters.
private void generateParameters(Element parametersElement, List elementParameterList) {
List<IElementParameter> copyElementParameterList = new ArrayList(elementParameterList);
if (elementParameterList != null && elementParameterList.size() != 0) {
for (int j = 0; j < elementParameterList.size(); j++) {
IElementParameter elemparameter = (IElementParameter) elementParameterList.get(j);
if ((!elemparameter.isShow(copyElementParameterList) && (!elemparameter.getName().equals(EParameterFieldType.SCHEMA_TYPE.getName()))) || elemparameter.getCategory().equals(EComponentCategory.VIEW) || //$NON-NLS-1$
"ACTIVATE".equals(elemparameter.getName()) || //$NON-NLS-1$
"MAP".equals(elemparameter.getName()) || "PREVIEW".equals(elemparameter.getName())) {
//$NON-NLS-1$
continue;
}
//$NON-NLS-1$
Element columnElement = parametersElement.addElement("column");
//$NON-NLS-1$
columnElement.addAttribute("name", HTMLDocUtils.checkString(elemparameter.getDisplayName()));
Object eleObj = elemparameter.getValue();
//$NON-NLS-1$
String value = "";
if (eleObj != null) {
value = eleObj.toString();
if (elemparameter.getName().equals("COMMENT")) {
//$NON-NLS-1$
columnElement.addCDATA(value);
} else {
columnElement.setText(value);
}
}
}
}
}
use of org.dom4j.Element in project tdi-studio-se by Talend.
the class SourceRecord method addExtraInfo.
public void addExtraInfo(String infoKey, String infoValue, String infoScope) {
if (infoKey == null)
infoKey = "";
if (infoValue == null)
infoValue = "";
Element extraInfoElem = srcRecordElem.addElement("extrainfo");
extraInfoElem.addElement("infoKey").addText(infoKey);
extraInfoElem.addElement("infoValue").addText(infoValue);
if (infoScope != null && !"".equals(infoScope)) {
extraInfoElem.addElement("infoScope").addText(infoScope);
}
}
Aggregations