Exemplo n.º 1
0
 private void convertFlowsInto(
     final YFlow flow,
     final BasicShape incomingShape,
     final BasicShape outgoingShape,
     final YNet net)
     throws JSONException, ConversionException {
   if (incomingShape.hasProperty("flowsinto")
       && !incomingShape.getProperty("flowsinto").isEmpty()) {
     JSONObject flowsInto =
         lookUpFlowsInto(outgoingShape.getProperty("yawlid"), incomingShape, net);
     if (flowsInto.has("ordering")) {
       flow.setEvalOrdering(flowsInto.getInt("ordering"));
     }
     if (flowsInto.has("isdefault")) {
       flow.setIsDefaultFlow(flowsInto.getBoolean("isdefault"));
     }
     if (flowsInto.has("predicate")) {
       flow.setXpathPredicate(flowsInto.getString("predicate"));
     }
   }
 }
Exemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see de.hbrs.oryx.yawl.converter.handler.oryx.OryxHandler#convert()
   */
  @Override
  public void convert() {
    YNet net = getContext().getNet(netShape);

    BasicShape incomingShape = getShape().getIncomingsReadOnly().get(0);
    BasicShape outgoingShape = getShape().getOutgoingsReadOnly().get(0);

    YExternalNetElement incomingElement = net.getNetElement(convertYawlId(net, incomingShape));
    YExternalNetElement outgoingElement = net.getNetElement(convertYawlId(net, outgoingShape));

    if (incomingElement == null
        || outgoingElement == null
        || incomingElement.getID() == null
        || outgoingElement.getID() == null) {
      getContext()
          .addConversionWarnings(
              new ConversionException(
                  "Missing source or target for Edge with ID "
                      + getShape().getResourceId()
                      + " in Net "
                      + net.getID()));
      return;
    }

    YFlow flow = new YFlow(incomingElement, outgoingElement);
    flow.setDocumentation(edgeShape.getProperty("documentation"));

    try {
      convertFlowsInto(flow, incomingShape, outgoingShape, net);
    } catch (JSONException e) {
      getContext().addConversionWarnings("Can not convert flow predicates and ordering", e);
    } catch (ConversionException e) {
      getContext().addConversionWarnings(e);
    }

    convertFlowLayout(incomingElement, outgoingElement, net);

    outgoingElement.addPreset(flow);
  }