Search in sources :

Example 96 with Element

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);
        }
    }
}
Also used : ExternalDbMapTable(org.talend.designer.dbmap.external.data.ExternalDbMapTable) Element(org.dom4j.Element) ExternalDbMapEntry(org.talend.designer.dbmap.external.data.ExternalDbMapEntry)

Example 97 with Element

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()));
}
Also used : Element(org.dom4j.Element)

Example 98 with Element

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()));
}
Also used : Element(org.dom4j.Element)

Example 99 with Element

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);
                }
            }
        }
    }
}
Also used : Element(org.dom4j.Element) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 100 with Element

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);
    }
}
Also used : Element(org.dom4j.Element)

Aggregations

Element (org.dom4j.Element)2207 Document (org.dom4j.Document)500 ArrayList (java.util.ArrayList)294 List (java.util.List)249 SAXReader (org.dom4j.io.SAXReader)196 Iterator (java.util.Iterator)163 IQ (org.xmpp.packet.IQ)142 HashMap (java.util.HashMap)135 IOException (java.io.IOException)114 File (java.io.File)101 Attribute (org.dom4j.Attribute)97 StringReader (java.io.StringReader)90 DefaultElement (org.dom4j.tree.DefaultElement)87 JID (org.xmpp.packet.JID)87 Test (org.junit.jupiter.api.Test)78 DocumentException (org.dom4j.DocumentException)74 QName (org.dom4j.QName)68 AnnotatedElement (java.lang.reflect.AnnotatedElement)64 Node (org.dom4j.Node)64 Test (org.junit.Test)64