Search in sources :

Example 1 with GetAllAssetAdministrationShellsByIdShortResponse

use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByIdShortResponse in project FAAAST-Service by FraunhoferIOSB.

the class GetAllAssetAdministrationShellsByIdShortRequestHandler method process.

@Override
public GetAllAssetAdministrationShellsByIdShortResponse process(GetAllAssetAdministrationShellsByIdShortRequest request) {
    GetAllAssetAdministrationShellsByIdShortResponse response = new GetAllAssetAdministrationShellsByIdShortResponse();
    try {
        List<AssetAdministrationShell> shells = persistence.get(request.getIdShort(), (List<AssetIdentification>) null, request.getOutputModifier());
        response.setPayload(shells);
        response.setStatusCode(StatusCode.Success);
        if (shells != null) {
            shells.forEach(x -> publishElementReadEventMessage(AasUtils.toReference(x), x));
        }
    } catch (Exception ex) {
        response.setStatusCode(StatusCode.ServerInternalError);
    }
    return response;
}
Also used : AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) AssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification) GetAllAssetAdministrationShellsByIdShortResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByIdShortResponse)

Example 2 with GetAllAssetAdministrationShellsByIdShortResponse

use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByIdShortResponse in project FAAAST-Service by FraunhoferIOSB.

the class RequestHandlerManagerTest method testGetAllAssetAdministrationShellsByIdShortRequest.

@Test
public void testGetAllAssetAdministrationShellsByIdShortRequest() {
    when(persistence.get(eq("Test"), argThat((List<AssetIdentification> t) -> true), any())).thenReturn(environment.getAssetAdministrationShells());
    GetAllAssetAdministrationShellsByIdShortRequest request = new GetAllAssetAdministrationShellsByIdShortRequest.Builder().idShort("Test").build();
    GetAllAssetAdministrationShellsByIdShortResponse response = manager.execute(request);
    GetAllAssetAdministrationShellsByIdShortResponse expected = new GetAllAssetAdministrationShellsByIdShortResponse.Builder().payload(environment.getAssetAdministrationShells()).statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
}
Also used : SpecificAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.SpecificAssetIdentification) AssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) GetAllAssetAdministrationShellsByIdShortResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByIdShortResponse) GetAllAssetAdministrationShellsByIdShortRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsByIdShortRequest) Test(org.junit.Test)

Aggregations

GetAllAssetAdministrationShellsByIdShortResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByIdShortResponse)2 AssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification)2 GlobalAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification)1 SpecificAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.SpecificAssetIdentification)1 GetAllAssetAdministrationShellsByIdShortRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsByIdShortRequest)1 AssetAdministrationShell (io.adminshell.aas.v3.model.AssetAdministrationShell)1 Test (org.junit.Test)1