Search in sources :

Example 1 with GetAllConceptDescriptionsResponse

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

the class GetAllConceptDescriptionsRequestHandler method process.

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

Example 2 with GetAllConceptDescriptionsResponse

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

the class RequestHandlerManagerTest method testGetAllConceptDescriptionsRequest.

@Test
public void testGetAllConceptDescriptionsRequest() throws ResourceNotFoundException {
    when(persistence.get(null, null, null, new OutputModifier())).thenReturn(environment.getConceptDescriptions());
    GetAllConceptDescriptionsRequest request = new GetAllConceptDescriptionsRequest.Builder().outputModifier(new OutputModifier()).build();
    GetAllConceptDescriptionsResponse response = manager.execute(request);
    GetAllConceptDescriptionsResponse expected = new GetAllConceptDescriptionsResponse.Builder().payload(environment.getConceptDescriptions()).statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
}
Also used : OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) GetAllConceptDescriptionsResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsResponse) GetAllConceptDescriptionsRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllConceptDescriptionsRequest) Test(org.junit.Test)

Aggregations

GetAllConceptDescriptionsResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsResponse)2 OutputModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier)1 GetAllConceptDescriptionsRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllConceptDescriptionsRequest)1 ConceptDescription (io.adminshell.aas.v3.model.ConceptDescription)1 Test (org.junit.Test)1