Search in sources :

Example 46 with KettleXMLException

use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.

the class SalesforceInsertMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        setBatchSize(XMLHandler.getTagValue(stepnode, "batchSize"));
        setSalesforceIDFieldName(XMLHandler.getTagValue(stepnode, "salesforceIDFieldName"));
        Node fields = XMLHandler.getSubNode(stepnode, "fields");
        int nrFields = XMLHandler.countNodes(fields, "field");
        allocate(nrFields);
        for (int i = 0; i < nrFields; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
            updateLookup[i] = XMLHandler.getTagValue(fnode, "name");
            updateStream[i] = XMLHandler.getTagValue(fnode, "field");
            if (updateStream[i] == null) {
                // default: the same name!
                updateStream[i] = updateLookup[i];
            }
            String updateValue = XMLHandler.getTagValue(fnode, "useExternalId");
            if (updateValue == null) {
                // default FALSE
                useExternalId[i] = Boolean.FALSE;
            } else {
                if (updateValue.equalsIgnoreCase("Y")) {
                    useExternalId[i] = Boolean.TRUE;
                } else {
                    useExternalId[i] = Boolean.FALSE;
                }
            }
        }
        setRollbackAllChangesOnError("Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rollbackAllChangesOnError")));
    } catch (Exception e) {
        throw new KettleXMLException("Unable to load step info from XML", e);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 47 with KettleXMLException

use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.

the class SalesforceUpdateMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        setBatchSize(XMLHandler.getTagValue(stepnode, "batchSize"));
        Node fields = XMLHandler.getSubNode(stepnode, "fields");
        int nrFields = XMLHandler.countNodes(fields, "field");
        allocate(nrFields);
        for (int i = 0; i < nrFields; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
            updateLookup[i] = XMLHandler.getTagValue(fnode, "name");
            updateStream[i] = XMLHandler.getTagValue(fnode, "field");
            if (updateStream[i] == null) {
                // default: the same name!
                updateStream[i] = updateLookup[i];
            }
            String updateValue = XMLHandler.getTagValue(fnode, "useExternalId");
            if (updateValue == null) {
                // default FALSE
                useExternalId[i] = Boolean.FALSE;
            } else {
                if (updateValue.equalsIgnoreCase("Y")) {
                    useExternalId[i] = Boolean.TRUE;
                } else {
                    useExternalId[i] = Boolean.FALSE;
                }
            }
        }
        setRollbackAllChangesOnError("Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rollbackAllChangesOnError")));
    } catch (Exception e) {
        throw new KettleXMLException("Unable to load step info from XML", e);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 48 with KettleXMLException

use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.

the class SalesforceUpsertMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        setUpsertField(XMLHandler.getTagValue(stepnode, "upsertfield"));
        setBatchSize(XMLHandler.getTagValue(stepnode, "batchSize"));
        setSalesforceIDFieldName(XMLHandler.getTagValue(stepnode, "salesforceIDFieldName"));
        Node fields = XMLHandler.getSubNode(stepnode, "fields");
        int nrFields = XMLHandler.countNodes(fields, "field");
        allocate(nrFields);
        for (int i = 0; i < nrFields; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
            updateLookup[i] = XMLHandler.getTagValue(fnode, "name");
            updateStream[i] = XMLHandler.getTagValue(fnode, "field");
            if (updateStream[i] == null) {
                // default: the same name!
                updateStream[i] = updateLookup[i];
            }
            String updateValue = XMLHandler.getTagValue(fnode, "useExternalId");
            if (updateValue == null) {
                // default FALSE
                useExternalId[i] = Boolean.FALSE;
            } else {
                if (updateValue.equalsIgnoreCase("Y")) {
                    useExternalId[i] = Boolean.TRUE;
                } else {
                    useExternalId[i] = Boolean.FALSE;
                }
            }
        }
        setRollbackAllChangesOnError("Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rollbackAllChangesOnError")));
    } catch (Exception e) {
        throw new KettleXMLException("Unable to load step info from XML", e);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 49 with KettleXMLException

use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.

the class XMLInputMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        includeFilename = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "include"));
        filenameField = XMLHandler.getTagValue(stepnode, "include_field");
        includeRowNumber = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rownum"));
        rowNumberField = XMLHandler.getTagValue(stepnode, "rownum_field");
        fileBaseURI = XMLHandler.getTagValue(stepnode, "file_base_uri");
        ignoreEntities = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "ignore_entities"));
        namespaceAware = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "namespace_aware"));
        Node filenode = XMLHandler.getSubNode(stepnode, "file");
        Node fields = XMLHandler.getSubNode(stepnode, "fields");
        Node positions = XMLHandler.getSubNode(stepnode, "positions");
        int nrFiles = XMLHandler.countNodes(filenode, "name");
        int nrFields = XMLHandler.countNodes(fields, "field");
        int nrPositions = XMLHandler.countNodes(positions, "position");
        allocate(nrFiles, nrFields, nrPositions);
        for (int i = 0; i < nrFiles; i++) {
            Node filenamenode = XMLHandler.getSubNodeByNr(filenode, "name", i);
            Node filemasknode = XMLHandler.getSubNodeByNr(filenode, "filemask", i);
            fileName[i] = XMLHandler.getNodeValue(filenamenode);
            fileMask[i] = XMLHandler.getNodeValue(filemasknode);
        }
        for (int i = 0; i < nrFields; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
            XMLInputField field = new XMLInputField(fnode);
            inputFields[i] = field;
        }
        for (int i = 0; i < nrPositions; i++) {
            Node positionnode = XMLHandler.getSubNodeByNr(positions, "position", i);
            inputPosition[i] = XMLHandler.getNodeValue(positionnode);
        }
        // Is there a limit on the number of rows we process?
        rowLimit = Const.toLong(XMLHandler.getTagValue(stepnode, "limit"), 0L);
        // Do we skip rows before starting to read
        nrRowsToSkip = Const.toInt(XMLHandler.getTagValue(stepnode, "skip"), 0);
    } catch (Exception e) {
        throw new KettleXMLException("Unable to load step info from XML", e);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 50 with KettleXMLException

use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.

the class JobEntryDTDValidator method loadXML.

public void loadXML(Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers, Repository rep, IMetaStore metaStore) throws KettleXMLException {
    try {
        super.loadXML(entrynode, databases, slaveServers);
        xmlfilename = XMLHandler.getTagValue(entrynode, "xmlfilename");
        dtdfilename = XMLHandler.getTagValue(entrynode, "dtdfilename");
        dtdintern = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "dtdintern"));
    } catch (KettleXMLException xe) {
        throw new KettleXMLException("Unable to load job entry of type 'DTDvalidator' from XML node", xe);
    }
}
Also used : KettleXMLException(org.pentaho.di.core.exception.KettleXMLException)

Aggregations

KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)286 KettleException (org.pentaho.di.core.exception.KettleException)209 Node (org.w3c.dom.Node)164 KettleStepException (org.pentaho.di.core.exception.KettleStepException)150 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)25 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)23 KettlePluginException (org.pentaho.di.core.exception.KettlePluginException)20 Document (org.w3c.dom.Document)13 IOException (java.io.IOException)10 KettleValueException (org.pentaho.di.core.exception.KettleValueException)10 StringObjectId (org.pentaho.di.repository.StringObjectId)8 KettleFileException (org.pentaho.di.core.exception.KettleFileException)7 FileNotFoundException (java.io.FileNotFoundException)5 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)5 StreamInterface (org.pentaho.di.trans.step.errorhandling.StreamInterface)5 InputStream (java.io.InputStream)4 MalformedURLException (java.net.MalformedURLException)4 ParseException (java.text.ParseException)4 FileSystemException (org.apache.commons.vfs2.FileSystemException)4 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)4