Search in sources :

Example 76 with Location

use of com.walmartlabs.concord.runtime.v2.model.Location in project metacat by Netflix.

the class S3ConnectorInfoConverter method toFields.

private List<FieldInfo> toFields(final Table table) {
    List<FieldInfo> result = Lists.newArrayList();
    final Location location = table.getLocation();
    if (location != null) {
        final Schema schema = location.getSchema();
        if (schema != null) {
            result = schema.getFields().stream().sorted(Comparator.comparing(Field::getPos)).map(this::toFieldInfo).collect(Collectors.toList());
        }
    }
    return result;
}
Also used : Field(com.netflix.metacat.connector.s3.model.Field) Schema(com.netflix.metacat.connector.s3.model.Schema) FieldInfo(com.netflix.metacat.common.server.connectors.model.FieldInfo) Location(com.netflix.metacat.connector.s3.model.Location)

Example 77 with Location

use of com.walmartlabs.concord.runtime.v2.model.Location in project metacat by Netflix.

the class S3ConnectorInfoConverter method toAuditInfo.

/**
 * Creates audit info from s3 table info.
 * @param table table info
 * @return audit info
 */
public AuditInfo toAuditInfo(final Table table) {
    final AuditInfo result = AuditInfo.builder().createdDate(table.getCreatedDate()).lastModifiedDate(table.getLastUpdatedDate()).build();
    final Location location = table.getLocation();
    if (location != null) {
        final Info info = location.getInfo();
        if (info != null) {
            result.setCreatedBy(info.getOwner());
            result.setLastModifiedBy(info.getOwner());
        }
    }
    return result;
}
Also used : AuditInfo(com.netflix.metacat.common.server.connectors.model.AuditInfo) 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 78 with Location

use of com.walmartlabs.concord.runtime.v2.model.Location in project metacat by Netflix.

the class S3ConnectorInfoConverter method toLocation.

/**
 * Creates location.
 * @param tableInfo table info
 * @return location
 */
public Location toLocation(final TableInfo tableInfo) {
    final Location location = fromStorageInfo(tableInfo.getSerde());
    final Schema schema = new Schema();
    schema.setLocation(location);
    schema.setFields(toFields(tableInfo, schema));
    location.setSchema(schema);
    return location;
}
Also used : Schema(com.netflix.metacat.connector.s3.model.Schema) Location(com.netflix.metacat.connector.s3.model.Location)

Example 79 with Location

use of com.walmartlabs.concord.runtime.v2.model.Location in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineApplicationCreateDialog method doOKAction.

@Override
protected void doOKAction() {
    final Location selectedLocation = ((AppEngineLocationSelectorItem) regionComboBox.getSelectedItem()).getLocation();
    // show loading state
    disable();
    try {
        UsageTrackerProvider.getInstance().trackEvent(GctTracking.APP_ENGINE_APPLICATION_CREATE).ping();
        // attempt to create the application, and close the dialog if successful
        ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> AppEngineAdminService.getInstance().createApplication(selectedLocation.getLocationId(), gcpProjectId, userCredential), GctBundle.message("appengine.application.create.loading", selectedLocation.getLocationId()), true, /* cancellable */
        ProjectManager.getInstance().getDefaultProject());
        UsageTrackerProvider.getInstance().trackEvent(GctTracking.APP_ENGINE_APPLICATION_CREATE_SUCCESS).ping();
        close(OK_EXIT_CODE);
    } catch (IOException e) {
        trackApplicationCreateFailure();
        setStatusMessage(GctBundle.message("appengine.application.create.error.transient"), true);
    } catch (GoogleApiException e) {
        trackApplicationCreateFailure();
        setStatusMessage(e.getMessage(), true);
    } catch (Exception e) {
        trackApplicationCreateFailure();
        throw new RuntimeException(e);
    } finally {
        enable();
    }
}
Also used : IOException(java.io.IOException) IOException(java.io.IOException) Location(com.google.api.services.appengine.v1.model.Location)

Example 80 with Location

use of com.walmartlabs.concord.runtime.v2.model.Location in project google-cloud-intellij by GoogleCloudPlatform.

the class GoogleApiClientAppEngineAdminService method fetchAllAppEngineLocations.

private List<Location> fetchAllAppEngineLocations(Credential credential) throws GoogleApiException, IOException {
    try {
        ListLocationsResponse response = fetchAppEngineLocationPage(credential, null);
        List<Location> locations = new ArrayList<>(response.getLocations());
        while (response.getNextPageToken() != null) {
            response = fetchAppEngineLocationPage(credential, response.getNextPageToken());
            locations.addAll(response.getLocations());
        }
        return locations;
    } catch (GoogleJsonResponseException e) {
        throw GoogleApiException.from(e);
    }
}
Also used : GoogleJsonResponseException(com.google.api.client.googleapis.json.GoogleJsonResponseException) ListLocationsResponse(com.google.api.services.appengine.v1.model.ListLocationsResponse) ArrayList(java.util.ArrayList) Location(com.google.api.services.appengine.v1.model.Location)

Aggregations

Test (org.junit.Test)120 Location (org.hl7.fhir.r4.model.Location)93 Location (org.hl7.fhir.dstu3.model.Location)66 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)59 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)42 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)30 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)27 BaseFhirProvenanceResourceTest (org.openmrs.module.fhir2.providers.BaseFhirProvenanceResourceTest)21 StringAndListParam (ca.uhn.fhir.rest.param.StringAndListParam)20 StringOrListParam (ca.uhn.fhir.rest.param.StringOrListParam)20 StringParam (ca.uhn.fhir.rest.param.StringParam)20 ReferenceAndListParam (ca.uhn.fhir.rest.param.ReferenceAndListParam)16 ReferenceOrListParam (ca.uhn.fhir.rest.param.ReferenceOrListParam)16 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)16 MockIBundleProvider (org.openmrs.module.fhir2.providers.r4.MockIBundleProvider)16 TokenAndListParam (ca.uhn.fhir.rest.param.TokenAndListParam)13 Test (org.junit.jupiter.api.Test)13 ArrayList (java.util.ArrayList)11 HashSet (java.util.HashSet)11 TokenParam (ca.uhn.fhir.rest.param.TokenParam)10