use of io.adminshell.aas.v3.model.AssetAdministrationShell in project FAAAST-Service by FraunhoferIOSB.
the class GetAllSubmodelsReferencesRequestHandler method process.
@Override
public GetAllSubmodelReferencesResponse process(GetAllSubmodelReferencesRequest request) {
GetAllSubmodelReferencesResponse response = new GetAllSubmodelReferencesResponse();
try {
AssetAdministrationShell shell = (AssetAdministrationShell) persistence.get(request.getId(), request.getOutputModifier());
List<Reference> submodelReferences = shell.getSubmodels();
response.setPayload(submodelReferences);
response.setStatusCode(StatusCode.Success);
publishElementReadEventMessage(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 GetAssetAdministrationShellByIdRequestHandler method process.
@Override
public GetAssetAdministrationShellByIdResponse process(GetAssetAdministrationShellByIdRequest request) {
GetAssetAdministrationShellByIdResponse response = new GetAssetAdministrationShellByIdResponse();
try {
AssetAdministrationShell shell = (AssetAdministrationShell) persistence.get(request.getId(), request.getOutputModifier());
response.setPayload(shell);
response.setStatusCode(StatusCode.Success);
publishElementReadEventMessage(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 GetAssetInformationRequestHandler method process.
@Override
public GetAssetInformationResponse process(GetAssetInformationRequest request) {
GetAssetInformationResponse response = new GetAssetInformationResponse();
try {
AssetAdministrationShell shell = (AssetAdministrationShell) persistence.get(request.getId(), new QueryModifier());
response.setPayload(shell.getAssetInformation());
response.setStatusCode(StatusCode.Success);
publishElementReadEventMessage(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 DeleteAssetAdministrationShellByIdRequestHandler method process.
@Override
public DeleteAssetAdministrationShellByIdResponse process(DeleteAssetAdministrationShellByIdRequest request) {
DeleteAssetAdministrationShellByIdResponse response = new DeleteAssetAdministrationShellByIdResponse();
try {
AssetAdministrationShell shell = (AssetAdministrationShell) persistence.get(request.getId(), new QueryModifier());
persistence.remove(request.getId());
response.setStatusCode(StatusCode.Success);
publishElementDeleteEventMessage(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 DeleteSubmodelReferenceRequestHandler method process.
@Override
public DeleteSubmodelReferenceResponse process(DeleteSubmodelReferenceRequest request) {
DeleteSubmodelReferenceResponse response = new DeleteSubmodelReferenceResponse();
try {
AssetAdministrationShell aas = (AssetAdministrationShell) persistence.get(request.getId(), new QueryModifier());
aas.getSubmodels().remove(request.getSubmodelRef());
persistence.put(aas);
response.setStatusCode(StatusCode.Success);
publishElementUpdateEventMessage(AasUtils.toReference(aas), aas);
} catch (ResourceNotFoundException ex) {
response.setStatusCode(StatusCode.ClientErrorResourceNotFound);
} catch (Exception ex) {
response.setStatusCode(StatusCode.ServerInternalError);
}
return response;
}
Aggregations