use of org.geotoolkit.ows.xml.v110.Operation in project java-docs-samples by GoogleCloudPlatform.
the class SnippetsIT method createImage.
private static Image createImage(Disk srcDisk) throws IOException, InterruptedException, ExecutionException {
try (ImagesClient imagesClient = ImagesClient.create()) {
Image image = Image.newBuilder().setName("test-img-" + UUID.randomUUID()).setSourceDisk(srcDisk.getSelfLink()).build();
OperationFuture<Operation, Operation> operation = imagesClient.insertAsync(PROJECT_ID, image);
operation.get();
return imagesClient.get(PROJECT_ID, image.getName());
}
}
use of org.geotoolkit.ows.xml.v110.Operation in project java-docs-samples by GoogleCloudPlatform.
the class SnippetsIT method createSourceDisk.
private static Disk createSourceDisk() throws IOException, ExecutionException, InterruptedException {
try (DisksClient disksClient = DisksClient.create()) {
Disk disk = Disk.newBuilder().setSourceImage(getActiveDebian().getSelfLink()).setName("test-disk-" + UUID.randomUUID()).build();
OperationFuture<Operation, Operation> operation = disksClient.insertAsync(PROJECT_ID, ZONE, disk);
// Wait for the operation to complete.
operation.get();
return disksClient.get(PROJECT_ID, ZONE, disk.getName());
}
}
use of org.geotoolkit.ows.xml.v110.Operation in project java-docs-samples by GoogleCloudPlatform.
the class SnippetsIT method deleteDisk.
private static void deleteDisk(Disk disk) throws IOException, InterruptedException, ExecutionException {
try (DisksClient disksClient = DisksClient.create()) {
OperationFuture<Operation, Operation> operation = disksClient.deleteAsync(PROJECT_ID, ZONE, disk.getName());
operation.get();
}
}
use of org.geotoolkit.ows.xml.v110.Operation in project geo-platform by geosdi.
the class CatalogCapabilitiesTest method testGetCapabilitiesWithConnector.
@Test
public void testGetCapabilitiesWithConnector() throws Exception {
URL url = new URL("http://catalog.geosdi.org/geonetwork/srv/eng/csw");
GPCatalogConnectorStore serverConnector = newConnector().withServerUrl(url).build();
CatalogGetCapabilitiesRequest<CapabilitiesType> request = serverConnector.createGetCapabilitiesRequest();
CapabilitiesType response = request.getResponse();
logger.info("CSW GET_CAPABILITIES VERSION @@@@@@@@@@@@@@@@@@@@@@@ {}", response.getVersion());
List<Operation> operationList = response.getOperationsMetadata().getOperation();
for (Operation operation : operationList) {
String operationName = operation.getName();
if ("GetRecordById".equals(operationName)) {
List<DomainType> parameterList = operation.getParameter();
for (DomainType parameter : parameterList) {
String parameterName = parameter.getName();
if ("outputSchema".equals(parameterName)) {
List<String> valueList = parameter.getValue();
logger.info("########################### outputSchema\n");
for (String value : valueList) {
logger.info("*** {}", value);
}
}
}
}
}
}
use of org.geotoolkit.ows.xml.v110.Operation in project idempiere by idempiere.
the class CompositeServiceImpl method performOperations.
/**
* Perform operation
* @param trx
* @param ops
* @param modelADService
* @param compResp
* @param respAggregator
* @param reqlogin
* @return isError
*/
private boolean performOperations(Trx trx, Operation[] ops, ModelADServiceImpl modelADService, CompositeResponse compResp, ArrayList<StandardResponse> respAggregator, ADLoginRequest reqlogin) {
for (Operation operation : ops) {
if (operation.getPreCommit()) {
if (!commitTrx(trx, compResp, respAggregator, "Cannot commit before Operation", true)) {
return false;
}
}
modelADService.setManageTrx(false);
TargetPort.Enum portEnum = operation.getTargetPort();
StandardResponseDocument respDoc = null;
if (portEnum == TargetPort.CREATE_DATA) {
ModelCRUDRequestDocument wrapperDoc = getWrappedCRUD(operation, reqlogin);
if (wrapperDoc == null) {
rollbackAndSetError(trx, compResp, respAggregator, "Operation createData must required ModelCRUD");
return false;
} else {
respDoc = modelADService.createData(wrapperDoc);
}
} else if (portEnum == TargetPort.DELETE_DATA) {
ModelCRUDRequestDocument wrapperDoc = getWrappedCRUD(operation, reqlogin);
if (wrapperDoc == null) {
rollbackAndSetError(trx, compResp, respAggregator, "Operation deleteData must required ModelCRUD");
return false;
} else {
respDoc = modelADService.deleteData(wrapperDoc);
}
} else if (portEnum == TargetPort.CREATE_UPDATE_DATA) {
ModelCRUDRequestDocument wrapperDoc = getWrappedCRUD(operation, reqlogin);
if (wrapperDoc == null) {
rollbackAndSetError(trx, compResp, respAggregator, "Operation createUpdateData must required ModelCRUD");
return false;
} else {
respDoc = modelADService.createUpdateData(wrapperDoc);
}
} else if (portEnum == TargetPort.READ_DATA) {
ModelCRUDRequestDocument wrapperDoc = getWrappedCRUD(operation, reqlogin);
if (wrapperDoc == null) {
// Do not rollback, Continue with consecutive operations
respDoc = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = respDoc.addNewStandardResponse();
resp.setIsError(false);
resp.setError("Operation readData must required ModelCRUD");
} else {
WindowTabDataDocument dataResponse = modelADService.readData(wrapperDoc);
if (dataResponse != null) {
respDoc = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = respDoc.addNewStandardResponse();
// Do not fail though read is failed
resp.setIsError(false);
resp.setWindowTabData(dataResponse.getWindowTabData());
}
}
} else if (portEnum == TargetPort.RUN_PROCESS) {
if (operation.getModelRunProcess() == null) {
rollbackAndSetError(trx, compResp, respAggregator, "Operation runProcess must required ModelRunProcess");
return false;
}
ModelRunProcessRequestDocument wrapperDoc = ModelRunProcessRequestDocument.Factory.newInstance();
ModelRunProcessRequest runProcessReq = wrapperDoc.addNewModelRunProcessRequest();
runProcessReq.setADLoginRequest(reqlogin);
runProcessReq.setModelRunProcess(operation.getModelRunProcess());
RunProcessResponseDocument runResponse = modelADService.runProcess(wrapperDoc);
if (runResponse != null) {
respDoc = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = respDoc.addNewStandardResponse();
resp.setIsError(runResponse.getRunProcessResponse().getIsError());
resp.setRunProcessResponse(runResponse.getRunProcessResponse());
}
} else if (portEnum == TargetPort.SET_DOC_ACTION) {
if (operation.getModelSetDocAction() == null) {
rollbackAndSetError(trx, compResp, respAggregator, "Operation updateData must required ModelSetDocAction");
return false;
}
ModelSetDocActionRequestDocument wrapperDoc = ModelSetDocActionRequestDocument.Factory.newInstance();
ModelSetDocActionRequest actionReq = wrapperDoc.addNewModelSetDocActionRequest();
actionReq.setADLoginRequest(reqlogin);
actionReq.setModelSetDocAction(operation.getModelSetDocAction());
respDoc = modelADService.setDocAction(wrapperDoc);
} else if (portEnum == TargetPort.UPDATE_DATA) {
ModelCRUDRequestDocument wrapperDoc = getWrappedCRUD(operation, reqlogin);
if (wrapperDoc == null) {
rollbackAndSetError(trx, compResp, respAggregator, "Operation updateData must required ModelCRUD");
return false;
} else {
respDoc = modelADService.updateData(wrapperDoc);
}
}
if (respDoc != null)
respAggregator.add(respDoc.getStandardResponse());
if (respDoc != null && respDoc.getStandardResponse().getIsError()) {
rollbackAndSetError(trx, compResp, respAggregator, null);
return false;
}
if (operation.getPostCommit()) {
if (!commitTrx(trx, compResp, respAggregator, "Cannot commit after operation", false)) {
return false;
}
}
}
return true;
}
Aggregations