Search in sources :

Example 1 with UrlType

use of org.hl7.fhir.r4b.model.UrlType in project org.hl7.fhir.core by hapifhir.

the class UrlTypeNullTest method equalsDeep.

@Test
@DisplayName("Test null value equalsDeep()")
void equalsDeep() {
    UrlType nullUrl = new UrlType();
    UrlType validUrl = new UrlType("tinyurl.com/45mpbc5d");
    Assertions.assertFalse(nullUrl.equalsDeep(validUrl));
}
Also used : UrlType(org.hl7.fhir.r4b.model.UrlType) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 2 with UrlType

use of org.hl7.fhir.r4b.model.UrlType in project org.hl7.fhir.core by hapifhir.

the class UrlTypeNullTest method typedCopy.

@Test
@DisplayName("Test null value typedCopy()")
void typedCopy() {
    UrlType nullUrl = new UrlType();
    UrlType copyUrl = (UrlType) nullUrl.typedCopy();
    Assertions.assertNull(copyUrl.getValue());
}
Also used : UrlType(org.hl7.fhir.r4b.model.UrlType) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 3 with UrlType

use of org.hl7.fhir.r4b.model.UrlType in project fhir-bridge by ehrbase.

the class SmartOnFhirAuthorizationInterceptor method addSmartOFWildcardAccess.

/*Allows wildcard access for CRUD operations for a
   *particular FHIR resource type. Read access allows search, as long as there is a subject
   * criteria that matches the patient provided in the access token.
   * @param pSmartOnFhirPatientId The value from the patient claim of OAuth2 access token
   * @param rules The collection to which rules are added. These will be used for access
   * control later by the HAPI FHIR pipeline
   * @param pResourceType The FHIR resource type for which the wildcard access will apply.
   */
private void addSmartOFWildcardAccess(String pSmartOnFhirPatientId, List<IAuthRule> rules, Class<? extends Resource> pResourceType) {
    IdType sofId = new IdType(new UrlType(patientUrl + pSmartOnFhirPatientId));
    rules.addAll(buildCreateRule("rule_create_own_sof_" + pResourceType.getSimpleName() + RESOURCE_POSTFIX, pResourceType, Patient.class.getSimpleName(), sofId));
    rules.addAll(buildReadRule("rule_read_own_sof_" + pResourceType.getSimpleName() + RESOURCE_POSTFIX, pResourceType, Patient.class.getSimpleName(), sofId));
    rules.addAll(buildWriteRule("rule_write_own_sof_" + pResourceType.getSimpleName() + RESOURCE_POSTFIX, pResourceType, Patient.class.getSimpleName(), sofId));
    rules.addAll(buildDeleteRule("rule_delete_own_sof_" + pResourceType.getSimpleName() + RESOURCE_POSTFIX, pResourceType, Patient.class.getSimpleName(), sofId));
}
Also used : UrlType(org.hl7.fhir.r4.model.UrlType) IdType(org.hl7.fhir.r4.model.IdType)

Example 4 with UrlType

use of org.hl7.fhir.r4b.model.UrlType in project pathling by aehrc.

the class ExtractResponse method toParameters.

/**
 * Converts this to a {@link Parameters} resource, based on the definition of the result of the
 * "extract" operation within the OperationDefinition.
 *
 * @return a new {@link Parameters} object
 */
public Parameters toParameters() {
    final Parameters parameters = new Parameters();
    final ParametersParameterComponent urlParameter = new ParametersParameterComponent();
    urlParameter.setName("url");
    urlParameter.setValue(new UrlType(url));
    parameters.getParameter().add(urlParameter);
    return parameters;
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) UrlType(org.hl7.fhir.r4.model.UrlType) ParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent)

Example 5 with UrlType

use of org.hl7.fhir.r4b.model.UrlType in project pathling by aehrc.

the class TestDataImporter method run.

@Override
public void run(final String... args) {
    final String sourcePath = args[0];
    final File srcNdJsonDir = new File(sourcePath);
    final FileFilter fileFilter = new WildcardFileFilter("*.ndjson");
    final File[] srcNdJsonFiles = srcNdJsonDir.listFiles(fileFilter);
    final List<ParametersParameterComponent> sources = Stream.of(Objects.requireNonNull(srcNdJsonFiles)).map(file -> {
        final String resourceName = FilenameUtils.getBaseName(file.getName());
        final ResourceType subjectResource = ResourceType.valueOf(resourceName.toUpperCase());
        final ParametersParameterComponent source = new ParametersParameterComponent();
        source.setName("source");
        final ParametersParameterComponent resourceType = new ParametersParameterComponent();
        resourceType.setName("resourceType");
        resourceType.setValue(new CodeType(subjectResource.toCode()));
        source.addPart(resourceType);
        final ParametersParameterComponent url = new ParametersParameterComponent();
        url.setName("url");
        url.setValue(new UrlType("file://" + file.toPath()));
        source.addPart(url);
        return source;
    }).collect(Collectors.toList());
    final Parameters parameters = new Parameters();
    parameters.setParameter(sources);
    importExecutor.execute(parameters);
}
Also used : ParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent) UrlType(org.hl7.fhir.r4.model.UrlType) SpringBootApplication(org.springframework.boot.autoconfigure.SpringBootApplication) Autowired(org.springframework.beans.factory.annotation.Autowired) ResourceType(org.hl7.fhir.r4.model.Enumerations.ResourceType) Collectors(java.util.stream.Collectors) Profile(org.springframework.context.annotation.Profile) File(java.io.File) ComponentScan(org.springframework.context.annotation.ComponentScan) ImportExecutor(au.csiro.pathling.update.ImportExecutor) Objects(java.util.Objects) SpringApplication(org.springframework.boot.SpringApplication) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) FileFilter(java.io.FileFilter) Stream(java.util.stream.Stream) WildcardFileFilter(jodd.io.filter.WildcardFileFilter) Parameters(org.hl7.fhir.r4.model.Parameters) CodeType(org.hl7.fhir.r4.model.CodeType) CommandLineRunner(org.springframework.boot.CommandLineRunner) Nonnull(javax.annotation.Nonnull) FilenameUtils(org.apache.commons.io.FilenameUtils) SparkSession(org.apache.spark.sql.SparkSession) Parameters(org.hl7.fhir.r4.model.Parameters) CodeType(org.hl7.fhir.r4.model.CodeType) ResourceType(org.hl7.fhir.r4.model.Enumerations.ResourceType) FileFilter(java.io.FileFilter) WildcardFileFilter(jodd.io.filter.WildcardFileFilter) File(java.io.File) WildcardFileFilter(jodd.io.filter.WildcardFileFilter) UrlType(org.hl7.fhir.r4.model.UrlType) ParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent)

Aggregations

UrlType (org.hl7.fhir.r4b.model.UrlType)6 Test (org.junit.jupiter.api.Test)6 Parameters (org.hl7.fhir.r4.model.Parameters)5 UrlType (org.hl7.fhir.r4.model.UrlType)5 DisplayName (org.junit.jupiter.api.DisplayName)5 ParametersParameterComponent (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent)4 Nonnull (javax.annotation.Nonnull)3 CodeType (org.hl7.fhir.r4.model.CodeType)3 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Slf4j (lombok.extern.slf4j.Slf4j)2 SparkSession (org.apache.spark.sql.SparkSession)2 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)2 StringType (org.hl7.fhir.r5.model.StringType)2 UrlType (org.hl7.fhir.r5.model.UrlType)2 FhirEncoders (au.csiro.pathling.encoders.FhirEncoders)1 UnsupportedResourceError (au.csiro.pathling.encoders.UnsupportedResourceError)1 InvalidUserInputError (au.csiro.pathling.errors.InvalidUserInputError)1 SecurityError (au.csiro.pathling.errors.SecurityError)1 FhirContextFactory (au.csiro.pathling.fhir.FhirContextFactory)1