コード例 #1
0
  /**
   * Initiates the assembly of a data graph based on the given results list.
   *
   * @param results the results list
   * @see DataGraphAssembler.getDataGraph()
   */
  @Override
  public void assemble(List<PropertyPair> results) {

    long before = System.currentTimeMillis();
    DataGraph dataGraph = initRoot(results);
    CoreNode rootNode = (CoreNode) dataGraph.getRootObject();

    // singular reference props
    for (PropertyPair pair : results) {
      if (pair.getProp().isMany() || pair.getProp().getType().isDataType()) continue;
      List<PropertyPair> childKeyProps = this.getChildKeyPairs(pair);
      assemble(
          (PlasmaType) pair.getProp().getType(),
          (PlasmaDataObject) this.root,
          pair.getProp(),
          childKeyProps,
          1);
    }

    // multi reference props (not found in results)
    Set<Property> props = this.collector.getProperties(this.rootType);
    for (Property p : props) {
      PlasmaProperty prop = (PlasmaProperty) p;
      if (prop.isMany() && !prop.getType().isDataType()) {
        List<PropertyPair> childKeyProps = this.getChildKeyPairs(root, prop);
        assemble((PlasmaType) prop.getType(), (PlasmaDataObject) this.root, prop, childKeyProps, 1);
      }
    }

    long after = System.currentTimeMillis();

    rootNode
        .getValueObject()
        .put(CloudGraphConstants.GRAPH_ASSEMBLY_TIME, Long.valueOf(after - before));

    GraphMetricVisitor visitor = new GraphMetricVisitor();
    this.root.accept(visitor);

    rootNode
        .getValueObject()
        .put(CloudGraphConstants.GRAPH_NODE_COUNT, Long.valueOf(visitor.getCount()));
    rootNode
        .getValueObject()
        .put(CloudGraphConstants.GRAPH_DEPTH, Long.valueOf(visitor.getDepth()));
    rootNode
        .getValueObject()
        .put(CloudGraphConstants.GRAPH_THREAD_COUNT, Long.valueOf(visitor.getThreadCount()));
  }
コード例 #2
0
  /**
   * Creates and persists a FICR Coverage Extension Request Pharmacy message
   *
   * @throws IOException
   */
  public void testCreate() throws IOException {
    DataGraph dataGraph = PlasmaDataFactory.INSTANCE.createDataGraph();
    dataGraph.getChangeSummary().beginLogging(); // log changes from this point
    Type rootType = PlasmaTypeHelper.INSTANCE.getType(PaymentRequest.class);
    PaymentRequest paymentRequest = (PaymentRequest) dataGraph.createRootObject(rootType);
    paymentRequest.setAmt(this.amount);
    paymentRequest.setClassCode("XACT");
    paymentRequest.setId(new String[] {String.valueOf(rand.nextLong())});
    paymentRequest.setMoodCode("PRP");

    PaymentRequestAttention performer = paymentRequest.createPrimaryPerformer();
    performer.setTypeCode("PPRF");

    ContactParty contactParty = performer.createContactParty();
    contactParty.setClassCode("CON");
    contactParty.setCode("PAYOR");
    contactParty.setId(String.valueOf(System.currentTimeMillis()));

    ContactPerson contactPerson = contactParty.createContactPerson();
    contactPerson.setName("Albert Dunhurst");
    contactPerson.setClassCode("PSN");
    contactPerson.setDeterminerCode("INSTANCE");
    contactPerson.setTelecom("(540)364-2293");

    PaymentRequestReason paymentReason = paymentRequest.createReasonOf();
    paymentReason.setTypeCode("RSON");
    InvoiceElementGroup invoiceElementGroup = paymentReason.createInvoiceElementGroup();
    invoiceElementGroup.setClassCode("INME");
    invoiceElementGroup.setMoodCode("PRP");
    invoiceElementGroup.setConfidentialityCode("N");
    invoiceElementGroup.setNetAmt(this.amount);

    InvoiceElementGroupAttachment groupAttachment =
        invoiceElementGroup.createPertinentInformation1();
    groupAttachment.setTypeCode("PERT");
    HealthDocumentAttachment attachment = groupAttachment.createHealthDocumentAttachment();
    attachment.setClassCode("OBS");
    attachment.setMoodCode("EVN");
    attachment.setId(new String[] {String.valueOf(System.currentTimeMillis())});
    // attachment.setCode(value)
    attachment.setValue("<Content>attachment content</<Content>");

    // InvoiceElementReason invoiceReason = invoiceElementGroup.createReasonOf();

    log.info(this.serializeGraph(paymentRequest.getDataGraph()));
    this.service.commit(paymentRequest.getDataGraph(), USERNAME);
  }