Search in sources :

Example 1 with ConceptDescription

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;
}
Also used : PostConceptDescriptionResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostConceptDescriptionResponse) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription)

Example 2 with ConceptDescription

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);
}
Also used : KeyElements(io.adminshell.aas.v3.model.KeyElements) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) AASFull(de.fraunhofer.iosb.ilt.faaast.service.model.AASFull) AssetAdministrationShellEnvironment(io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment) SubmodelElementCollection(io.adminshell.aas.v3.model.SubmodelElementCollection) Extend(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Extend) Identifier(io.adminshell.aas.v3.model.Identifier) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) AssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification) Identifiable(io.adminshell.aas.v3.model.Identifiable) Message(de.fraunhofer.iosb.ilt.faaast.service.model.api.Message) DeepCopyHelper(de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper) KeyType(io.adminshell.aas.v3.model.KeyType) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) DefaultKey(io.adminshell.aas.v3.model.impl.DefaultKey) Level(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level) Before(org.junit.Before) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) IdentifierType(io.adminshell.aas.v3.model.IdentifierType) Reference(io.adminshell.aas.v3.model.Reference) Test(org.junit.Test) Persistence(de.fraunhofer.iosb.ilt.faaast.service.persistence.Persistence) Collectors(java.util.stream.Collectors) Result(de.fraunhofer.iosb.ilt.faaast.service.model.api.Result) OperationHandle(de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.OperationHandle) List(java.util.List) ExecutionState(de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.ExecutionState) ResourceNotFoundException(de.fraunhofer.iosb.ilt.faaast.service.exception.ResourceNotFoundException) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) OperationResult(de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.OperationResult) Assert(org.junit.Assert) Submodel(io.adminshell.aas.v3.model.Submodel) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) Test(org.junit.Test)

Example 3 with ConceptDescription

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);
}
Also used : QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) Test(org.junit.Test)

Example 4 with ConceptDescription

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);
}
Also used : KeyElements(io.adminshell.aas.v3.model.KeyElements) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) AASFull(de.fraunhofer.iosb.ilt.faaast.service.model.AASFull) AssetAdministrationShellEnvironment(io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment) SubmodelElementCollection(io.adminshell.aas.v3.model.SubmodelElementCollection) Extend(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Extend) Identifier(io.adminshell.aas.v3.model.Identifier) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) AssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification) Identifiable(io.adminshell.aas.v3.model.Identifiable) Message(de.fraunhofer.iosb.ilt.faaast.service.model.api.Message) DeepCopyHelper(de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper) KeyType(io.adminshell.aas.v3.model.KeyType) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) DefaultKey(io.adminshell.aas.v3.model.impl.DefaultKey) Level(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level) Before(org.junit.Before) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) IdentifierType(io.adminshell.aas.v3.model.IdentifierType) Reference(io.adminshell.aas.v3.model.Reference) Test(org.junit.Test) Persistence(de.fraunhofer.iosb.ilt.faaast.service.persistence.Persistence) Collectors(java.util.stream.Collectors) Result(de.fraunhofer.iosb.ilt.faaast.service.model.api.Result) OperationHandle(de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.OperationHandle) List(java.util.List) ExecutionState(de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.ExecutionState) ResourceNotFoundException(de.fraunhofer.iosb.ilt.faaast.service.exception.ResourceNotFoundException) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) OperationResult(de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.OperationResult) Assert(org.junit.Assert) Submodel(io.adminshell.aas.v3.model.Submodel) Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) Test(org.junit.Test)

Example 5 with ConceptDescription

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;
}
Also used : GetAllConceptDescriptionsByDataSpecificationReferenceResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsByDataSpecificationReferenceResponse) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription)

Aggregations

ConceptDescription (io.adminshell.aas.v3.model.ConceptDescription)18 ResourceNotFoundException (de.fraunhofer.iosb.ilt.faaast.service.exception.ResourceNotFoundException)8 QueryModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier)8 Test (org.junit.Test)7 AssetAdministrationShell (io.adminshell.aas.v3.model.AssetAdministrationShell)6 Identifier (io.adminshell.aas.v3.model.Identifier)6 Submodel (io.adminshell.aas.v3.model.Submodel)6 OutputModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier)5 AssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification)5 GlobalAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification)5 DeepCopyHelper (de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper)5 Identifiable (io.adminshell.aas.v3.model.Identifiable)5 Reference (io.adminshell.aas.v3.model.Reference)5 SubmodelElement (io.adminshell.aas.v3.model.SubmodelElement)5 DefaultIdentifier (io.adminshell.aas.v3.model.impl.DefaultIdentifier)5 List (java.util.List)5 Collectors (java.util.stream.Collectors)5 AASFull (de.fraunhofer.iosb.ilt.faaast.service.model.AASFull)4 Message (de.fraunhofer.iosb.ilt.faaast.service.model.api.Message)4 Result (de.fraunhofer.iosb.ilt.faaast.service.model.api.Result)4