Search in sources :

Example 1 with MappingParameters

use of org.pentaho.di.trans.steps.mapping.MappingParameters in project pentaho-kettle by pentaho.

the class SimpleMappingMeta method readRep.

public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases) throws KettleException {
    String method = rep.getStepAttributeString(id_step, "specification_method");
    specificationMethod = ObjectLocationSpecificationMethod.getSpecificationMethodByCode(method);
    String transId = rep.getStepAttributeString(id_step, "trans_object_id");
    transObjectId = Utils.isEmpty(transId) ? null : new StringObjectId(transId);
    transName = rep.getStepAttributeString(id_step, "trans_name");
    fileName = rep.getStepAttributeString(id_step, "filename");
    directoryPath = rep.getStepAttributeString(id_step, "directory_path");
    // Backward compatibility check for object specification
    // 
    checkObjectLocationSpecificationMethod();
    inputMapping = new MappingIODefinition(rep, id_step, "input_", 0);
    outputMapping = new MappingIODefinition(rep, id_step, "output_", 0);
    mappingParameters = new MappingParameters(rep, id_step);
}
Also used : MappingIODefinition(org.pentaho.di.trans.steps.mapping.MappingIODefinition) MappingParameters(org.pentaho.di.trans.steps.mapping.MappingParameters) StringObjectId(org.pentaho.di.repository.StringObjectId)

Example 2 with MappingParameters

use of org.pentaho.di.trans.steps.mapping.MappingParameters in project pentaho-kettle by pentaho.

the class SimpleMappingMeta method loadXML.

public void loadXML(Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore) throws KettleXMLException {
    try {
        String method = XMLHandler.getTagValue(stepnode, "specification_method");
        specificationMethod = ObjectLocationSpecificationMethod.getSpecificationMethodByCode(method);
        String transId = XMLHandler.getTagValue(stepnode, "trans_object_id");
        transObjectId = Utils.isEmpty(transId) ? null : new StringObjectId(transId);
        transName = XMLHandler.getTagValue(stepnode, "trans_name");
        fileName = XMLHandler.getTagValue(stepnode, "filename");
        directoryPath = XMLHandler.getTagValue(stepnode, "directory_path");
        // Backward compatibility check for object specification
        // 
        checkObjectLocationSpecificationMethod();
        Node mappingsNode = XMLHandler.getSubNode(stepnode, "mappings");
        if (mappingsNode == null) {
            throw new KettleXMLException("Unable to find <mappings> element in the step XML");
        }
        // Read all the input mapping definitions...
        // 
        Node inputNode = XMLHandler.getSubNode(mappingsNode, "input");
        Node mappingNode = XMLHandler.getSubNode(inputNode, MappingIODefinition.XML_TAG);
        if (mappingNode != null) {
            inputMapping = new MappingIODefinition(mappingNode);
        } else {
            // empty
            inputMapping = new MappingIODefinition();
        }
        Node outputNode = XMLHandler.getSubNode(mappingsNode, "output");
        mappingNode = XMLHandler.getSubNode(outputNode, MappingIODefinition.XML_TAG);
        if (mappingNode != null) {
            outputMapping = new MappingIODefinition(mappingNode);
        } else {
            // empty
            outputMapping = new MappingIODefinition();
        }
        // Load the mapping parameters too..
        // 
        Node mappingParametersNode = XMLHandler.getSubNode(mappingsNode, MappingParameters.XML_TAG);
        mappingParameters = new MappingParameters(mappingParametersNode);
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "SimpleMappingMeta.Exception.ErrorLoadingTransformationStepFromXML"), e);
    }
}
Also used : MappingIODefinition(org.pentaho.di.trans.steps.mapping.MappingIODefinition) Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) MappingParameters(org.pentaho.di.trans.steps.mapping.MappingParameters) StringObjectId(org.pentaho.di.repository.StringObjectId) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 3 with MappingParameters

use of org.pentaho.di.trans.steps.mapping.MappingParameters in project pentaho-kettle by pentaho.

the class MappingParametersLoadSaveValidator method getTestObject.

@Override
public MappingParameters getTestObject() {
    MappingParameters rtn = new MappingParameters();
    rtn.setVariable(new String[] { UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString() });
    rtn.setInputField(new String[] { UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString() });
    rtn.setInheritingAllVariables(rand.nextBoolean());
    return rtn;
}
Also used : MappingParameters(org.pentaho.di.trans.steps.mapping.MappingParameters)

Aggregations

MappingParameters (org.pentaho.di.trans.steps.mapping.MappingParameters)3 StringObjectId (org.pentaho.di.repository.StringObjectId)2 MappingIODefinition (org.pentaho.di.trans.steps.mapping.MappingIODefinition)2 KettleException (org.pentaho.di.core.exception.KettleException)1 KettleStepException (org.pentaho.di.core.exception.KettleStepException)1 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)1 Node (org.w3c.dom.Node)1