/** * Queries for an existing FICR Coverage Extension Request Pharmacy message then modifies and * commits several changes. * * @throws IOException */ public void testUpdate() throws IOException { QPaymentRequest query = QPaymentRequest.newQuery(); query.select(query.wildcard()).select(query.reasonOf().invoiceElementGroup().wildcard()); query.where( query .classCode() .eq("XACT") .and(query.moodCode().eq("PRP").and(query.amt().eq(this.amount)))); DataGraph[] results = this.service.find(query); assertTrue(results != null); assertTrue(results.length == 1); PaymentRequest paymentRequest = (PaymentRequest) results[0].getRootObject(); assertTrue(paymentRequest.getAmt() == this.amount); PaymentRequestReason requestReason = paymentRequest.getReasonOf(); assertTrue(requestReason != null); requestReason.getInvoiceElementGroup().setConfidentialityCode("Y"); this.service.commit(paymentRequest.getDataGraph(), USERNAME); results = this.service.find(query); assertTrue(results != null); assertTrue(results.length == 1); requestReason = paymentRequest.getReasonOf(); assertTrue(requestReason != null); assertTrue("Y".equals(requestReason.getInvoiceElementGroup().getConfidentialityCode())); }
/** * 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); }