Search in sources :

Example 16 with Location

use of org.hl7.fhir.dstu3.model.Location in project metacat by Netflix.

the class S3ConnectorInfoConverter method fromStorageInfo.

/**
 * Converts from storage info to s3 location.
 * @param storageInfo storage info
 * @return location
 */
Location fromStorageInfo(final StorageInfo storageInfo) {
    final Location result = new Location();
    if (storageInfo != null) {
        result.setUri(storageInfo.getUri());
        final Info info = new Info();
        info.setLocation(result);
        info.setOwner(storageInfo.getOwner());
        info.setInputFormat(storageInfo.getInputFormat());
        info.setOutputFormat(storageInfo.getOutputFormat());
        info.setSerializationLib(storageInfo.getSerializationLib());
        final Map<String, String> parameters = Maps.newHashMap();
        if (storageInfo.getParameters() != null) {
            parameters.putAll(storageInfo.getParameters());
        }
        if (storageInfo.getSerdeInfoParameters() != null) {
            parameters.putAll(storageInfo.getSerdeInfoParameters());
        }
        info.setParameters(parameters);
        result.setInfo(info);
    }
    return result;
}
Also used : AuditInfo(com.netflix.metacat.common.server.connectors.model.AuditInfo) DatabaseInfo(com.netflix.metacat.common.server.connectors.model.DatabaseInfo) FieldInfo(com.netflix.metacat.common.server.connectors.model.FieldInfo) PartitionInfo(com.netflix.metacat.common.server.connectors.model.PartitionInfo) StorageInfo(com.netflix.metacat.common.server.connectors.model.StorageInfo) Info(com.netflix.metacat.connector.s3.model.Info) TableInfo(com.netflix.metacat.common.server.connectors.model.TableInfo) Location(com.netflix.metacat.connector.s3.model.Location)

Example 17 with Location

use of org.hl7.fhir.dstu3.model.Location in project metacat by Netflix.

the class S3ConnectorInfoConverter method fromTableInfo.

@Override
public Table fromTableInfo(final TableInfo tableInfo) {
    final Table result = new Table();
    result.setName(tableInfo.getName().getTableName());
    final Location location = toLocation(tableInfo);
    if (location != null) {
        result.setLocation(location);
        location.setTable(result);
    }
    return result;
}
Also used : Table(com.netflix.metacat.connector.s3.model.Table) Location(com.netflix.metacat.connector.s3.model.Location)

Example 18 with Location

use of org.hl7.fhir.dstu3.model.Location in project metacat by Netflix.

the class S3ConnectorInfoConverter method toStorageInfo.

/**
 * Converts from s3 table info to storage info.
 * @param table table info
 * @return table info
 */
StorageInfo toStorageInfo(final Table table) {
    StorageInfo result = null;
    final Location location = table.getLocation();
    if (location != null) {
        final Map<String, String> infoParameters = Maps.newHashMap();
        result = new StorageInfo();
        result.setUri(location.getUri());
        final Info info = location.getInfo();
        if (info != null) {
            result.setOwner(info.getOwner());
            result.setInputFormat(info.getInputFormat());
            result.setOutputFormat(info.getOutputFormat());
            result.setSerializationLib(info.getSerializationLib());
            if (info.getParameters() != null) {
                infoParameters.putAll(info.getParameters());
            }
        }
        result.setSerdeInfoParameters(infoParameters);
        result.setParameters(Maps.newHashMap());
    }
    return result;
}
Also used : StorageInfo(com.netflix.metacat.common.server.connectors.model.StorageInfo) AuditInfo(com.netflix.metacat.common.server.connectors.model.AuditInfo) DatabaseInfo(com.netflix.metacat.common.server.connectors.model.DatabaseInfo) FieldInfo(com.netflix.metacat.common.server.connectors.model.FieldInfo) PartitionInfo(com.netflix.metacat.common.server.connectors.model.PartitionInfo) StorageInfo(com.netflix.metacat.common.server.connectors.model.StorageInfo) Info(com.netflix.metacat.connector.s3.model.Info) TableInfo(com.netflix.metacat.common.server.connectors.model.TableInfo) Location(com.netflix.metacat.connector.s3.model.Location)

Example 19 with Location

use of org.hl7.fhir.dstu3.model.Location in project metacat by Netflix.

the class S3ConnectorInfoConverter method getOwner.

/**
 * Gets the owner for the given table.
 * @param table table info
 * @return owner name
 */
public String getOwner(final Table table) {
    String result = null;
    final Location location = table.getLocation();
    if (location != null) {
        final Info info = location.getInfo();
        if (info != null) {
            result = info.getOwner();
        }
    }
    return result;
}
Also used : AuditInfo(com.netflix.metacat.common.server.connectors.model.AuditInfo) DatabaseInfo(com.netflix.metacat.common.server.connectors.model.DatabaseInfo) FieldInfo(com.netflix.metacat.common.server.connectors.model.FieldInfo) PartitionInfo(com.netflix.metacat.common.server.connectors.model.PartitionInfo) StorageInfo(com.netflix.metacat.common.server.connectors.model.StorageInfo) Info(com.netflix.metacat.connector.s3.model.Info) TableInfo(com.netflix.metacat.common.server.connectors.model.TableInfo) Location(com.netflix.metacat.connector.s3.model.Location)

Example 20 with Location

use of org.hl7.fhir.dstu3.model.Location in project gpconnect-demonstrator by nhsconnect.

the class LocationResourceProvider method locationDetailsToLocation.

/**
 * convert locationDetails to fhir resource
 * @param locationDetails
 * @return Location resource
 */
private Location locationDetailsToLocation(LocationDetails locationDetails) {
    Location location = new Location();
    String resourceId = String.valueOf(locationDetails.getId());
    String versionId = String.valueOf(locationDetails.getLastUpdated().getTime());
    String resourceType = location.getResourceType().toString();
    IdType id = new IdType(resourceType, resourceId, versionId);
    location.setId(id);
    location.getMeta().setVersionId(versionId);
    location.getMeta().setLastUpdated(locationDetails.getLastUpdated());
    location.getMeta().addProfile(SystemURL.SD_GPC_LOCATION);
    location.setName(locationDetails.getName());
    // #207 no site code
    // location.setIdentifier(Collections.singletonList(new Identifier().setSystem(SystemURL.ID_ODS_SITE_CODE).setValue(locationDetails.getSiteOdsCode())));
    // #246 remove type element
    // Coding locationCommTypeCode = new Coding();
    // locationCommTypeCode.setCode("COMM");
    // locationCommTypeCode.setSystem(SystemURL.VS_CC_SER_DEL_LOCROLETYPE);
    // locationCommTypeCode.setDisplay("Community Location");
    // 
    // Coding locationGachTypeCode = new Coding();
    // locationGachTypeCode.setCode("GACH");
    // locationGachTypeCode.setSystem(SystemURL.VS_CC_SER_DEL_LOCROLETYPE);
    // locationGachTypeCode.setDisplay("Hospitals; General Acute Care Hospital");
    // 
    // @SuppressWarnings("deprecation")
    // CodeableConcept locationType = new CodeableConcept();
    // locationType.addCoding(locationCommTypeCode);
    // locationType.addCoding(locationGachTypeCode);
    // location.setType(locationType);
    Organization orgz = FindOrganization(locationDetails.getOrgOdsCode());
    if (orgz != null) {
        Reference mngOrg = new Reference();
        mngOrg.setReference(orgz.getId());
        // #246 remove display element
        // mngOrg.setDisplay(orgz.getName());
        location.setManagingOrganization(mngOrg);
    }
    EnumSet<LocationStatus> statusList = EnumSet.allOf(LocationStatus.class);
    LocationStatus locationStatus = null;
    String status = locationDetails.getStatus();
    if (status != null) {
        for (LocationStatus statusItem : statusList) {
            if (statusItem.toCode().equalsIgnoreCase(status)) {
                locationStatus = statusItem;
                break;
            }
        }
    }
    location.setAddress(createAddress(locationDetails));
    location.setStatus(locationStatus);
    return location;
}
Also used : Organization(org.hl7.fhir.dstu3.model.Organization) Reference(org.hl7.fhir.dstu3.model.Reference) LocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus) Location(org.hl7.fhir.dstu3.model.Location) IdType(org.hl7.fhir.dstu3.model.IdType)

Aggregations

Location (com.netflix.metacat.connector.s3.model.Location)9 Location (com.google.api.services.appengine.v1.model.Location)6 TableInfo (com.netflix.metacat.common.server.connectors.model.TableInfo)6 Info (com.netflix.metacat.connector.s3.model.Info)6 FieldInfo (com.netflix.metacat.common.server.connectors.model.FieldInfo)5 AuditInfo (com.netflix.metacat.common.server.connectors.model.AuditInfo)4 DatabaseInfo (com.netflix.metacat.common.server.connectors.model.DatabaseInfo)4 PartitionInfo (com.netflix.metacat.common.server.connectors.model.PartitionInfo)4 StorageInfo (com.netflix.metacat.common.server.connectors.model.StorageInfo)4 Schema (com.netflix.metacat.connector.s3.model.Schema)4 Reference (org.hl7.fhir.dstu3.model.Reference)4 Field (com.netflix.metacat.connector.s3.model.Field)3 Table (com.netflix.metacat.connector.s3.model.Table)3 IdType (org.hl7.fhir.dstu3.model.IdType)3 Location (org.hl7.fhir.dstu3.model.Location)3 SlotDetail (uk.gov.hscic.model.appointment.SlotDetail)3 LocationDetails (uk.gov.hscic.model.location.LocationDetails)3 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)2 ListLocationsResponse (com.google.api.services.appengine.v1.model.ListLocationsResponse)2 QualifiedName (com.netflix.metacat.common.QualifiedName)2