use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class PutAssetAdministrationShellRequestHandler method process.
@Override
public PutAssetAdministrationShellResponse process(PutAssetAdministrationShellRequest request) {
PutAssetAdministrationShellResponse response = new PutAssetAdministrationShellResponse();
try {
AssetAdministrationShell shell = (AssetAdministrationShell) persistence.get(request.getAas().getIdentification(), new OutputModifier());
shell = (AssetAdministrationShell) persistence.put(request.getAas());
response.setPayload(shell);
response.setStatusCode(StatusCode.Success);
publishElementUpdateEventMessage(AasUtils.toReference(shell), shell);
} catch (ResourceNotFoundException ex) {
response.setStatusCode(StatusCode.ClientErrorResourceNotFound);
} catch (Exception ex) {
response.setStatusCode(StatusCode.ServerInternalError);
}
return response;
}
use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class PutAssetInformationRequestHandler method process.
@Override
public PutAssetInformationResponse process(PutAssetInformationRequest request) {
PutAssetInformationResponse response = new PutAssetInformationResponse();
try {
AssetAdministrationShell shell = (AssetAdministrationShell) persistence.get(request.getId(), new QueryModifier());
shell.setAssetInformation(request.getAssetInformation());
persistence.put(shell);
response.setStatusCode(StatusCode.Success);
publishElementUpdateEventMessage(AasUtils.toReference(shell), shell);
} catch (Exception ex) {
response.setStatusCode(StatusCode.ServerInternalError);
}
return response;
}
use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testDELETESpecificShellEvent.
@Test
public void testDELETESpecificShellEvent() {
AssetAdministrationShell expected = environment.getAssetAdministrationShells().get(1);
String identifier = Base64.getUrlEncoder().encodeToString(expected.getIdentification().getIdentifier().getBytes(StandardCharsets.UTF_8));
String url = HTTP_SHELLS + "/" + identifier;
setUpEventCheck(expected, ElementDeleteEventMessage.class, () -> deleteCall(url));
}
use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testGETSpecificShellEvent.
@Test
public void testGETSpecificShellEvent() {
AssetAdministrationShell expected = environment.getAssetAdministrationShells().get(1);
setUpEventCheck(expected, ElementReadEventMessage.class, () -> getCall(HTTP_SHELLS + "/" + Base64.getUrlEncoder().encodeToString(expected.getIdentification().getIdentifier().getBytes(StandardCharsets.UTF_8)), AssetAdministrationShell.class));
}
use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class IntegrationTestHttpEndpoint method testPOSTShellEvent.
@Test
public void testPOSTShellEvent() {
AssetAdministrationShell newShell = getNewShell();
setUpEventCheck(newShell, ElementCreateEventMessage.class, () -> postCall(HTTP_SHELLS, newShell, AssetAdministrationShell.class));
}
Aggregations