use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeChargeItem.
protected void composeChargeItem(Complex parent, String parentType, String name, ChargeItem element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "ChargeItem", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ChargeItem", "identifier", element.getIdentifier().get(i), i);
for (int i = 0; i < element.getDefinitionUri().size(); i++) composeUri(t, "ChargeItem", "definitionUri", element.getDefinitionUri().get(i), i);
for (int i = 0; i < element.getDefinitionCanonical().size(); i++) composeCanonical(t, "ChargeItem", "definitionCanonical", element.getDefinitionCanonical().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "ChargeItem", "status", element.getStatusElement(), -1);
for (int i = 0; i < element.getPartOf().size(); i++) composeReference(t, "ChargeItem", "partOf", element.getPartOf().get(i), i);
if (element.hasCode())
composeCodeableConcept(t, "ChargeItem", "code", element.getCode(), -1);
if (element.hasSubject())
composeReference(t, "ChargeItem", "subject", element.getSubject(), -1);
if (element.hasContext())
composeReference(t, "ChargeItem", "context", element.getContext(), -1);
if (element.hasOccurrence())
composeType(t, "ChargeItem", "occurrence", element.getOccurrence(), -1);
for (int i = 0; i < element.getPerformer().size(); i++) composeChargeItemChargeItemPerformerComponent(t, "ChargeItem", "performer", element.getPerformer().get(i), i);
if (element.hasPerformingOrganization())
composeReference(t, "ChargeItem", "performingOrganization", element.getPerformingOrganization(), -1);
if (element.hasRequestingOrganization())
composeReference(t, "ChargeItem", "requestingOrganization", element.getRequestingOrganization(), -1);
if (element.hasCostCenter())
composeReference(t, "ChargeItem", "costCenter", element.getCostCenter(), -1);
if (element.hasQuantity())
composeQuantity(t, "ChargeItem", "quantity", element.getQuantity(), -1);
for (int i = 0; i < element.getBodysite().size(); i++) composeCodeableConcept(t, "ChargeItem", "bodysite", element.getBodysite().get(i), i);
if (element.hasFactorOverrideElement())
composeDecimal(t, "ChargeItem", "factorOverride", element.getFactorOverrideElement(), -1);
if (element.hasPriceOverride())
composeMoney(t, "ChargeItem", "priceOverride", element.getPriceOverride(), -1);
if (element.hasOverrideReasonElement())
composeString(t, "ChargeItem", "overrideReason", element.getOverrideReasonElement(), -1);
if (element.hasEnterer())
composeReference(t, "ChargeItem", "enterer", element.getEnterer(), -1);
if (element.hasEnteredDateElement())
composeDateTime(t, "ChargeItem", "enteredDate", element.getEnteredDateElement(), -1);
for (int i = 0; i < element.getReason().size(); i++) composeCodeableConcept(t, "ChargeItem", "reason", element.getReason().get(i), i);
for (int i = 0; i < element.getService().size(); i++) composeReference(t, "ChargeItem", "service", element.getService().get(i), i);
if (element.hasProduct())
composeType(t, "ChargeItem", "product", element.getProduct(), -1);
for (int i = 0; i < element.getAccount().size(); i++) composeReference(t, "ChargeItem", "account", element.getAccount().get(i), i);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "ChargeItem", "note", element.getNote().get(i), i);
for (int i = 0; i < element.getSupportingInformation().size(); i++) composeReference(t, "ChargeItem", "supportingInformation", element.getSupportingInformation().get(i), i);
}
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 = SimpleWorkerContext.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.parse(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 Tester method main.
public static void main(String[] args) throws Exception {
IWorkerContext context = SimpleWorkerContext.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 googleads-adsense-examples by googleads.
the class GetAllAccounts method run.
/**
* Runs this sample.
*
* @param adsense AdSense service object on which to run the requests.
* @param maxPageSize the maximum page size to retrieve.
* @return the retrieved accounts.
* @throws Exception
*/
public static List<Account> run(Adsense adsense, int maxPageSize) throws Exception {
System.out.println("=================================================================");
System.out.println("Listing all AdSense accounts");
System.out.println("=================================================================");
List<Account> allAccounts = new ArrayList<Account>();
// Retrieve account list in pages and display data as we receive it.
String pageToken = null;
do {
ListAccountsResponse response = null;
response = adsense.accounts().list().setPageSize(maxPageSize).setPageToken(pageToken).execute();
List<Account> accounts = response.getAccounts();
if (accounts != null && !accounts.isEmpty()) {
allAccounts.addAll(accounts);
for (Account account : accounts) {
System.out.printf("Account with ID \"%s\" and name \"%s\" was found.\n", account.getName(), account.getDisplayName());
}
} else {
System.out.println("No accounts found.");
}
pageToken = response.getNextPageToken();
} while (pageToken != null);
System.out.println();
return allAccounts;
}
use of org.hl7.fhir.dstu3.model.Account in project googleads-adsense-examples by googleads.
the class AdSenseSample method main.
/**
* Runs all the AdSense Management API samples.
*
* @param args command-line arguments.
*/
public static void main(String[] args) {
try {
httpTransport = GoogleNetHttpTransport.newTrustedTransport();
dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
Adsense adsense = initializeAdsense();
List<Account> accounts = GetAllAccounts.run(adsense, MAX_LIST_PAGE_SIZE);
if ((accounts != null) && !accounts.isEmpty()) {
// Get an example account ID, so we can run the following sample.
String chosenAccount = chooseAccount(accounts);
GetAccountTree.run(adsense, chosenAccount);
List<AdClient> adClients = GetAllAdClients.run(adsense, chosenAccount, MAX_LIST_PAGE_SIZE);
if ((adClients != null) && !adClients.isEmpty()) {
// Get an ad client ID, so we can run the rest of the samples.
String exampleAdClientId = adClients.get(6).getName();
List<AdUnit> units = GetAllAdUnits.run(adsense, exampleAdClientId, MAX_LIST_PAGE_SIZE);
if ((units != null) && !units.isEmpty()) {
// Get an example ad unit ID, so we can run the following sample.
String exampleAdUnitId = units.get(0).getName();
GetAllCustomChannelsForAdUnit.run(adsense, exampleAdUnitId, MAX_LIST_PAGE_SIZE);
}
List<CustomChannel> channels = GetAllCustomChannels.run(adsense, exampleAdClientId, MAX_LIST_PAGE_SIZE);
if ((channels != null) && !channels.isEmpty()) {
// Get an example custom channel ID, so we can run the following sample.
String exampleCustomChannelId = channels.get(1).getName();
GetAllAdUnitsForCustomChannel.run(adsense, exampleCustomChannelId, MAX_LIST_PAGE_SIZE);
}
GetAllUrlChannels.run(adsense, exampleAdClientId, MAX_LIST_PAGE_SIZE);
GenerateReport.run(adsense, chosenAccount, exampleAdClientId);
} else {
System.out.println("No ad clients found, unable to run remaining methods.");
}
List<SavedReport> savedReports = GetAllSavedReports.run(adsense, chosenAccount, MAX_LIST_PAGE_SIZE);
if ((savedReports != null) && !savedReports.isEmpty()) {
// Get a saved report ID, so we can generate its report.
String exampleSavedReportId = savedReports.get(0).getName();
GenerateSavedReport.run(adsense, exampleSavedReportId);
} else {
System.out.println("No saved report found.");
}
GetAllAlerts.run(adsense, chosenAccount);
}
} catch (IOException e) {
System.err.println(e.getMessage());
} catch (Throwable t) {
t.printStackTrace();
}
}
Aggregations