@Test public void testBulkImportUtilStorageDetails() throws IOException, FHIRException { FHIRRequestContext.set(new FHIRRequestContext("default")); assertNotNull(BulkDataImportUtil.retrieveStorageDetails(loadTestFile("/testdata/import/import-demo.json"))); assertEquals( BulkDataImportUtil.retrieveStorageDetails(loadTestFile("/testdata/import/import-demo.json")).getType(), "https"); }
public static StorageDetail retrieveStorageDetails(Parameters parameters) throws FHIROperationException { FHIRPathEvaluator evaluator = FHIRPathEvaluator.evaluator(); EvaluationContext evaluationContext = new EvaluationContext(parameters); try { Collection<FHIRPathNode> result = evaluator.evaluate(evaluationContext, "parameter.where(name = 'storageDetail')"); Iterator<FHIRPathNode> iter = result.iterator(); while (iter.hasNext()) { FHIRPathElementNode node = (FHIRPathElementNode) iter.next(); EvaluationContext evaluationContextPartType = new EvaluationContext(node.element()); Collection<FHIRPathNode> resultPartType = evaluator.evaluate(evaluationContextPartType, "value"); String type = ((FHIRPathElementNode) resultPartType.iterator().next()).element() .as(com.ibm.fhir.model.type.String.class).getValue(); if (!BulkDataConstants.STORAGE_TYPES.contains(type)) { throw buildExceptionWithIssue("$import invalid type in 'storageDetail'", IssueType.INVALID); } EvaluationContext evaluationContextPartContentEncoding = new EvaluationContext(node.element()); Collection<FHIRPathNode> resultPartContentEncoding = evaluator.evaluate(evaluationContextPartContentEncoding, "part.where(name = 'contentEncoding').value"); List<String> contentEncodings = new ArrayList<>(); Iterator<FHIRPathNode> iterEncoding = resultPartContentEncoding.iterator(); while (iterEncoding.hasNext()) { String contentEncoding = ((FHIRPathElementNode) iterEncoding.next()).element() .as(com.ibm.fhir.model.type.String.class).getValue(); checkValidContentEncoding(contentEncoding); contentEncodings.add(contentEncoding); } return new StorageDetail(type, contentEncodings); } } catch (FHIRPathException e) { throw buildExceptionWithIssue("$import invalid parameters with expression in 'input'", e, IssueType.INVALID); } throw buildExceptionWithIssue("$import required 'storageDetail' is not found", IssueType.INVALID); }
BulkDataImportUtil { public static StorageDetail retrieveStorageDetails(Parameters parameters) throws FHIROperationException { FHIRPathEvaluator evaluator = FHIRPathEvaluator.evaluator(); EvaluationContext evaluationContext = new EvaluationContext(parameters); try { Collection<FHIRPathNode> result = evaluator.evaluate(evaluationContext, "parameter.where(name = 'storageDetail')"); Iterator<FHIRPathNode> iter = result.iterator(); while (iter.hasNext()) { FHIRPathElementNode node = (FHIRPathElementNode) iter.next(); EvaluationContext evaluationContextPartType = new EvaluationContext(node.element()); Collection<FHIRPathNode> resultPartType = evaluator.evaluate(evaluationContextPartType, "value"); String type = ((FHIRPathElementNode) resultPartType.iterator().next()).element() .as(com.ibm.fhir.model.type.String.class).getValue(); if (!BulkDataConstants.STORAGE_TYPES.contains(type)) { throw buildExceptionWithIssue("$import invalid type in 'storageDetail'", IssueType.INVALID); } EvaluationContext evaluationContextPartContentEncoding = new EvaluationContext(node.element()); Collection<FHIRPathNode> resultPartContentEncoding = evaluator.evaluate(evaluationContextPartContentEncoding, "part.where(name = 'contentEncoding').value"); List<String> contentEncodings = new ArrayList<>(); Iterator<FHIRPathNode> iterEncoding = resultPartContentEncoding.iterator(); while (iterEncoding.hasNext()) { String contentEncoding = ((FHIRPathElementNode) iterEncoding.next()).element() .as(com.ibm.fhir.model.type.String.class).getValue(); checkValidContentEncoding(contentEncoding); contentEncodings.add(contentEncoding); } return new StorageDetail(type, contentEncodings); } } catch (FHIRPathException e) { throw buildExceptionWithIssue("$import invalid parameters with expression in 'input'", e, IssueType.INVALID); } throw buildExceptionWithIssue("$import required 'storageDetail' is not found", IssueType.INVALID); } }
BulkDataImportUtil { public static StorageDetail retrieveStorageDetails(Parameters parameters) throws FHIROperationException { FHIRPathEvaluator evaluator = FHIRPathEvaluator.evaluator(); EvaluationContext evaluationContext = new EvaluationContext(parameters); try { Collection<FHIRPathNode> result = evaluator.evaluate(evaluationContext, "parameter.where(name = 'storageDetail')"); Iterator<FHIRPathNode> iter = result.iterator(); while (iter.hasNext()) { FHIRPathElementNode node = (FHIRPathElementNode) iter.next(); EvaluationContext evaluationContextPartType = new EvaluationContext(node.element()); Collection<FHIRPathNode> resultPartType = evaluator.evaluate(evaluationContextPartType, "value"); String type = ((FHIRPathElementNode) resultPartType.iterator().next()).element() .as(com.ibm.fhir.model.type.String.class).getValue(); if (!BulkDataConstants.STORAGE_TYPES.contains(type)) { throw buildExceptionWithIssue("$import invalid type in 'storageDetail'", IssueType.INVALID); } EvaluationContext evaluationContextPartContentEncoding = new EvaluationContext(node.element()); Collection<FHIRPathNode> resultPartContentEncoding = evaluator.evaluate(evaluationContextPartContentEncoding, "part.where(name = 'contentEncoding').value"); List<String> contentEncodings = new ArrayList<>(); Iterator<FHIRPathNode> iterEncoding = resultPartContentEncoding.iterator(); while (iterEncoding.hasNext()) { String contentEncoding = ((FHIRPathElementNode) iterEncoding.next()).element() .as(com.ibm.fhir.model.type.String.class).getValue(); checkValidContentEncoding(contentEncoding); contentEncodings.add(contentEncoding); } return new StorageDetail(type, contentEncodings); } } catch (FHIRPathException e) { throw buildExceptionWithIssue("$import invalid parameters with expression in 'input'", e, IssueType.INVALID); } throw buildExceptionWithIssue("$import required 'storageDetail' is not found", IssueType.INVALID); } private  BulkDataImportUtil(); }
BulkDataImportUtil { public static StorageDetail retrieveStorageDetails(Parameters parameters) throws FHIROperationException { FHIRPathEvaluator evaluator = FHIRPathEvaluator.evaluator(); EvaluationContext evaluationContext = new EvaluationContext(parameters); try { Collection<FHIRPathNode> result = evaluator.evaluate(evaluationContext, "parameter.where(name = 'storageDetail')"); Iterator<FHIRPathNode> iter = result.iterator(); while (iter.hasNext()) { FHIRPathElementNode node = (FHIRPathElementNode) iter.next(); EvaluationContext evaluationContextPartType = new EvaluationContext(node.element()); Collection<FHIRPathNode> resultPartType = evaluator.evaluate(evaluationContextPartType, "value"); String type = ((FHIRPathElementNode) resultPartType.iterator().next()).element() .as(com.ibm.fhir.model.type.String.class).getValue(); if (!BulkDataConstants.STORAGE_TYPES.contains(type)) { throw buildExceptionWithIssue("$import invalid type in 'storageDetail'", IssueType.INVALID); } EvaluationContext evaluationContextPartContentEncoding = new EvaluationContext(node.element()); Collection<FHIRPathNode> resultPartContentEncoding = evaluator.evaluate(evaluationContextPartContentEncoding, "part.where(name = 'contentEncoding').value"); List<String> contentEncodings = new ArrayList<>(); Iterator<FHIRPathNode> iterEncoding = resultPartContentEncoding.iterator(); while (iterEncoding.hasNext()) { String contentEncoding = ((FHIRPathElementNode) iterEncoding.next()).element() .as(com.ibm.fhir.model.type.String.class).getValue(); checkValidContentEncoding(contentEncoding); contentEncodings.add(contentEncoding); } return new StorageDetail(type, contentEncodings); } } catch (FHIRPathException e) { throw buildExceptionWithIssue("$import invalid parameters with expression in 'input'", e, IssueType.INVALID); } throw buildExceptionWithIssue("$import required 'storageDetail' is not found", IssueType.INVALID); } private  BulkDataImportUtil(); static FHIROperationException buildExceptionWithIssue(String msg, IssueType issueType); static FHIROperationException buildExceptionWithIssue(String msg, Throwable cause, IssueType issueType); static String retrieveInputFormat(Parameters parameters); static String retrieveInputSource(Parameters parameters); static List<Input> retrieveInputs(Parameters parameters); static void checkAllowedTotalSizeForTenantOrSystem(Integer inputSize); static void verifyUrlAllowed(String url); static StorageDetail retrieveStorageDetails(Parameters parameters); }
BulkDataImportUtil { public static StorageDetail retrieveStorageDetails(Parameters parameters) throws FHIROperationException { FHIRPathEvaluator evaluator = FHIRPathEvaluator.evaluator(); EvaluationContext evaluationContext = new EvaluationContext(parameters); try { Collection<FHIRPathNode> result = evaluator.evaluate(evaluationContext, "parameter.where(name = 'storageDetail')"); Iterator<FHIRPathNode> iter = result.iterator(); while (iter.hasNext()) { FHIRPathElementNode node = (FHIRPathElementNode) iter.next(); EvaluationContext evaluationContextPartType = new EvaluationContext(node.element()); Collection<FHIRPathNode> resultPartType = evaluator.evaluate(evaluationContextPartType, "value"); String type = ((FHIRPathElementNode) resultPartType.iterator().next()).element() .as(com.ibm.fhir.model.type.String.class).getValue(); if (!BulkDataConstants.STORAGE_TYPES.contains(type)) { throw buildExceptionWithIssue("$import invalid type in 'storageDetail'", IssueType.INVALID); } EvaluationContext evaluationContextPartContentEncoding = new EvaluationContext(node.element()); Collection<FHIRPathNode> resultPartContentEncoding = evaluator.evaluate(evaluationContextPartContentEncoding, "part.where(name = 'contentEncoding').value"); List<String> contentEncodings = new ArrayList<>(); Iterator<FHIRPathNode> iterEncoding = resultPartContentEncoding.iterator(); while (iterEncoding.hasNext()) { String contentEncoding = ((FHIRPathElementNode) iterEncoding.next()).element() .as(com.ibm.fhir.model.type.String.class).getValue(); checkValidContentEncoding(contentEncoding); contentEncodings.add(contentEncoding); } return new StorageDetail(type, contentEncodings); } } catch (FHIRPathException e) { throw buildExceptionWithIssue("$import invalid parameters with expression in 'input'", e, IssueType.INVALID); } throw buildExceptionWithIssue("$import required 'storageDetail' is not found", IssueType.INVALID); } private  BulkDataImportUtil(); static FHIROperationException buildExceptionWithIssue(String msg, IssueType issueType); static FHIROperationException buildExceptionWithIssue(String msg, Throwable cause, IssueType issueType); static String retrieveInputFormat(Parameters parameters); static String retrieveInputSource(Parameters parameters); static List<Input> retrieveInputs(Parameters parameters); static void checkAllowedTotalSizeForTenantOrSystem(Integer inputSize); static void verifyUrlAllowed(String url); static StorageDetail retrieveStorageDetails(Parameters parameters);  }