@Test(expectedExceptions = { com.ibm.fhir.exception.FHIROperationException.class }) public void testCheckAndValidateJobInvalidType() throws FHIROperationException { List<Parameter> parameters = new ArrayList<>(); parameters.add(Parameter.builder().name(string("job")).value(PositiveInt.of(2)).build()); Parameters.Builder builder = Parameters.builder(); builder.id(UUID.randomUUID().toString()); builder.parameter(parameters); Parameters ps = builder.build(); BulkDataExportUtil.checkAndValidateJob(ps); fail(); }
public static String checkAndValidateJob(Parameters parameters) throws FHIROperationException { if (parameters != null) { for (Parameters.Parameter parameter : parameters.getParameter()) { if (BulkDataConstants.PARAM_JOB.equals(parameter.getName().getValue()) && parameter.getValue() != null && parameter.getValue().is(com.ibm.fhir.model.type.String.class)) { String job = decryptBatchJobId(parameter.getValue().as(com.ibm.fhir.model.type.String.class).getValue(), BulkDataConstants.BATCHJOBID_ENCRYPTION_KEY); if (job.contains("/") || job.contains("?")) { throw new FHIROperationException("job passed is invalid and is not supported"); } return job; } } } throw new FHIROperationException("no job identifier is passed"); }
BulkDataExportUtil { public static String checkAndValidateJob(Parameters parameters) throws FHIROperationException { if (parameters != null) { for (Parameters.Parameter parameter : parameters.getParameter()) { if (BulkDataConstants.PARAM_JOB.equals(parameter.getName().getValue()) && parameter.getValue() != null && parameter.getValue().is(com.ibm.fhir.model.type.String.class)) { String job = decryptBatchJobId(parameter.getValue().as(com.ibm.fhir.model.type.String.class).getValue(), BulkDataConstants.BATCHJOBID_ENCRYPTION_KEY); if (job.contains("/") || job.contains("?")) { throw new FHIROperationException("job passed is invalid and is not supported"); } return job; } } } throw new FHIROperationException("no job identifier is passed"); } }
BulkDataExportUtil { public static String checkAndValidateJob(Parameters parameters) throws FHIROperationException { if (parameters != null) { for (Parameters.Parameter parameter : parameters.getParameter()) { if (BulkDataConstants.PARAM_JOB.equals(parameter.getName().getValue()) && parameter.getValue() != null && parameter.getValue().is(com.ibm.fhir.model.type.String.class)) { String job = decryptBatchJobId(parameter.getValue().as(com.ibm.fhir.model.type.String.class).getValue(), BulkDataConstants.BATCHJOBID_ENCRYPTION_KEY); if (job.contains("/") || job.contains("?")) { throw new FHIROperationException("job passed is invalid and is not supported"); } return job; } } } throw new FHIROperationException("no job identifier is passed"); } private  BulkDataExportUtil(); }
BulkDataExportUtil { public static String checkAndValidateJob(Parameters parameters) throws FHIROperationException { if (parameters != null) { for (Parameters.Parameter parameter : parameters.getParameter()) { if (BulkDataConstants.PARAM_JOB.equals(parameter.getName().getValue()) && parameter.getValue() != null && parameter.getValue().is(com.ibm.fhir.model.type.String.class)) { String job = decryptBatchJobId(parameter.getValue().as(com.ibm.fhir.model.type.String.class).getValue(), BulkDataConstants.BATCHJOBID_ENCRYPTION_KEY); if (job.contains("/") || job.contains("?")) { throw new FHIROperationException("job passed is invalid and is not supported"); } return job; } } } throw new FHIROperationException("no job identifier is passed"); } private  BulkDataExportUtil(); static BulkDataConstants.ExportType checkExportType(FHIROperationContext.Type type,
            Class<? extends Resource> resourceType); static MediaType checkAndConvertToMediaType(Parameters parameters); static FHIROperationException buildOperationException(String errMsg, IssueType issueType); static Instant checkAndExtractSince(Parameters parameters); static List<String> checkAndValidateTypes(Parameters parameters); static List<String> checkAndValidateTypeFilters(Parameters parameters); static Parameters getOutputParametersWithJson(PollingLocationResponse resource); static String checkAndValidateJob(Parameters parameters); static String encryptBatchJobId(String strToEncrypt, SecretKeySpec key); static String decryptBatchJobId(String strToDecrypt, SecretKeySpec key); }
BulkDataExportUtil { public static String checkAndValidateJob(Parameters parameters) throws FHIROperationException { if (parameters != null) { for (Parameters.Parameter parameter : parameters.getParameter()) { if (BulkDataConstants.PARAM_JOB.equals(parameter.getName().getValue()) && parameter.getValue() != null && parameter.getValue().is(com.ibm.fhir.model.type.String.class)) { String job = decryptBatchJobId(parameter.getValue().as(com.ibm.fhir.model.type.String.class).getValue(), BulkDataConstants.BATCHJOBID_ENCRYPTION_KEY); if (job.contains("/") || job.contains("?")) { throw new FHIROperationException("job passed is invalid and is not supported"); } return job; } } } throw new FHIROperationException("no job identifier is passed"); } private  BulkDataExportUtil(); static BulkDataConstants.ExportType checkExportType(FHIROperationContext.Type type,
            Class<? extends Resource> resourceType); static MediaType checkAndConvertToMediaType(Parameters parameters); static FHIROperationException buildOperationException(String errMsg, IssueType issueType); static Instant checkAndExtractSince(Parameters parameters); static List<String> checkAndValidateTypes(Parameters parameters); static List<String> checkAndValidateTypeFilters(Parameters parameters); static Parameters getOutputParametersWithJson(PollingLocationResponse resource); static String checkAndValidateJob(Parameters parameters); static String encryptBatchJobId(String strToEncrypt, SecretKeySpec key); static String decryptBatchJobId(String strToDecrypt, SecretKeySpec key);  }