Search in sources :

Example 1 with Location

use of org.hl7.fhir.dstu3.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 2 with Location

use of org.hl7.fhir.dstu3.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)

Example 3 with Location

use of org.hl7.fhir.dstu3.model.Location in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineLocationSelectorItemTest method setup.

@Before
public void setup() {
    location = new Location();
    location.setMetadata(new HashMap<>());
}
Also used : Location(com.google.api.services.appengine.v1.model.Location) Before(org.junit.Before)

Example 4 with Location

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

the class S3ConnectorTableService method update.

@Override
public void update(@Nonnull final ConnectorRequestContext context, @Nonnull final TableInfo tableInfo) {
    log.debug("Start: Update table {}", tableInfo.getName());
    final QualifiedName tableName = tableInfo.getName();
    final Table table = tableDao.getBySourceDatabaseTableName(catalogName, tableName.getDatabaseName(), tableName.getTableName());
    if (table == null) {
        throw new TableNotFoundException(tableName);
    }
    // we can update the fields, the uri, or the full serde
    final Location newLocation = infoConverter.toLocation(tableInfo);
    Location location = table.getLocation();
    if (location == null) {
        location = new Location();
        location.setTable(table);
        table.setLocation(location);
    }
    if (newLocation.getUri() != null) {
        location.setUri(newLocation.getUri());
    }
    final Info newInfo = newLocation.getInfo();
    if (newInfo != null) {
        final Info info = location.getInfo();
        if (info == null) {
            location.setInfo(newInfo);
            newInfo.setLocation(location);
        } else {
            if (newInfo.getInputFormat() != null) {
                info.setInputFormat(newInfo.getInputFormat());
            }
            if (newInfo.getOutputFormat() != null) {
                info.setOutputFormat(newInfo.getOutputFormat());
            }
            if (newInfo.getOwner() != null) {
                info.setOwner(newInfo.getOwner());
            }
            if (newInfo.getSerializationLib() != null) {
                info.setSerializationLib(newInfo.getSerializationLib());
            }
            if (newInfo.getParameters() != null && !newInfo.getParameters().isEmpty()) {
                info.setParameters(newInfo.getParameters());
            }
        }
    }
    final Schema newSchema = newLocation.getSchema();
    if (newSchema != null) {
        final List<Field> newFields = newSchema.getFields();
        if (newFields != null && !newFields.isEmpty()) {
            final Schema schema = location.getSchema();
            if (schema == null) {
                location.setSchema(newSchema);
                newSchema.setLocation(location);
            } else {
                final List<Field> fields = schema.getFields();
                if (fields.isEmpty()) {
                    newFields.forEach(field -> {
                        field.setSchema(schema);
                        fields.add(field);
                    });
                } else {
                    for (int i = 0; i < newFields.size(); i++) {
                        final Field newField = newFields.get(i);
                        newField.setPos(i);
                        newField.setSchema(schema);
                        if (newField.getType() == null) {
                            newField.setType(newField.getSourceType());
                        }
                    }
                    schema.setFields(null);
                    fieldDao.delete(fields);
                    tableDao.save(table, true);
                    schema.setFields(newFields);
                }
            }
        }
    }
    log.debug("End: Update table {}", tableInfo.getName());
}
Also used : TableNotFoundException(com.netflix.metacat.common.server.connectors.exception.TableNotFoundException) Field(com.netflix.metacat.connector.s3.model.Field) Table(com.netflix.metacat.connector.s3.model.Table) QualifiedName(com.netflix.metacat.common.QualifiedName) Schema(com.netflix.metacat.connector.s3.model.Schema) 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 5 with Location

use of org.hl7.fhir.dstu3.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)

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