Search in sources :

Example 1 with HopInfo

use of org.pentaho.metaverse.api.model.kettle.HopInfo in project pentaho-metaverse by pentaho.

the class TransMetaJsonDeserializer method deserializeHops.

protected void deserializeHops(TransMeta transMeta, JsonNode root, ObjectMapper mapper) {
    ArrayNode hopsArray = (ArrayNode) root.get(TransMetaJsonSerializer.JSON_PROPERTY_HOPS);
    for (int i = 0; i < hopsArray.size(); i++) {
        JsonNode hopNode = hopsArray.get(i);
        try {
            HopInfo hop = mapper.readValue(hopNode.toString(), HopInfo.class);
            if (hop != null) {
                TransHopMeta hopMeta = new TransHopMeta();
                hopMeta.setFromStep(transMeta.findStep(hop.getFromStepName()));
                hopMeta.setToStep(transMeta.findStep(hop.getToStepName()));
                hopMeta.setEnabled(hop.isEnabled());
                transMeta.addTransHop(hopMeta);
            }
        } catch (IOException e) {
            LOGGER.warn(Messages.getString("WARNING.Deserialization.Trans.Hops"), e);
        }
    }
}
Also used : HopInfo(org.pentaho.metaverse.api.model.kettle.HopInfo) JsonNode(com.fasterxml.jackson.databind.JsonNode) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) TransHopMeta(org.pentaho.di.trans.TransHopMeta) IOException(java.io.IOException)

Example 2 with HopInfo

use of org.pentaho.metaverse.api.model.kettle.HopInfo in project pentaho-metaverse by pentaho.

the class JobMetaJsonSerializer method serializeHops.

@Override
protected void serializeHops(JobMeta meta, JsonGenerator json) throws IOException {
    // Hops
    json.writeArrayFieldStart(JSON_PROPERTY_HOPS);
    int numberOfHops = meta.nrJobHops();
    for (int i = 0; i < numberOfHops; i++) {
        JobHopMeta hopMeta = meta.getJobHop(i);
        HopInfo hopInfo = new HopInfo(hopMeta);
        json.writeObject(hopInfo);
    }
    json.writeEndArray();
}
Also used : HopInfo(org.pentaho.metaverse.api.model.kettle.HopInfo) JobHopMeta(org.pentaho.di.job.JobHopMeta)

Example 3 with HopInfo

use of org.pentaho.metaverse.api.model.kettle.HopInfo in project pentaho-metaverse by pentaho.

the class TransMetaJsonSerializer method serializeHops.

@Override
protected void serializeHops(TransMeta meta, JsonGenerator json) throws IOException {
    // Hops
    json.writeArrayFieldStart(JSON_PROPERTY_HOPS);
    int numberOfHops = meta.nrTransHops();
    for (int i = 0; i < numberOfHops; i++) {
        TransHopMeta hopMeta = meta.getTransHop(i);
        HopInfo hopInfo = new HopInfo(hopMeta);
        json.writeObject(hopInfo);
    }
    json.writeEndArray();
}
Also used : HopInfo(org.pentaho.metaverse.api.model.kettle.HopInfo) TransHopMeta(org.pentaho.di.trans.TransHopMeta)

Aggregations

HopInfo (org.pentaho.metaverse.api.model.kettle.HopInfo)3 TransHopMeta (org.pentaho.di.trans.TransHopMeta)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 IOException (java.io.IOException)1 JobHopMeta (org.pentaho.di.job.JobHopMeta)1