Search in sources :

Example 1 with GetAllConceptDescriptionsByDataSpecificationReferenceResponse

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

the class RequestHandlerManagerTest method testGetAllConceptDescriptionsByDataSpecificationReferenceRequest.

@Test
public void testGetAllConceptDescriptionsByDataSpecificationReferenceRequest() throws ResourceNotFoundException {
    Reference reference = ReferenceHelper.toReference(environment.getConceptDescriptions().get(0).getIdentification(), ConceptDescription.class);
    when(persistence.get(null, null, reference, new OutputModifier())).thenReturn(environment.getConceptDescriptions());
    GetAllConceptDescriptionsByDataSpecificationReferenceRequest request = new GetAllConceptDescriptionsByDataSpecificationReferenceRequest.Builder().outputModifier(new OutputModifier()).dataSpecification(reference).build();
    GetAllConceptDescriptionsByDataSpecificationReferenceResponse response = manager.execute(request);
    GetAllConceptDescriptionsByDataSpecificationReferenceResponse expected = new GetAllConceptDescriptionsByDataSpecificationReferenceResponse.Builder().payload(environment.getConceptDescriptions()).statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
}
Also used : GetAllConceptDescriptionsByDataSpecificationReferenceResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsByDataSpecificationReferenceResponse) OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) AtomicReference(java.util.concurrent.atomic.AtomicReference) GetAllConceptDescriptionsByDataSpecificationReferenceRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllConceptDescriptionsByDataSpecificationReferenceRequest) Test(org.junit.Test)

Example 2 with GetAllConceptDescriptionsByDataSpecificationReferenceResponse

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

the class GetAllConceptDescriptionsByDataSpecificationReferenceRequestHandler method process.

@Override
public GetAllConceptDescriptionsByDataSpecificationReferenceResponse process(GetAllConceptDescriptionsByDataSpecificationReferenceRequest request) {
    GetAllConceptDescriptionsByDataSpecificationReferenceResponse response = new GetAllConceptDescriptionsByDataSpecificationReferenceResponse();
    try {
        List<ConceptDescription> conceptDescriptions = persistence.get(null, null, request.getDataSpecificationReference(), 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 : GetAllConceptDescriptionsByDataSpecificationReferenceResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsByDataSpecificationReferenceResponse) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription)

Aggregations

GetAllConceptDescriptionsByDataSpecificationReferenceResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsByDataSpecificationReferenceResponse)2 OutputModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier)1 GetAllConceptDescriptionsByDataSpecificationReferenceRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllConceptDescriptionsByDataSpecificationReferenceRequest)1 ConceptDescription (io.adminshell.aas.v3.model.ConceptDescription)1 Reference (io.adminshell.aas.v3.model.Reference)1 DefaultReference (io.adminshell.aas.v3.model.impl.DefaultReference)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Test (org.junit.Test)1