use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeAccount.
protected void composeAccount(Complex parent, String parentType, String name, Account element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Account", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Account", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "Account", "status", element.getStatusElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Account", "type", element.getType(), -1);
if (element.hasNameElement())
composeString(t, "Account", "name", element.getNameElement(), -1);
for (int i = 0; i < element.getSubject().size(); i++) composeReference(t, "Account", "subject", element.getSubject().get(i), i);
if (element.hasServicePeriod())
composePeriod(t, "Account", "servicePeriod", element.getServicePeriod(), -1);
for (int i = 0; i < element.getCoverage().size(); i++) composeAccountCoverageComponent(t, "Account", "coverage", element.getCoverage().get(i), i);
if (element.hasOwner())
composeReference(t, "Account", "owner", element.getOwner(), -1);
if (element.hasDescriptionElement())
composeString(t, "Account", "description", element.getDescriptionElement(), -1);
for (int i = 0; i < element.getGuarantor().size(); i++) composeAccountGuarantorComponent(t, "Account", "guarantor", element.getGuarantor().get(i), i);
if (element.hasPartOf())
composeReference(t, "Account", "partOf", element.getPartOf(), -1);
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class Tester method main.
public static void main(String[] args) throws Exception {
IWorkerContext context = new SimpleWorkerContext.SimpleWorkerContextBuilder().fromPack(Utilities.path("C:\\work\\org.hl7.fhir\\build\\publish", "validation-min.xml.zip"));
int t = 0;
int ok = 0;
for (String f : new File("C:\\work\\org.hl7.fhir\\build\\publish").list()) {
if (f.endsWith(".xml") && !f.endsWith(".canonical.xml") && !f.contains("profile") && !f.contains("questionnaire") && new File("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".ttl")).exists()) {
// if (f.equals("account-questionnaire.xml")) {
System.out.print("convert " + f);
// Manager.convert(context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+f), FhirFormat.XML,
// new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.json")), FhirFormat.JSON, OutputStyle.PRETTY);
// String src = normalise(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.json")));
// String tgt = normalise(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".json")));
Element e = Manager.parseSingle(context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\" + f), FhirFormat.XML);
Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".mm.ttl")), FhirFormat.TURTLE, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream(Utilities.path("[tmp]", "resource.xml")), FhirFormat.XML, OutputStyle.PRETTY, null);
String src = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".mm.ttl"));
String tgt = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".ttl"));
t++;
if (src.equals(tgt)) {
System.out.println(".. ok");
ok++;
} else
System.out.println(".. fail");
}
// }
}
System.out.println("done - " + Integer.toString(t) + " files, " + Integer.toString(ok) + " ok");
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeAccountCoverageComponent.
protected void composeAccountCoverageComponent(Complex parent, String parentType, String name, Account.CoverageComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "coverage", name, element, index);
if (element.hasCoverage())
composeReference(t, "Account", "coverage", element.getCoverage(), -1);
if (element.hasPriorityElement())
composePositiveInt(t, "Account", "priority", element.getPriorityElement(), -1);
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeInvoice.
protected void composeInvoice(Complex parent, String parentType, String name, Invoice element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Invoice", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Invoice", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "Invoice", "status", element.getStatusElement(), -1);
if (element.hasCancelledReasonElement())
composeString(t, "Invoice", "cancelledReason", element.getCancelledReasonElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Invoice", "type", element.getType(), -1);
if (element.hasSubject())
composeReference(t, "Invoice", "subject", element.getSubject(), -1);
if (element.hasRecipient())
composeReference(t, "Invoice", "recipient", element.getRecipient(), -1);
if (element.hasDateElement())
composeDateTime(t, "Invoice", "date", element.getDateElement(), -1);
for (int i = 0; i < element.getParticipant().size(); i++) composeInvoiceInvoiceParticipantComponent(t, "Invoice", "participant", element.getParticipant().get(i), i);
if (element.hasIssuer())
composeReference(t, "Invoice", "issuer", element.getIssuer(), -1);
if (element.hasAccount())
composeReference(t, "Invoice", "account", element.getAccount(), -1);
for (int i = 0; i < element.getLineItem().size(); i++) composeInvoiceInvoiceLineItemComponent(t, "Invoice", "lineItem", element.getLineItem().get(i), i);
for (int i = 0; i < element.getTotalPriceComponent().size(); i++) composeInvoiceInvoiceLineItemPriceComponentComponent(t, "Invoice", "totalPriceComponent", element.getTotalPriceComponent().get(i), i);
if (element.hasTotalNet())
composeMoney(t, "Invoice", "totalNet", element.getTotalNet(), -1);
if (element.hasTotalGross())
composeMoney(t, "Invoice", "totalGross", element.getTotalGross(), -1);
if (element.hasPaymentTermsElement())
composeMarkdown(t, "Invoice", "paymentTerms", element.getPaymentTermsElement(), -1);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "Invoice", "note", element.getNote().get(i), i);
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeAccountGuarantorComponent.
protected void composeAccountGuarantorComponent(Complex parent, String parentType, String name, Account.GuarantorComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "guarantor", name, element, index);
if (element.hasParty())
composeReference(t, "Account", "party", element.getParty(), -1);
if (element.hasOnHoldElement())
composeBoolean(t, "Account", "onHold", element.getOnHoldElement(), -1);
if (element.hasPeriod())
composePeriod(t, "Account", "period", element.getPeriod(), -1);
}
Aggregations