use of io.adminshell.aas.v3.model.ConceptDescription in project FAAAST-Service by FraunhoferIOSB.
the class PostConceptDescriptionRequestHandler method process.
@Override
public PostConceptDescriptionResponse process(PostConceptDescriptionRequest request) {
PostConceptDescriptionResponse response = new PostConceptDescriptionResponse();
try {
ConceptDescription conceptDescription = (ConceptDescription) persistence.put(request.getConceptDescription());
response.setPayload(conceptDescription);
response.setStatusCode(StatusCode.SuccessCreated);
publishElementCreateEventMessage(AasUtils.toReference(conceptDescription), conceptDescription);
} catch (Exception ex) {
response.setStatusCode(StatusCode.ServerInternalError);
}
return response;
}
use of io.adminshell.aas.v3.model.ConceptDescription in project FAAAST-Service by FraunhoferIOSB.
the class PersistenceInMemoryTest method getConceptDescriptionsWithIdShortTest.
@Test
public void getConceptDescriptionsWithIdShortTest() {
String conceptDescriptionIdShort = "TestConceptDescription";
List<ConceptDescription> actualConceptDescriptions = this.persistence.get(conceptDescriptionIdShort, null, (Reference) null, new QueryModifier());
List<ConceptDescription> expectedConceptDescriptions = this.environment.getConceptDescriptions().stream().filter(x -> x.getIdShort().equalsIgnoreCase(conceptDescriptionIdShort)).collect(Collectors.toList());
Assert.assertEquals(expectedConceptDescriptions, actualConceptDescriptions);
}
use of io.adminshell.aas.v3.model.ConceptDescription in project FAAAST-Service by FraunhoferIOSB.
the class PersistenceInMemoryTest method putIdentifiableChangeTest.
@Test
public void putIdentifiableChangeTest() throws ResourceNotFoundException {
ConceptDescription expected = DeepCopyHelper.deepCopy(this.environment.getConceptDescriptions().get(0), this.environment.getConceptDescriptions().get(0).getClass());
String category = "NewCategory";
expected.setCategory(category);
this.persistence.put(expected);
ConceptDescription actual = (ConceptDescription) this.persistence.get(expected.getIdentification(), new QueryModifier());
Assert.assertEquals(expected, actual);
}
use of io.adminshell.aas.v3.model.ConceptDescription in project FAAAST-Service by FraunhoferIOSB.
the class PersistenceInMemoryTest method getConceptDescriptionsWithIsCaseOfTest.
@Test
public void getConceptDescriptionsWithIsCaseOfTest() {
String conceptDescriptionIdShort = "TestConceptDescription";
Reference isCaseOf = new DefaultReference.Builder().key(new DefaultKey.Builder().type(null).idType(KeyType.IRI).value("http://acplt.org/DataSpecifications/ConceptDescriptions/TestConceptDescription").build()).build();
List<ConceptDescription> actualConceptDescriptions = this.persistence.get(null, isCaseOf, (Reference) null, new QueryModifier());
List<ConceptDescription> expectedConceptDescriptions = this.environment.getConceptDescriptions().stream().filter(x -> x.getIdShort().equalsIgnoreCase(conceptDescriptionIdShort)).collect(Collectors.toList());
Assert.assertEquals(actualConceptDescriptions, expectedConceptDescriptions);
}
use of io.adminshell.aas.v3.model.ConceptDescription 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;
}
Aggregations