summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--model/basic-model/pom.xml10
-rw-r--r--model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxArtifactKey.java376
-rw-r--r--model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKeyInformation.java448
-rw-r--r--model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/impl/DefaultApexDao.java526
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexConceptException.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/ApexConceptException.java)2
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexException.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/ApexException.java)10
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexRuntimeException.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/ApexRuntimeException.java)2
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java384
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxConcept.java)32
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetter.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxConceptGetter.java)2
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetterImpl.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxConceptGetterImpl.java)30
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKey.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKey.java)39
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKeyInfo.java)79
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java460
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKeyUse.java)79
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxModel.java)178
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxReferenceKey.java)163
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxValidationMessage.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxValidationMessage.java)20
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxValidationResult.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxValidationResult.java)65
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/package-info.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/package-info.java)16
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/ApexDao.java)22
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/ApexDaoFactory.java)28
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DAOParameters.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/DAOParameters.java)23
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDATAConditioner.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/converters/CDATAConditioner.java)17
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/UUID2String.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/converters/UUID2String.java)2
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/package-info.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/converters/package-info.java)17
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java520
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/impl/package-info.java)4
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/package-info.java)18
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelCreator.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelCreator.java)4
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelException.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelException.java)4
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelFileWriter.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelFileWriter.java)6
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelReader.java)6
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaver.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelSaver.java)6
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelStringWriter.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelStringWriter.java)6
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelWriter.java)6
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexSchemaGenerator.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexSchemaGenerator.java)2
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/package-info.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/package-info.java)23
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/package-info.java)2
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/AbstractParameters.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/AbstractParameters.java)4
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/ModelService.java)6
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ParameterService.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/ParameterService.java)4
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/package-info.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/package-info.java)2
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/test/TestApexModel.java)20
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModelCreator.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/test/TestApexModelCreator.java)6
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/package-info.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/test/package-info.java)2
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/xml/AxReferenceKeyAdapter.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/xml/AxReferenceKeyAdapter.java)20
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/xml/package-info.java (renamed from model/basic-model/src/main/java/org/onap/apex/model/basicmodel/xml/package-info.java)16
-rw-r--r--model/basic-model/src/main/resources/xml/example.xsd2
-rw-r--r--model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexBasicModel.java137
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/AxKeyTest.java)12
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestAxKeyInfo.java)8
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestAxReferenceKey.java)10
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestEntity.java)12
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestExceptions.java)10
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestValidation.java)12
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/testKeyUse.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/testKeyUse.java)12
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/dao/EntityTest.java)58
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/dao/TestDaoMisc.java)50
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/AxModelWithReferences.java)10
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java133
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java)60
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexBasicModelCreator.java)12
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexTestModelCreator0.java)12
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexTestModelCreator1.java)12
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexTestModelCreator2.java)12
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestBasicModelTest.java)68
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestConceptGetter.java)14
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestExceptions.java)4
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelFileWriter.java)8
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelReader.java)10
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelSaver.java)8
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelStringWriter.java)10
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelWriter.java)8
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestSchemaGenerator.java)48
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/IllegalParameters.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/IllegalParameters.java)4
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/LegalParameters.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/LegalParameters.java)4
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestAbstractParameters.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/TestAbstractParameters.java)26
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/TestModelService.java)50
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestParameterService.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/TestParameterService.java)42
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java (renamed from model/basic-model/src/test/java/org/onap/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java)6
-rw-r--r--model/basic-model/src/test/resources/META-INF/persistence.xml16
-rw-r--r--model/basic-model/src/test/resources/logback-test.xml10
-rw-r--r--model/context-model/pom.xml10
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java (renamed from model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextAlbum.java)83
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java (renamed from model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextAlbums.java)88
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java (renamed from model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextModel.java)73
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java (renamed from model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextSchema.java)84
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java (renamed from model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextSchemas.java)87
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/package-info.java (renamed from model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/package-info.java)15
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparer.java (renamed from model/context-model/src/main/java/org/onap/apex/model/contextmodel/handling/ContextComparer.java)12
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/package-info.java (renamed from model/context-model/src/main/java/org/onap/apex/model/contextmodel/handling/package-info.java)2
-rw-r--r--model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModelCreator.java106
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextAlbums.java)12
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextModel.java)12
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextSchemas.java)12
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModel.java)40
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java123
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparison.java)12
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparisonFactory.java)98
-rw-r--r--model/context-model/src/test/resources/META-INF/persistence.xml26
-rw-r--r--model/context-model/src/test/resources/json/ContextModel.json10
-rw-r--r--model/context-model/src/test/resources/logback-test.xml8
-rw-r--r--model/event-model/pom.xml67
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java560
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java330
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java420
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java406
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java104
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java104
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java34
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEventModel.java89
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java298
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java136
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java184
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModelCreator.java309
-rw-r--r--model/event-model/src/test/resources/META-INF/persistence.xml56
-rw-r--r--model/event-model/src/test/resources/logback-test.xml74
-rw-r--r--model/pom.xml12
-rw-r--r--pom.xml3
121 files changed, 5994 insertions, 2733 deletions
diff --git a/.gitignore b/.gitignore
index 236c0b3b4..3a9735328 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@
target
.metadata/
/bin/
+derby.log
diff --git a/model/basic-model/pom.xml b/model/basic-model/pom.xml
index cedb576ad..d663f92b2 100644
--- a/model/basic-model/pom.xml
+++ b/model/basic-model/pom.xml
@@ -43,12 +43,6 @@
<artifactId>eclipselink</artifactId>
<version>2.6.2</version>
</dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.13.1.1</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
@@ -64,10 +58,10 @@
<goal>java</goal>
</goals>
<configuration>
- <mainClass>org.onap.apex.model.basicmodel.handling.ApexSchemaGenerator</mainClass>
+ <mainClass>org.onap.policy.apex.model.basicmodel.handling.ApexSchemaGenerator</mainClass>
<classpathScope>compile</classpathScope>
<arguments>
- <argument>org.onap.apex.model.basicmodel.concepts.AxModel</argument>
+ <argument>org.onap.policy.apex.model.basicmodel.concepts.AxModel</argument>
<argument>${project.build.directory}/model/xml/apex-basic-model.xsd</argument>
</arguments>
</configuration>
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxArtifactKey.java b/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxArtifactKey.java
deleted file mode 100644
index 1de7ae72e..000000000
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxArtifactKey.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.apex.model.basicmodel.concepts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.policy.apex.model.utilities.Assertions;
-
-/**
- * An artifact key uniquely identifies every first order entity in the system. Every first order concept in the system must have
- * an {@link AxArtifactKey} to identify it. Concepts that are wholly contained in another concept are identified using
- * a {@link AxReferenceKey} key.
- * <p>
- * Key validation checks that the name and version fields match the {@link NAME_REGEXP} and {@link VERSION_REGEXP} regular expressions respectively.
- */
-@Embeddable
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexArtifactKey", namespace = "http://www.ericsson.com/apex")
-
-@XmlType(name = "AxArtifactKey", namespace = "http://www.ericsson.com/apex", propOrder = { "name", "version" })
-
-public class AxArtifactKey extends AxKey {
- private static final long serialVersionUID = 8932717618579392561L;
-
- private static final String NAME_TOKEN = "name";
- private static final String VERSION_TOKEN = "version";
-
- @Column(name = NAME_TOKEN)
- @XmlElement(required = true)
- private String name;
-
- @Column(name = VERSION_TOKEN)
- @XmlElement(required = true)
- private String version;
-
- /**
- * The default constructor creates a null artifact key.
- */
- public AxArtifactKey() {
- this(NULL_KEY_NAME, NULL_KEY_VERSION);
- }
-
- /**
- * Copy constructor
- * @param copyConcept the concept to copy from
- */
- public AxArtifactKey(final AxArtifactKey copyConcept) {
- super(copyConcept);
- }
-
- /**
- * Constructor to create a key with the specified name and version.
- *
- * @param name the key name
- * @param version the key version
- */
- public AxArtifactKey(final String name, final String version) {
- super();
- this.name = Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP);
- this.version = Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP);
- }
-
- /**
- * Constructor to create a key using the key and version from the specified key ID.
- *
- * @param id the key ID in a format that respects the {@link KEY_ID_REGEXP}
- */
- public AxArtifactKey(final String id) {
- Assertions.argumentNotNull(id, "id may not be null");
-
- // Check the incoming ID is valid
- Assertions.validateStringParameter("id", id, KEY_ID_REGEXP);
-
- // Split on colon, if the id passes the regular expression test above
- // it'll have just one colon separating the name and version
- // No need for range checks or size checks on the array
- final String[] nameVersionArray = id.split(":");
-
- // Return the new key
- name = Assertions.validateStringParameter(NAME_TOKEN, nameVersionArray[0], NAME_REGEXP);
- version = Assertions.validateStringParameter(VERSION_TOKEN, nameVersionArray[1], VERSION_REGEXP);
- }
-
- /**
- * Get a null artifact key.
- *
- * @return a null artifact key
- */
- public static final AxArtifactKey getNullKey() {
- return new AxArtifactKey(AxKey.NULL_KEY_NAME, AxKey.NULL_KEY_VERSION);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKey()
- */
- @Override
- public AxArtifactKey getKey() {
- return this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKeys()
- */
- @Override
- public List<AxKey> getKeys() {
- final List<AxKey> keyList = new ArrayList<>();
- keyList.add(getKey());
- return keyList;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxKey#getID()
- */
- @Override
- public String getID() {
- return name + ':' + version;
- }
-
- /**
- * Gets the key name.
- *
- * @return the key name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the key name.
- *
- * @param name the key name
- */
- public void setName(final String name) {
- this.name = Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP);
- }
-
- /**
- * Gets the key version.
- *
- * @return the key version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Sets the key version.
- *
- * @param version the key version
- */
- public void setVersion(final String version) {
- this.version = Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxKey#getCompatibility(com. ericsson.apex.model.basicmodel.concepts.AxKey)
- */
- @Override
- public AxKey.Compatibility getCompatibility(final AxKey otherKey) {
- if (!(otherKey instanceof AxArtifactKey)) {
- return Compatibility.DIFFERENT;
- }
- final AxArtifactKey otherArtifactKey = (AxArtifactKey) otherKey;
-
- if (this.equals(otherArtifactKey)) {
- return Compatibility.IDENTICAL;
- }
- if (!this.getName().equals(otherArtifactKey.getName())) {
- return Compatibility.DIFFERENT;
- }
-
- final String[] thisVersionArray = getVersion().split("\\.");
- final String[] otherVersionArray = otherArtifactKey.getVersion().split("\\.");
-
- // There must always be at least one element in each version
- if (!thisVersionArray[0].equals(otherVersionArray[0])) {
- return Compatibility.MAJOR;
- }
-
- if (thisVersionArray.length >= 2 && otherVersionArray.length >= 2 && !thisVersionArray[1].equals(otherVersionArray[1])) {
- return Compatibility.MINOR;
- }
-
- return Compatibility.PATCH;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxKey#isCompatible(com. ericsson.apex.model.basicmodel.concepts.AxKey)
- */
- @Override
- public boolean isCompatible(final AxKey otherKey) {
- if (!(otherKey instanceof AxArtifactKey)) {
- return false;
- }
- final AxArtifactKey otherArtifactKey = (AxArtifactKey) otherKey;
-
- final Compatibility compatibility = this.getCompatibility(otherArtifactKey);
-
- return !(compatibility == Compatibility.DIFFERENT || compatibility == Compatibility.MAJOR);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#validate(com. ericsson.apex.model.basicmodel.concepts.AxValidationResult)
- */
- @Override
- public AxValidationResult validate(final AxValidationResult result) {
- try {
- Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP);
- }
- catch (final IllegalArgumentException e) {
- result.addValidationMessage(
- new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID, "name invalid-" + e.getMessage()));
- }
-
- try {
- Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP);
- }
- catch (final IllegalArgumentException e) {
- result.addValidationMessage(
- new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID, "version invalid-" + e.getMessage()));
- }
-
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#clean()
- */
- @Override
- public void clean() {
- name = Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP);
- version = Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#toString()
- */
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder();
- builder.append(this.getClass().getSimpleName());
- builder.append(":(");
- builder.append("name=");
- builder.append(name);
- builder.append(",version=");
- builder.append(version);
- builder.append(")");
- return builder.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.basicmodel.concepts.AxConcept)
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
- Assertions.argumentNotNull(target, "target may not be null");
-
- final AxConcept copyObject = target;
- Assertions.instanceOf(copyObject, AxArtifactKey.class);
-
- final AxArtifactKey copy = ((AxArtifactKey) copyObject);
- copy.setName(name);
- copy.setVersion(version);
-
- return copyObject;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + name.hashCode();
- result = prime * result + version.hashCode();
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- final AxArtifactKey other = (AxArtifactKey) obj;
-
- if (!name.equals(other.name)) {
- return false;
- }
- return version.equals(other.version);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- @Override
- public int compareTo(final AxConcept otherObj) {
- Assertions.argumentNotNull(otherObj, "comparison object may not be null");
-
- if (this == otherObj) {
- return 0;
- }
- if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
- }
-
- final AxArtifactKey other = (AxArtifactKey) otherObj;
-
- if (!name.equals(other.name)) {
- return name.compareTo(other.name);
- }
- return version.compareTo(other.version);
- }
-}
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKeyInformation.java b/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKeyInformation.java
deleted file mode 100644
index 3082c4f5d..000000000
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKeyInformation.java
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.apex.model.basicmodel.concepts;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.NavigableMap;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.UUID;
-
-import javax.persistence.CascadeType;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.policy.apex.model.utilities.Assertions;
-
-/**
- * The Class AxKeyInformation holds a map of the key information for the entire Apex model. All Apex models {@link AxModel} must have an
- * {@link AxKeyInformation} field. The {@link AxKeyInformation} class implements the helper methods of the {@link AxConceptGetter} interface to allow
- * {@link AxKeyInfo} instances to be retrieved by calling methods directly on this class without referencing the contained map.
- * <p>
- * Validation checks that the key is not null, that the key information map is not empty, that each key and value in the map is defined, that the key in each
- * map entry matches the key if each entry value, and that no duplicate UUIDs exist. Each key information entry is then validated individually.
- */
-@Entity
-@Table(name = "AxKeyInformation")
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxKeyInformation", namespace = "http://www.ericsson.com/apex", propOrder = { "key", "keyInfoMap" })
-
-public class AxKeyInformation extends AxConcept implements AxConceptGetter<AxKeyInfo> {
- private static final long serialVersionUID = -2746380769017043888L;
-
- @EmbeddedId
- @XmlElement(name = "key", required = true)
- private AxArtifactKey key;
-
- // @formatter:off
- @ManyToMany(cascade = CascadeType.ALL)
- @JoinTable(
- joinColumns = {
- @JoinColumn(name = "keyInfoMapName", referencedColumnName = "name"),
- @JoinColumn(name = "keyInfoMapVersion", referencedColumnName = "version"),
- },
- inverseJoinColumns = {
- @JoinColumn(name = "keyInfoName", referencedColumnName = "name"),
- @JoinColumn(name = "keyInfoVersion", referencedColumnName = "version")
- })
- private Map<AxArtifactKey, AxKeyInfo> keyInfoMap;
- // @formatter:on
-
- /**
- * The Default Constructor creates this concept with a null key.
- */
- public AxKeyInformation() {
- this(new AxArtifactKey());
- }
-
- /**
- * Copy constructor
- * @param copyConcept the concept to copy from
- */
- public AxKeyInformation(final AxKeyInformation copyConcept) {
- super(copyConcept);
- }
-
- /**
- * Constructor to create this concept with the specified key.
- *
- * @param key the key of the concept
- */
- public AxKeyInformation(final AxArtifactKey key) {
- this(key, new TreeMap<AxArtifactKey, AxKeyInfo>());
- }
-
- /**
- * Constructor to create this concept and set all its fields.
- *
- * @param key the key of the concept
- * @param keyInfoMap the key info map of the concept
- */
- public AxKeyInformation(final AxArtifactKey key, final Map<AxArtifactKey, AxKeyInfo> keyInfoMap) {
- super();
- Assertions.argumentNotNull(key, "key may not be null");
- Assertions.argumentNotNull(keyInfoMap, "keyInfoMap may not be null");
-
- this.key = key;
- this.keyInfoMap = new TreeMap<>();
- this.keyInfoMap.putAll(keyInfoMap);
- }
-
- /**
- * When a model is unmarshalled from disk or from the database, the key information map is returned as a raw Hash Map. This method is called by JAXB
- * after unmarshaling and is used to convert the hash map to a {@link NavigableMap} so that it will work with the {@link AxConceptGetter} interface.
- *
- * @param u the unmarshaler that is unmarshaling the model
- * @param parent the parent object of this object in the unmarshaler
- */
- public void afterUnmarshal(final Unmarshaller u, final Object parent) {
- // The map must be navigable to allow name and version searching,
- // unmarshaling returns a hash map
- final NavigableMap<AxArtifactKey, AxKeyInfo> navigablekeyInfoMap = new TreeMap<>();
- navigablekeyInfoMap.putAll(keyInfoMap);
- keyInfoMap = navigablekeyInfoMap;
- }
-
- /**
- * This method generates default key information for all keys found in the concept passed in as a parameter that do not already have key information.
- *
- * @param concept the concept for which to generate key information
- */
- public void generateKeyInfo(final AxConcept concept) {
- for (final AxKey axKey : concept.getKeys()) {
- if (!(axKey instanceof AxArtifactKey)) {
- continue;
- }
-
- final AxArtifactKey artifactKey = (AxArtifactKey) axKey;
- if (!keyInfoMap.containsKey(artifactKey)) {
- final AxKeyInfo keyInfo = new AxKeyInfo(artifactKey);
- //generate a reproducible UUID
- keyInfo.setUuid(AxKeyInfo.generateReproducibleUUID(keyInfo.getID() + keyInfo.getDescription()));
- keyInfoMap.put(artifactKey, keyInfo);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKey()
- */
- @Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKeys()
- */
- @Override
- public List<AxKey> getKeys() {
- final List<AxKey> keyList = key.getKeys();
- keyList.addAll(keyInfoMap.keySet());
-
- return keyList;
- }
-
- /**
- * Sets the key of this concept.
- *
- * @param key the key of this concept
- */
- public void setKey(final AxArtifactKey key) {
- Assertions.argumentNotNull(key, "key may not be null");
- this.key = key;
- }
-
- /**
- * Gets the key info map of this concept.
- *
- * @return the key info map of this concept
- */
- public Map<AxArtifactKey, AxKeyInfo> getKeyInfoMap() {
- return keyInfoMap;
- }
-
- /**
- * Sets the key info map of this concept.
- *
- * @param keyInfoMap the key info map of this concept
- */
- public void setKeyInfoMap(final Map<AxArtifactKey, AxKeyInfo> keyInfoMap) {
- Assertions.argumentNotNull(keyInfoMap, "keyInfoMap may not be null");
- this.keyInfoMap = new TreeMap<>();
- this.keyInfoMap.putAll(keyInfoMap);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#validate(com. ericsson.apex.model.basicmodel.concepts.AxValidationResult)
- */
- @Override
- public AxValidationResult validate(final AxValidationResult resultIn) {
- AxValidationResult result = resultIn;
-
- if (key.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
- }
-
- result = key.validate(result);
-
- if (keyInfoMap.size() == 0) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "keyInfoMap may not be empty"));
- }
- else {
- final Set<UUID> uuidSet = new TreeSet<>();
-
- for (final Entry<AxArtifactKey, AxKeyInfo> keyInfoEntry : keyInfoMap.entrySet()) {
- result = validateKeyInfoEntry(keyInfoEntry, uuidSet, result);
- }
- }
-
- return result;
- }
-
- /**
- * Validate an key information entry
- * @param keyInfoEntry the key information entry
- * @param uuidSet the set of UUIDs encountered in validation so far, the UUID of this entry is added to the set
- * @param result the validation result to append to
- * @return The validation result
- */
- private AxValidationResult validateKeyInfoEntry(final Entry<AxArtifactKey, AxKeyInfo> keyInfoEntry, Set<UUID> uuidSet, AxValidationResult result) {
- if (keyInfoEntry.getKey().equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on keyInfoMap entry " + keyInfoEntry.getKey() + " may not be the null key"));
- }
- else if (keyInfoEntry.getValue() == null) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "value on keyInfoMap entry " + keyInfoEntry.getKey() + " may not be null"));
- }
- else {
- if (!keyInfoEntry.getKey().equals(keyInfoEntry.getValue().getKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on keyInfoMap entry " + keyInfoEntry.getKey() + " does not equal entry key " + keyInfoEntry.getValue().getKey()));
- }
-
- result = keyInfoEntry.getValue().validate(result);
-
- if (uuidSet.contains(keyInfoEntry.getValue().getUUID())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "duplicate UUID found on keyInfoMap entry " + keyInfoEntry.getKey() + ":" + keyInfoEntry.getValue().getUUID()));
- }
- else {
- uuidSet.add(keyInfoEntry.getValue().getUUID());
- }
- }
-
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#clean()
- */
- @Override
- public void clean() {
- key.clean();
- for (final Entry<AxArtifactKey, AxKeyInfo> keyInfoEntry : keyInfoMap.entrySet()) {
- keyInfoEntry.getKey().clean();
- keyInfoEntry.getValue().clean();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#toString()
- */
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder();
- builder.append(this.getClass().getSimpleName());
- builder.append(":(");
- builder.append("key=");
- builder.append(key);
- builder.append(",keyInfoMap=");
- builder.append(keyInfoMap);
- builder.append(")");
- return builder.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.basicmodel.concepts.AxConcept)
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
- Assertions.argumentNotNull(target, "target may not be null");
-
- final Object copyObject = target;
- Assertions.instanceOf(copyObject, AxKeyInformation.class);
-
- final AxKeyInformation copy = ((AxKeyInformation) copyObject);
- copy.setKey(new AxArtifactKey(key));
- final Map<AxArtifactKey, AxKeyInfo> newKeyInfoMap = new TreeMap<>();
- for (final Entry<AxArtifactKey, AxKeyInfo> keyInfoMapEntry : keyInfoMap.entrySet()) {
- newKeyInfoMap.put(new AxArtifactKey(keyInfoMapEntry.getKey()), new AxKeyInfo(keyInfoMapEntry.getValue()));
- }
- copy.setKeyInfoMap(newKeyInfoMap);
-
- return copy;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + key.hashCode();
- result = prime * result + keyInfoMap.hashCode();
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
-
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- final AxKeyInformation other = (AxKeyInformation) obj;
- if (!key.equals(other.key)) {
- return false;
- }
- return keyInfoMap.equals(other.keyInfoMap);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- @Override
- public int compareTo(final AxConcept otherObj) {
- if (otherObj == null) {
- return -1;
- }
- if (this == otherObj) {
- return 0;
- }
- if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
- }
-
- final AxKeyInformation other = (AxKeyInformation) otherObj;
- if (!key.equals(other.key)) {
- return key.compareTo(other.key);
- }
- if (!keyInfoMap.equals(other.keyInfoMap)) {
- return (keyInfoMap.hashCode() - other.keyInfoMap.hashCode());
- }
-
- return 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#get(com. ericsson.apex.core.basicmodel.concepts.AxArtifactKey)
- */
- @Override
- public AxKeyInfo get(final AxArtifactKey conceptKey) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxKeyInfo>) keyInfoMap).get(conceptKey);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang. String)
- */
- @Override
- public AxKeyInfo get(final String conceptKeyName) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxKeyInfo>) keyInfoMap).get(conceptKeyName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang. String, java.lang.String)
- */
- @Override
- public AxKeyInfo get(final String conceptKeyName, final String conceptKeyVersion) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxKeyInfo>) keyInfoMap).get(conceptKeyName, conceptKeyVersion);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java. lang.String)
- */
- @Override
- public Set<AxKeyInfo> getAll(final String conceptKeyName) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxKeyInfo>) keyInfoMap).getAll(conceptKeyName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java. lang.String, java.lang.String)
- */
- @Override
- public Set<AxKeyInfo> getAll(final String conceptKeyName, final String conceptKeyVersion) {
- return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxKeyInfo>) keyInfoMap).getAll(conceptKeyName, conceptKeyVersion);
- }
-}
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/impl/DefaultApexDao.java b/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/impl/DefaultApexDao.java
deleted file mode 100644
index a73a15e41..000000000
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/impl/DefaultApexDao.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.apex.model.basicmodel.dao.impl;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.ApexRuntimeException;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.apex.model.basicmodel.dao.ApexDao;
-import org.onap.apex.model.basicmodel.dao.DAOParameters;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class DefaultApexDao is an JPA implementation of the {@link ApexDao} class for Apex concepts ({@link AxConcept}). It uses the default
- * JPA implementation in the javax {@link Persistence} class.
- *
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class DefaultApexDao implements ApexDao {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(DefaultApexDao.class);
-
- private static final String SELECT_C_FROM = "SELECT c FROM ";
- private static final String AND_C_KEY_LOCAL_NAME = "' AND c.key.localName='";
- private static final String AND_C_KEY_PARENT_KEY_VERSION = "' AND c.key.parentKeyVersion='";
- private static final String C_WHERE_C_KEY_PARENT_KEY_NAME = " c WHERE c.key.parentKeyName='";
- private static final String AND_C_KEY_VERSION = "' AND c.key.version='";
- private static final String C_WHERE_C_KEY_NAME = " c WHERE c.key.name='";
- private static final String DELETE_FROM = "DELETE FROM ";
-
- // Entity manager for JPA
- private EntityManagerFactory emf = null;
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#init(com.ericsson.apex.model.basicmodel.dao.DAOParameters)
- */
- @Override
- public void init(final DAOParameters daoParameters) throws ApexException {
- if (daoParameters == null || daoParameters.getPersistenceUnit() == null) {
- LOGGER.error("Apex persistence unit parameter not set");
- throw new ApexException("Apex persistence unit parameter not set");
- }
-
- LOGGER.debug("Creating Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" . . .");
- try {
- emf = Persistence.createEntityManagerFactory(daoParameters.getPersistenceUnit(), daoParameters.getJdbcProperties());
- }
- catch (final Exception e) {
- LOGGER.warn("Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", e);
- throw new ApexException("Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", e);
- }
- LOGGER.debug("Created Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\"");
- }
-
- /**
- * Gets the entity manager for this DAO.
- *
- * @return the entity manager
- */
- protected final synchronized EntityManager getEntityManager() {
- if (emf == null) {
- LOGGER.warn("Apex DAO has not been initialized");
- throw new ApexRuntimeException("Apex DAO has not been initialized");
- }
-
- return emf.createEntityManager();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#close()
- */
- @Override
- public final void close() {
- if (emf != null) {
- emf.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#create(com.ericsson.apex.model.basicmodel.concepts.AxConcept)
- */
- @Override
- public <T extends AxConcept> void create(final T obj) {
- if (obj == null) {
- return;
- }
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- mg.merge(obj);
- mg.getTransaction().commit();
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#delete(com.ericsson.apex.model.basicmodel.concepts.AxConcept)
- */
- @Override
- public <T extends AxConcept> void delete(final T obj) {
- if (obj == null) {
- return;
- }
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- mg.remove(mg.contains(obj) ? obj : mg.merge(obj));
- mg.getTransaction().commit();
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#delete(java.lang.Class,
- * com.ericsson.apex.model.basicmodel.concepts.AxArtifactKey)
- */
- @Override
- public <T extends AxConcept> void delete(final Class<T> aClass, final AxArtifactKey key) {
- if (key == null) {
- return;
- }
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- mg.createQuery(DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName() + AND_C_KEY_VERSION
- + key.getVersion() + "'", aClass).executeUpdate();
- mg.getTransaction().commit();
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#delete(java.lang.Class,
- * com.ericsson.apex.model.basicmodel.concepts.AxReferenceKey)
- */
- @Override
- public <T extends AxConcept> void delete(final Class<T> aClass, final AxReferenceKey key) {
- if (key == null) {
- return;
- }
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- mg.createQuery(DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + key.getParentKeyName()
- + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'",
- aClass).executeUpdate();
- mg.getTransaction().commit();
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#create(java.util.Collection)
- */
- @Override
- public <T extends AxConcept> void create(final Collection<T> objs) {
- if (objs == null || objs.isEmpty()) {
- return;
- }
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- for (final T t : objs) {
- mg.merge(t);
- }
- mg.getTransaction().commit();
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#delete(java.util.Collection)
- */
- @Override
- public <T extends AxConcept> void delete(final Collection<T> objs) {
- if (objs == null || objs.isEmpty()) {
- return;
- }
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- for (final T t : objs) {
- mg.remove(mg.contains(t) ? t : mg.merge(t));
- }
- mg.getTransaction().commit();
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#deleteByArtifactKey(java.lang.Class, java.util.Collection)
- */
- @Override
- public <T extends AxConcept> int deleteByArtifactKey(final Class<T> aClass, final Collection<AxArtifactKey> keys) {
- if (keys == null || keys.isEmpty()) {
- return 0;
- }
- int deletedCount = 0;
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- for (final AxArtifactKey key : keys) {
- deletedCount += mg.createQuery(DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName()
- + AND_C_KEY_VERSION + key.getVersion() + "'", aClass).executeUpdate();
- }
- mg.getTransaction().commit();
- }
- finally {
- mg.close();
- }
- return deletedCount;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#deleteByReferenceKey(java.lang.Class, java.util.Collection)
- */
- @Override
- public <T extends AxConcept> int deleteByReferenceKey(final Class<T> aClass, final Collection<AxReferenceKey> keys) {
- if (keys == null || keys.isEmpty()) {
- return 0;
- }
- int deletedCount = 0;
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- for (final AxReferenceKey key : keys) {
- deletedCount += mg.createQuery(DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME
- + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + AND_C_KEY_LOCAL_NAME
- + key.getLocalName() + "'", aClass).executeUpdate();
- }
- mg.getTransaction().commit();
- }
- finally {
- mg.close();
- }
- return deletedCount;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#deleteAll(java.lang.Class)
- */
- @Override
- public <T extends AxConcept> void deleteAll(final Class<T> aClass) {
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- mg.createQuery(DELETE_FROM + aClass.getSimpleName() + " c ", aClass).executeUpdate();
- mg.getTransaction().commit();
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#get(java.lang.Class, com.ericsson.apex.model.basicmodel.concepts.AxArtifactKey)
- */
- @Override
- public <T extends AxConcept> T get(final Class<T> aClass, final AxArtifactKey key) {
- if (aClass == null) {
- return null;
- }
- final EntityManager mg = getEntityManager();
- try {
- final T t = mg.find(aClass, key);
- if (t != null) {
- // This clone is created to force the JPA DAO to recurse down through the object
- try {
- T clonedT = aClass.newInstance();
- t.copyTo(clonedT);
- return clonedT;
- }
- catch (Exception e) {
- LOGGER.warn("Could not clone object of class \"" + aClass.getCanonicalName() + "\"", e);
- return null;
- }
- }
- else {
- return null;
- }
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#get(java.lang.Class, com.ericsson.apex.model.basicmodel.concepts.AxReferenceKey)
- */
- @Override
- public <T extends AxConcept> T get(final Class<T> aClass, final AxReferenceKey key) {
- if (aClass == null) {
- return null;
- }
- final EntityManager mg = getEntityManager();
- try {
- final T t = mg.find(aClass, key);
- if (t != null) {
- try {
- T clonedT = aClass.newInstance();
- t.copyTo(clonedT);
- return clonedT;
- }
- catch (Exception e) {
- LOGGER.warn("Could not clone object of class \"" + aClass.getCanonicalName() + "\"", e);
- return null;
- }
- }
- else {
- return null;
- }
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#getAll(java.lang.Class)
- */
- @Override
- public <T extends AxConcept> List<T> getAll(final Class<T> aClass) {
- if (aClass == null) {
- return Collections.emptyList();
- }
- final EntityManager mg = getEntityManager();
- try {
- return mg.createQuery(SELECT_C_FROM + aClass.getSimpleName() + " c", aClass).getResultList();
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#getAll(java.lang.Class,
- * com.ericsson.apex.model.basicmodel.concepts.AxArtifactKey)
- */
- @Override
- public <T extends AxConcept> List<T> getAll(final Class<T> aClass, final AxArtifactKey parentKey) {
- if (aClass == null) {
- return Collections.emptyList();
- }
- final EntityManager mg = getEntityManager();
- try {
- return mg.createQuery(SELECT_C_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + parentKey.getName()
- + AND_C_KEY_PARENT_KEY_VERSION + parentKey.getVersion() + "'", aClass).getResultList();
- }
- finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#getArtifact(java.lang.Class,
- * com.ericsson.apex.model.basicmodel.concepts.AxArtifactKey)
- */
- @Override
- public <T extends AxConcept> T getArtifact(final Class<T> aClass, final AxArtifactKey key) {
- if (aClass == null || key == null) {
- return null;
- }
- final EntityManager mg = getEntityManager();
- List<T> ret;
- try {
- ret = mg.createQuery(SELECT_C_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName()
- + AND_C_KEY_VERSION + key.getVersion() + "'", aClass).getResultList();
- }
- finally {
- mg.close();
- }
- if (ret == null || ret.isEmpty()) {
- return null;
- }
- if (ret.size() > 1) {
- throw new IllegalArgumentException(
- "More than one result was returned for search for " + aClass + " with key " + key.getID() + ": " + ret);
- }
- return ret.get(0);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#getArtifact(java.lang.Class,
- * com.ericsson.apex.model.basicmodel.concepts.AxReferenceKey)
- */
- @Override
- public <T extends AxConcept> T getArtifact(final Class<T> aClass, final AxReferenceKey key) {
- if (aClass == null || key == null) {
- return null;
- }
- final EntityManager mg = getEntityManager();
- List<T> ret;
- try {
- ret = mg.createQuery(SELECT_C_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + key.getParentKeyName()
- + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'",
- aClass).getResultList();
- }
- finally {
- mg.close();
- }
- if (ret == null || ret.isEmpty()) {
- return null;
- }
- if (ret.size() > 1) {
- throw new IllegalArgumentException(
- "More than one result was returned for search for " + aClass + " with key " + key.getID() + ": " + ret);
- }
- return ret.get(0);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#update(com.ericsson.apex.model.basicmodel.concepts.AxConcept)
- */
- @Override
- public <T extends AxConcept> T update(final T obj) {
- final EntityManager mg = getEntityManager();
- T ret;
- try {
- mg.getTransaction().begin();
- ret = mg.merge(obj);
- mg.flush();
- mg.getTransaction().commit();
- }
- finally {
- mg.close();
- }
- return ret;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.dao.ApexDao#size(java.lang.Class)
- */
- @Override
- public <T extends AxConcept> long size(final Class<T> aClass) {
- if (aClass == null) {
- return 0;
- }
- final EntityManager mg = getEntityManager();
- long size = 0;
- try {
- size = mg.createQuery("SELECT COUNT(c) FROM " + aClass.getSimpleName() + " c", Long.class).getSingleResult();
- }
- finally {
- mg.close();
- }
- return size;
- }
-}
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/ApexConceptException.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexConceptException.java
index bfe296d97..1ffb2776c 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/ApexConceptException.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexConceptException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
/**
* This class is an exception thrown on Apex Concept errors.
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/ApexException.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexException.java
index 74a60e243..2dcbf7bcf 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/ApexException.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexException.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
/**
* This class is a base exception from which all Apex exceptions are sub classes.
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/ApexRuntimeException.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexRuntimeException.java
index 4cdfbe4b0..f3db3ae60 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/ApexRuntimeException.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/ApexRuntimeException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
/**
* This class is a base run time exception from which all Apex run time exceptions are sub classes.
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java
new file mode 100644
index 000000000..382d5024f
--- /dev/null
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java
@@ -0,0 +1,384 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.basicmodel.concepts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.utilities.Assertions;
+
+/**
+ * An artifact key uniquely identifies every first order entity in the system. Every first order concept in the system
+ * must have an {@link AxArtifactKey} to identify it. Concepts that are wholly contained in another concept are
+ * identified using a {@link AxReferenceKey} key.
+ * <p>
+ * Key validation checks that the name and version fields match the {@link NAME_REGEXP} and {@link VERSION_REGEXP}
+ * regular expressions respectively.
+ */
+@Embeddable
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement(name = "apexArtifactKey", namespace = "http://www.onap.org/policy/apex-pdp")
+
+@XmlType(name = "AxArtifactKey", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "name", "version" })
+
+public class AxArtifactKey extends AxKey {
+ private static final long serialVersionUID = 8932717618579392561L;
+
+ private static final String NAME_TOKEN = "name";
+ private static final String VERSION_TOKEN = "version";
+
+ @Column(name = NAME_TOKEN)
+ @XmlElement(required = true)
+ private String name;
+
+ @Column(name = VERSION_TOKEN)
+ @XmlElement(required = true)
+ private String version;
+
+ /**
+ * The default constructor creates a null artifact key.
+ */
+ public AxArtifactKey() {
+ this(NULL_KEY_NAME, NULL_KEY_VERSION);
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param copyConcept the concept to copy from
+ */
+ public AxArtifactKey(final AxArtifactKey copyConcept) {
+ super(copyConcept);
+ }
+
+ /**
+ * Constructor to create a key with the specified name and version.
+ *
+ * @param name the key name
+ * @param version the key version
+ */
+ public AxArtifactKey(final String name, final String version) {
+ super();
+ this.name = Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP);
+ this.version = Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP);
+ }
+
+ /**
+ * Constructor to create a key using the key and version from the specified key ID.
+ *
+ * @param id the key ID in a format that respects the {@link KEY_ID_REGEXP}
+ */
+ public AxArtifactKey(final String id) {
+ Assertions.argumentNotNull(id, "id may not be null");
+
+ // Check the incoming ID is valid
+ Assertions.validateStringParameter("id", id, KEY_ID_REGEXP);
+
+ // Split on colon, if the id passes the regular expression test above
+ // it'll have just one colon separating the name and version
+ // No need for range checks or size checks on the array
+ final String[] nameVersionArray = id.split(":");
+
+ // Return the new key
+ name = Assertions.validateStringParameter(NAME_TOKEN, nameVersionArray[0], NAME_REGEXP);
+ version = Assertions.validateStringParameter(VERSION_TOKEN, nameVersionArray[1], VERSION_REGEXP);
+ }
+
+ /**
+ * Get a null artifact key.
+ *
+ * @return a null artifact key
+ */
+ public static final AxArtifactKey getNullKey() {
+ return new AxArtifactKey(AxKey.NULL_KEY_NAME, AxKey.NULL_KEY_VERSION);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
+ */
+ @Override
+ public AxArtifactKey getKey() {
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ */
+ @Override
+ public List<AxKey> getKeys() {
+ final List<AxKey> keyList = new ArrayList<>();
+ keyList.add(getKey());
+ return keyList;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxKey#getID()
+ */
+ @Override
+ public String getID() {
+ return name + ':' + version;
+ }
+
+ /**
+ * Gets the key name.
+ *
+ * @return the key name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the key name.
+ *
+ * @param name the key name
+ */
+ public void setName(final String name) {
+ this.name = Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP);
+ }
+
+ /**
+ * Gets the key version.
+ *
+ * @return the key version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Sets the key version.
+ *
+ * @param version the key version
+ */
+ public void setVersion(final String version) {
+ this.version = Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxKey#getCompatibility(org.onap.policy.apex.model.basicmodel.
+ * concepts.AxKey)
+ */
+ @Override
+ public AxKey.Compatibility getCompatibility(final AxKey otherKey) {
+ if (!(otherKey instanceof AxArtifactKey)) {
+ return Compatibility.DIFFERENT;
+ }
+ final AxArtifactKey otherArtifactKey = (AxArtifactKey) otherKey;
+
+ if (this.equals(otherArtifactKey)) {
+ return Compatibility.IDENTICAL;
+ }
+ if (!this.getName().equals(otherArtifactKey.getName())) {
+ return Compatibility.DIFFERENT;
+ }
+
+ final String[] thisVersionArray = getVersion().split("\\.");
+ final String[] otherVersionArray = otherArtifactKey.getVersion().split("\\.");
+
+ // There must always be at least one element in each version
+ if (!thisVersionArray[0].equals(otherVersionArray[0])) {
+ return Compatibility.MAJOR;
+ }
+
+ if (thisVersionArray.length >= 2 && otherVersionArray.length >= 2
+ && !thisVersionArray[1].equals(otherVersionArray[1])) {
+ return Compatibility.MINOR;
+ }
+
+ return Compatibility.PATCH;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxKey#isCompatible(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxKey)
+ */
+ @Override
+ public boolean isCompatible(final AxKey otherKey) {
+ if (!(otherKey instanceof AxArtifactKey)) {
+ return false;
+ }
+ final AxArtifactKey otherArtifactKey = (AxArtifactKey) otherKey;
+
+ final Compatibility compatibility = this.getCompatibility(otherArtifactKey);
+
+ return !(compatibility == Compatibility.DIFFERENT || compatibility == Compatibility.MAJOR);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxValidationResult)
+ */
+ @Override
+ public AxValidationResult validate(final AxValidationResult result) {
+ try {
+ Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP);
+ } catch (final IllegalArgumentException e) {
+ result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID,
+ "name invalid-" + e.getMessage()));
+ }
+
+ try {
+ Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP);
+ } catch (final IllegalArgumentException e) {
+ result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID,
+ "version invalid-" + e.getMessage()));
+ }
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
+ */
+ @Override
+ public void clean() {
+ name = Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP);
+ version = Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
+ */
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(this.getClass().getSimpleName());
+ builder.append(":(");
+ builder.append("name=");
+ builder.append(name);
+ builder.append(",version=");
+ builder.append(version);
+ builder.append(")");
+ return builder.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public AxConcept copyTo(final AxConcept target) {
+ Assertions.argumentNotNull(target, "target may not be null");
+
+ final AxConcept copyObject = target;
+ Assertions.instanceOf(copyObject, AxArtifactKey.class);
+
+ final AxArtifactKey copy = ((AxArtifactKey) copyObject);
+ copy.setName(name);
+ copy.setVersion(version);
+
+ return copyObject;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + name.hashCode();
+ result = prime * result + version.hashCode();
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (this == obj) {
+ return true;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ final AxArtifactKey other = (AxArtifactKey) obj;
+
+ if (!name.equals(other.name)) {
+ return false;
+ }
+ return version.equals(other.version);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ public int compareTo(final AxConcept otherObj) {
+ Assertions.argumentNotNull(otherObj, "comparison object may not be null");
+
+ if (this == otherObj) {
+ return 0;
+ }
+ if (getClass() != otherObj.getClass()) {
+ return this.hashCode() - otherObj.hashCode();
+ }
+
+ final AxArtifactKey other = (AxArtifactKey) otherObj;
+
+ if (!name.equals(other.name)) {
+ return name.compareTo(other.name);
+ }
+ return version.compareTo(other.version);
+ }
+}
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxConcept.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java
index 005d17d76..3d7f5027f 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxConcept.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConcept.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import java.io.Serializable;
import java.util.List;
@@ -28,13 +28,13 @@ import javax.xml.bind.annotation.XmlType;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * This class is the base class for all Apex concept classes. It enforces implementation of abstract methods and interfaces on all concepts
- * that are sub-classes of this class.
+ * This class is the base class for all Apex concept classes. It enforces implementation of abstract methods and
+ * interfaces on all concepts that are sub-classes of this class.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-@XmlType(name = "AxConcept", namespace = "http://www.ericsson.com/apex")
+@XmlType(name = "AxConcept", namespace = "http://www.onap.org/policy/apex-pdp")
public abstract class AxConcept implements Serializable, Comparable<AxConcept> {
private static final long serialVersionUID = -7434939557282697490L;
@@ -42,18 +42,18 @@ public abstract class AxConcept implements Serializable, Comparable<AxConcept> {
/**
* Default constructor
*/
- public AxConcept() {
- }
-
+ public AxConcept() {}
+
/**
* Copy constructor
+ *
* @param copyConcept the concept to copy from
*/
public AxConcept(final AxConcept copyConcept) {
Assertions.argumentNotNull(copyConcept, "copy concept may not be null");
- copyConcept.copyTo(this);
+ copyConcept.copyTo(this);
}
-
+
/**
* Gets the key of this concept.
*
@@ -62,7 +62,8 @@ public abstract class AxConcept implements Serializable, Comparable<AxConcept> {
public abstract AxKey getKey();
/**
- * Gets a list of all keys for this concept and all concepts that are defined or referenced by this concept and its sub-concepts.
+ * Gets a list of all keys for this concept and all concepts that are defined or referenced by this concept and its
+ * sub-concepts.
*
* @return the keys used by this concept and it's contained concepts
*/
@@ -72,7 +73,8 @@ public abstract class AxConcept implements Serializable, Comparable<AxConcept> {
* Validate that this concept is structurally correct.
*
* @param result the parameter in which the result of the validation will be returned
- * @return the validation result that was passed in in the @{link result} field with the result of this validation added
+ * @return the validation result that was passed in in the @{link result} field with the result of this validation
+ * added
*/
public abstract AxValidationResult validate(AxValidationResult result);
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxConceptGetter.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetter.java
index d5d1752e6..0735f87c3 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxConceptGetter.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.Set;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxConceptGetterImpl.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetterImpl.java
index af9764113..b4bff80c8 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxConceptGetterImpl.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxConceptGetterImpl.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.NavigableMap;
import java.util.Set;
@@ -49,7 +49,8 @@ public class AxConceptGetterImpl<C> implements AxConceptGetter<C> {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#get(com. ericsson.apex.core.basicmodel.concepts.AxArtifactKey)
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#get(org.onap.policy.apex.apex.core.basicmodel.
+ * concepts.AxArtifactKey)
*/
@Override
public C get(final AxArtifactKey conceptKey) {
@@ -59,7 +60,7 @@ public class AxConceptGetterImpl<C> implements AxConceptGetter<C> {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang. String)
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang. String)
*/
@Override
public C get(final String conceptKeyName) {
@@ -81,8 +82,7 @@ public class AxConceptGetterImpl<C> implements AxConceptGetter<C> {
break;
}
foundKey = nextkey;
- }
- while (true);
+ } while (true);
return conceptMap.get(foundKey);
}
@@ -90,7 +90,7 @@ public class AxConceptGetterImpl<C> implements AxConceptGetter<C> {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang. String, java.lang.String)
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang. String, java.lang.String)
*/
@Override
public C get(final String conceptKeyName, final String conceptKeyVersion) {
@@ -98,8 +98,7 @@ public class AxConceptGetterImpl<C> implements AxConceptGetter<C> {
if (conceptKeyVersion != null) {
return conceptMap.get(new AxArtifactKey(conceptKeyName, conceptKeyVersion));
- }
- else {
+ } else {
return this.get(conceptKeyName);
}
}
@@ -107,7 +106,7 @@ public class AxConceptGetterImpl<C> implements AxConceptGetter<C> {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java. lang.String)
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java. lang.String)
*/
@Override
public Set<C> getAll(final String conceptKeyName) {
@@ -117,7 +116,7 @@ public class AxConceptGetterImpl<C> implements AxConceptGetter<C> {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java. lang.String, java.lang.String)
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java. lang.String, java.lang.String)
*/
@Override
public Set<C> getAll(final String conceptKeyName, final String conceptKeyVersion) {
@@ -148,8 +147,7 @@ public class AxConceptGetterImpl<C> implements AxConceptGetter<C> {
break;
}
returnSet.add(conceptMap.get(foundKey));
- }
- while (true);
+ } while (true);
return returnSet;
}
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKey.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKey.java
index 0d63dbf7d..36b49259b 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKey.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKey.java
@@ -1,28 +1,28 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
/**
- * The key uniquely identifies every entity in the system. This class is an abstract class to give a common parent for all key types in the
- * system.
+ * The key uniquely identifies every entity in the system. This class is an abstract class to give a common parent for
+ * all key types in the system.
*/
public abstract class AxKey extends AxConcept {
private static final long serialVersionUID = 6281159885962014041L;
@@ -48,11 +48,17 @@ public abstract class AxKey extends AxConcept {
public enum Compatibility {
/** The keys have different names. */
DIFFERENT,
- /** The name of the key matches but the Major version number of the keys is different (x in x.y.z do not match). */
+ /**
+ * The name of the key matches but the Major version number of the keys is different (x in x.y.z do not match).
+ */
MAJOR,
- /** The name of the key matches but the Minor version number of the keys is different (y in x.y.z do not match). */
+ /**
+ * The name of the key matches but the Minor version number of the keys is different (y in x.y.z do not match).
+ */
MINOR,
- /** The name of the key matches but the Patch version number of the keys is different (z in x.y.z do not match). */
+ /**
+ * The name of the key matches but the Patch version number of the keys is different (z in x.y.z do not match).
+ */
PATCH,
/** The keys match completely. */
IDENTICAL
@@ -62,21 +68,22 @@ public abstract class AxKey extends AxConcept {
* Default constructor
*/
public AxKey() {
- super();
+ super();
}
-
+
/**
* Copy constructor
+ *
* @param copyConcept the concept to copy from
*/
public AxKey(final AxKey copyConcept) {
- super(copyConcept);
+ super(copyConcept);
}
-
- /*
+
+ /*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getID()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getID()
*/
@Override
public abstract String getID();
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKeyInfo.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java
index 1ffb40b27..6c709fa63 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKeyInfo.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.List;
import java.util.Random;
@@ -36,24 +36,26 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.apex.model.basicmodel.dao.converters.CDATAConditioner;
-import org.onap.apex.model.basicmodel.dao.converters.UUID2String;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner;
+import org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * The key information on an {@link AxArtifactKey} key in an Apex policy model. Each {@link AxArtifactKey} must have an {@link AxKeyInfo} object. THe
- * information held is the key's UUID and it's description.
+ * The key information on an {@link AxArtifactKey} key in an Apex policy model. Each {@link AxArtifactKey} must have an
+ * {@link AxKeyInfo} object. THe information held is the key's UUID and it's description.
* <p>
- * Validation checks that all fields are defined and that the key is valid. It also observes that descriptions are blank and warns if the UUID is a zero UUID.
+ * Validation checks that all fields are defined and that the key is valid. It also observes that descriptions are blank
+ * and warns if the UUID is a zero UUID.
*/
@Entity
@Table(name = "AxKeyInfo")
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexKeyInfo", namespace = "http://www.ericsson.com/apex")
-@XmlType(name = "AxKeyInfo", namespace = "http://www.ericsson.com/apex", propOrder = { "key", "uuid", "description" })
+@XmlRootElement(name = "apexKeyInfo", namespace = "http://www.onap.org/policy/apex-pdp")
+@XmlType(name = "AxKeyInfo", namespace = "http://www.onap.org/policy/apex-pdp",
+ propOrder = { "key", "uuid", "description" })
public class AxKeyInfo extends AxConcept {
private static final long serialVersionUID = -4023935924068914308L;
@@ -86,12 +88,13 @@ public class AxKeyInfo extends AxConcept {
/**
* Copy constructor
+ *
* @param copyConcept the concept to copy from
*/
public AxKeyInfo(final AxKeyInfo copyConcept) {
- super(copyConcept);
+ super(copyConcept);
}
-
+
/**
* Constructor to create this concept with the specified key.
*
@@ -122,7 +125,7 @@ public class AxKeyInfo extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKey()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
*/
@Override
public AxArtifactKey getKey() {
@@ -132,7 +135,7 @@ public class AxKeyInfo extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
*/
@Override
public List<AxKey> getKeys() {
@@ -190,24 +193,29 @@ public class AxKeyInfo extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#validate(com. ericsson.apex.model.basicmodel.concepts.AxValidationResult)
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxValidationResult)
*/
@Override
public AxValidationResult validate(final AxValidationResult resultIn) {
AxValidationResult result = resultIn;
if (key.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ result.addValidationMessage(
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
}
result = key.validate(result);
if (description.trim().length() == 0) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION, "description is blank"));
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION,
+ "description is blank"));
}
if (uuid.equals(new UUID(0, 0))) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.WARNING, "UUID is a zero UUID: " + new UUID(0, 0)));
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.WARNING,
+ "UUID is a zero UUID: " + new UUID(0, 0)));
}
return result;
@@ -216,7 +224,7 @@ public class AxKeyInfo extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#clean()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
*/
@Override
public void clean() {
@@ -227,7 +235,7 @@ public class AxKeyInfo extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#toString()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
*/
@Override
public String toString() {
@@ -244,13 +252,15 @@ public class AxKeyInfo extends AxConcept {
return builder.toString();
}
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.basicmodel.concepts.AxConcept)
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public AxConcept copyTo(final AxConcept target) {
Assertions.argumentNotNull(target, "target may not be null");
final Object copyObject = target;
@@ -267,7 +277,7 @@ public class AxKeyInfo extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
*/
@Override
public int hashCode() {
@@ -282,7 +292,7 @@ public class AxKeyInfo extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
*/
@Override
public boolean equals(final Object obj) {
@@ -345,11 +355,10 @@ public class AxKeyInfo extends AxConcept {
final Random random;
if (seed != null && seed.length() > 0) {
random = new Random(seed.hashCode());
- }
- else {
+ } else {
random = new Random();
}
- byte[] array = new byte[UUID_BYTE_LENGTH_16];
+ final byte[] array = new byte[UUID_BYTE_LENGTH_16];
random.nextBytes(array);
return UUID.nameUUIDFromBytes(array);
}
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java
new file mode 100644
index 000000000..2ddbe5def
--- /dev/null
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java
@@ -0,0 +1,460 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.basicmodel.concepts;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.NavigableMap;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.UUID;
+
+import javax.persistence.CascadeType;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.utilities.Assertions;
+
+/**
+ * The Class AxKeyInformation holds a map of the key information for the entire Apex model. All Apex models
+ * {@link AxModel} must have an {@link AxKeyInformation} field. The {@link AxKeyInformation} class implements the helper
+ * methods of the {@link AxConceptGetter} interface to allow {@link AxKeyInfo} instances to be retrieved by calling
+ * methods directly on this class without referencing the contained map.
+ * <p>
+ * Validation checks that the key is not null, that the key information map is not empty, that each key and value in the
+ * map is defined, that the key in each map entry matches the key if each entry value, and that no duplicate UUIDs
+ * exist. Each key information entry is then validated individually.
+ */
+@Entity
+@Table(name = "AxKeyInformation")
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "AxKeyInformation", namespace = "http://www.onap.org/policy/apex-pdp",
+ propOrder = { "key", "keyInfoMap" })
+
+public class AxKeyInformation extends AxConcept implements AxConceptGetter<AxKeyInfo> {
+ private static final long serialVersionUID = -2746380769017043888L;
+
+ @EmbeddedId
+ @XmlElement(name = "key", required = true)
+ private AxArtifactKey key;
+
+ // @formatter:off
+ @ManyToMany(cascade = CascadeType.ALL)
+ @JoinTable(
+ joinColumns = { @JoinColumn(name = "keyInfoMapName", referencedColumnName = "name"),
+ @JoinColumn(name = "keyInfoMapVersion", referencedColumnName = "version"), },
+ inverseJoinColumns = { @JoinColumn(name = "keyInfoName", referencedColumnName = "name"),
+ @JoinColumn(name = "keyInfoVersion", referencedColumnName = "version") })
+ private Map<AxArtifactKey, AxKeyInfo> keyInfoMap;
+ // @formatter:on
+
+ /**
+ * The Default Constructor creates this concept with a null key.
+ */
+ public AxKeyInformation() {
+ this(new AxArtifactKey());
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param copyConcept the concept to copy from
+ */
+ public AxKeyInformation(final AxKeyInformation copyConcept) {
+ super(copyConcept);
+ }
+
+ /**
+ * Constructor to create this concept with the specified key.
+ *
+ * @param key the key of the concept
+ */
+ public AxKeyInformation(final AxArtifactKey key) {
+ this(key, new TreeMap<AxArtifactKey, AxKeyInfo>());
+ }
+
+ /**
+ * Constructor to create this concept and set all its fields.
+ *
+ * @param key the key of the concept
+ * @param keyInfoMap the key info map of the concept
+ */
+ public AxKeyInformation(final AxArtifactKey key, final Map<AxArtifactKey, AxKeyInfo> keyInfoMap) {
+ super();
+ Assertions.argumentNotNull(key, "key may not be null");
+ Assertions.argumentNotNull(keyInfoMap, "keyInfoMap may not be null");
+
+ this.key = key;
+ this.keyInfoMap = new TreeMap<>();
+ this.keyInfoMap.putAll(keyInfoMap);
+ }
+
+ /**
+ * When a model is unmarshalled from disk or from the database, the key information map is returned as a raw Hash
+ * Map. This method is called by JAXB after unmarshaling and is used to convert the hash map to a
+ * {@link NavigableMap} so that it will work with the {@link AxConceptGetter} interface.
+ *
+ * @param u the unmarshaler that is unmarshaling the model
+ * @param parent the parent object of this object in the unmarshaler
+ */
+ public void afterUnmarshal(final Unmarshaller u, final Object parent) {
+ // The map must be navigable to allow name and version searching,
+ // unmarshaling returns a hash map
+ final NavigableMap<AxArtifactKey, AxKeyInfo> navigablekeyInfoMap = new TreeMap<>();
+ navigablekeyInfoMap.putAll(keyInfoMap);
+ keyInfoMap = navigablekeyInfoMap;
+ }
+
+ /**
+ * This method generates default key information for all keys found in the concept passed in as a parameter that do
+ * not already have key information.
+ *
+ * @param concept the concept for which to generate key information
+ */
+ public void generateKeyInfo(final AxConcept concept) {
+ for (final AxKey axKey : concept.getKeys()) {
+ if (!(axKey instanceof AxArtifactKey)) {
+ continue;
+ }
+
+ final AxArtifactKey artifactKey = (AxArtifactKey) axKey;
+ if (!keyInfoMap.containsKey(artifactKey)) {
+ final AxKeyInfo keyInfo = new AxKeyInfo(artifactKey);
+ // generate a reproducible UUID
+ keyInfo.setUuid(AxKeyInfo.generateReproducibleUUID(keyInfo.getID() + keyInfo.getDescription()));
+ keyInfoMap.put(artifactKey, keyInfo);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
+ */
+ @Override
+ public AxArtifactKey getKey() {
+ return key;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ */
+ @Override
+ public List<AxKey> getKeys() {
+ final List<AxKey> keyList = key.getKeys();
+ keyList.addAll(keyInfoMap.keySet());
+
+ return keyList;
+ }
+
+ /**
+ * Sets the key of this concept.
+ *
+ * @param key the key of this concept
+ */
+ public void setKey(final AxArtifactKey key) {
+ Assertions.argumentNotNull(key, "key may not be null");
+ this.key = key;
+ }
+
+ /**
+ * Gets the key info map of this concept.
+ *
+ * @return the key info map of this concept
+ */
+ public Map<AxArtifactKey, AxKeyInfo> getKeyInfoMap() {
+ return keyInfoMap;
+ }
+
+ /**
+ * Sets the key info map of this concept.
+ *
+ * @param keyInfoMap the key info map of this concept
+ */
+ public void setKeyInfoMap(final Map<AxArtifactKey, AxKeyInfo> keyInfoMap) {
+ Assertions.argumentNotNull(keyInfoMap, "keyInfoMap may not be null");
+ this.keyInfoMap = new TreeMap<>();
+ this.keyInfoMap.putAll(keyInfoMap);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxValidationResult)
+ */
+ @Override
+ public AxValidationResult validate(final AxValidationResult resultIn) {
+ AxValidationResult result = resultIn;
+
+ if (key.equals(AxArtifactKey.getNullKey())) {
+ result.addValidationMessage(
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ }
+
+ result = key.validate(result);
+
+ if (keyInfoMap.size() == 0) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "keyInfoMap may not be empty"));
+ } else {
+ final Set<UUID> uuidSet = new TreeSet<>();
+
+ for (final Entry<AxArtifactKey, AxKeyInfo> keyInfoEntry : keyInfoMap.entrySet()) {
+ result = validateKeyInfoEntry(keyInfoEntry, uuidSet, result);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Validate an key information entry
+ *
+ * @param keyInfoEntry the key information entry
+ * @param uuidSet the set of UUIDs encountered in validation so far, the UUID of this entry is added to the set
+ * @param result the validation result to append to
+ * @return The validation result
+ */
+ private AxValidationResult validateKeyInfoEntry(final Entry<AxArtifactKey, AxKeyInfo> keyInfoEntry,
+ final Set<UUID> uuidSet, AxValidationResult result) {
+ if (keyInfoEntry.getKey().equals(AxArtifactKey.getNullKey())) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key on keyInfoMap entry " + keyInfoEntry.getKey() + " may not be the null key"));
+ } else if (keyInfoEntry.getValue() == null) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "value on keyInfoMap entry " + keyInfoEntry.getKey() + " may not be null"));
+ } else {
+ if (!keyInfoEntry.getKey().equals(keyInfoEntry.getValue().getKey())) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key on keyInfoMap entry " + keyInfoEntry.getKey() + " does not equal entry key "
+ + keyInfoEntry.getValue().getKey()));
+ }
+
+ result = keyInfoEntry.getValue().validate(result);
+
+ if (uuidSet.contains(keyInfoEntry.getValue().getUUID())) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "duplicate UUID found on keyInfoMap entry " + keyInfoEntry.getKey() + ":"
+ + keyInfoEntry.getValue().getUUID()));
+ } else {
+ uuidSet.add(keyInfoEntry.getValue().getUUID());
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
+ */
+ @Override
+ public void clean() {
+ key.clean();
+ for (final Entry<AxArtifactKey, AxKeyInfo> keyInfoEntry : keyInfoMap.entrySet()) {
+ keyInfoEntry.getKey().clean();
+ keyInfoEntry.getValue().clean();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
+ */
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(this.getClass().getSimpleName());
+ builder.append(":(");
+ builder.append("key=");
+ builder.append(key);
+ builder.append(",keyInfoMap=");
+ builder.append(keyInfoMap);
+ builder.append(")");
+ return builder.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public AxConcept copyTo(final AxConcept target) {
+ Assertions.argumentNotNull(target, "target may not be null");
+
+ final Object copyObject = target;
+ Assertions.instanceOf(copyObject, AxKeyInformation.class);
+
+ final AxKeyInformation copy = ((AxKeyInformation) copyObject);
+ copy.setKey(new AxArtifactKey(key));
+ final Map<AxArtifactKey, AxKeyInfo> newKeyInfoMap = new TreeMap<>();
+ for (final Entry<AxArtifactKey, AxKeyInfo> keyInfoMapEntry : keyInfoMap.entrySet()) {
+ newKeyInfoMap.put(new AxArtifactKey(keyInfoMapEntry.getKey()), new AxKeyInfo(keyInfoMapEntry.getValue()));
+ }
+ copy.setKeyInfoMap(newKeyInfoMap);
+
+ return copy;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + key.hashCode();
+ result = prime * result + keyInfoMap.hashCode();
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (this == obj) {
+ return true;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ final AxKeyInformation other = (AxKeyInformation) obj;
+ if (!key.equals(other.key)) {
+ return false;
+ }
+ return keyInfoMap.equals(other.keyInfoMap);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ public int compareTo(final AxConcept otherObj) {
+ if (otherObj == null) {
+ return -1;
+ }
+ if (this == otherObj) {
+ return 0;
+ }
+ if (getClass() != otherObj.getClass()) {
+ return this.hashCode() - otherObj.hashCode();
+ }
+
+ final AxKeyInformation other = (AxKeyInformation) otherObj;
+ if (!key.equals(other.key)) {
+ return key.compareTo(other.key);
+ }
+ if (!keyInfoMap.equals(other.keyInfoMap)) {
+ return (keyInfoMap.hashCode() - other.keyInfoMap.hashCode());
+ }
+
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#get(org.onap.policy.apex.core.basicmodel.concepts.
+ * AxArtifactKey)
+ */
+ @Override
+ public AxKeyInfo get(final AxArtifactKey conceptKey) {
+ return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxKeyInfo>) keyInfoMap).get(conceptKey);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang. String)
+ */
+ @Override
+ public AxKeyInfo get(final String conceptKeyName) {
+ return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxKeyInfo>) keyInfoMap).get(conceptKeyName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang. String, java.lang.String)
+ */
+ @Override
+ public AxKeyInfo get(final String conceptKeyName, final String conceptKeyVersion) {
+ return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxKeyInfo>) keyInfoMap).get(conceptKeyName,
+ conceptKeyVersion);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java. lang.String)
+ */
+ @Override
+ public Set<AxKeyInfo> getAll(final String conceptKeyName) {
+ return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxKeyInfo>) keyInfoMap).getAll(conceptKeyName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java. lang.String, java.lang.String)
+ */
+ @Override
+ public Set<AxKeyInfo> getAll(final String conceptKeyName, final String conceptKeyVersion) {
+ return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxKeyInfo>) keyInfoMap).getAll(conceptKeyName,
+ conceptKeyVersion);
+ }
+}
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKeyUse.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java
index 990c8f7de..eeb8dc650 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxKeyUse.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java
@@ -1,34 +1,34 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.List;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * This class records a usage of a key in the system. When the list of keys being used by a concept is built using the getKeys() method of
- * the {@link AxConcept} class, an instance of this class is created for every key occurrence. The list of keys returned by the getKeys()
- * method is a list of {@link AxKeyUse} objects.
+ * This class records a usage of a key in the system. When the list of keys being used by a concept is built using the
+ * getKeys() method of the {@link AxConcept} class, an instance of this class is created for every key occurrence. The
+ * list of keys returned by the getKeys() method is a list of {@link AxKeyUse} objects.
* <p>
* Validation checks that each key is valid.
*/
@@ -47,12 +47,13 @@ public class AxKeyUse extends AxKey {
/**
* Copy constructor
+ *
* @param copyConcept the concept to copy from
*/
public AxKeyUse(final AxKeyUse copyConcept) {
- super(copyConcept);
+ super(copyConcept);
}
-
+
/**
* This constructor creates an instance of this class, and holds a reference to a used key.
*
@@ -66,7 +67,7 @@ public class AxKeyUse extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKey()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
*/
@Override
public AxKey getKey() {
@@ -76,7 +77,7 @@ public class AxKeyUse extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
*/
@Override
public List<AxKey> getKeys() {
@@ -86,7 +87,7 @@ public class AxKeyUse extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxKey#getID()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxKey#getID()
*/
@Override
public String getID() {
@@ -106,7 +107,8 @@ public class AxKeyUse extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxKey#getCompatibility(com. ericsson.apex.model.basicmodel.concepts.AxKey)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxKey#getCompatibility(org.onap.policy.apex.model.basicmodel.
+ * concepts.AxKey)
*/
@Override
public AxKey.Compatibility getCompatibility(final AxKey otherKey) {
@@ -116,7 +118,9 @@ public class AxKeyUse extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxKey#isCompatible(com. ericsson.apex.model.basicmodel.concepts.AxKey)
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxKey#isCompatible(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxKey)
*/
@Override
public boolean isCompatible(final AxKey otherKey) {
@@ -126,13 +130,15 @@ public class AxKeyUse extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#validate(com. ericsson.apex.model.basicmodel.concepts.AxValidationResult)
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxValidationResult)
*/
@Override
public AxValidationResult validate(final AxValidationResult result) {
if (usedKey.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(
- new AxValidationMessage(usedKey, this.getClass(), ValidationResult.INVALID, "usedKey is a null key"));
+ result.addValidationMessage(new AxValidationMessage(usedKey, this.getClass(), ValidationResult.INVALID,
+ "usedKey is a null key"));
}
return usedKey.validate(result);
}
@@ -140,7 +146,7 @@ public class AxKeyUse extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#clean()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
*/
@Override
public void clean() {
@@ -150,7 +156,7 @@ public class AxKeyUse extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#toString()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
*/
@Override
public String toString() {
@@ -163,13 +169,15 @@ public class AxKeyUse extends AxKey {
return builder.toString();
}
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.basicmodel.concepts.AxConcept)
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public AxConcept copyTo(final AxConcept target) {
Assertions.argumentNotNull(target, "target may not be null");
final Object copyObject = target;
@@ -177,20 +185,19 @@ public class AxKeyUse extends AxKey {
final AxKeyUse copy = ((AxKeyUse) copyObject);
try {
- copy.usedKey = usedKey.getClass().newInstance();
- }
- catch (Exception e) {
- throw new ApexRuntimeException("error copying concept key: " + e.getMessage(), e);
- }
+ copy.usedKey = usedKey.getClass().newInstance();
+ } catch (final Exception e) {
+ throw new ApexRuntimeException("error copying concept key: " + e.getMessage(), e);
+ }
usedKey.copyTo(copy.usedKey);
-
+
return copy;
}
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
*/
@Override
public int hashCode() {
@@ -203,7 +210,7 @@ public class AxKeyUse extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
*/
@Override
public boolean equals(final Object obj) {
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxModel.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java
index f0489c734..dac1d693c 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxModel.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.List;
import java.util.Set;
@@ -39,32 +39,34 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.apex.model.basicmodel.service.ModelService;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.service.ModelService;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * This class is the base class for all models in Apex. All model classes inherit from this model so all models must have a key and have key information.
+ * This class is the base class for all models in Apex. All model classes inherit from this model so all models must
+ * have a key and have key information.
* <p>
- * Validation checks that the model key is valid. It goes on to check for null keys and checks each key for uniqueness in the model. A check is carried out to
- * ensure that an {@link AxKeyInfo} instance exists for every {@link AxArtifactKey} key. For each {@link AxReferenceKey} instance, a check is made that its
- * parent and local name are nut null and that a {@link AxKeyInfo} entry exists for its parent. Then a check is made that each used {@link AxArtifactKey} and
- * {@link AxReferenceKey} usage references a key that exists. Finally, a check is made to ensure that an {@link AxArtifactKey} instance exists for every
- * {@link AxKeyInfo} instance.
+ * Validation checks that the model key is valid. It goes on to check for null keys and checks each key for uniqueness
+ * in the model. A check is carried out to ensure that an {@link AxKeyInfo} instance exists for every
+ * {@link AxArtifactKey} key. For each {@link AxReferenceKey} instance, a check is made that its parent and local name
+ * are nut null and that a {@link AxKeyInfo} entry exists for its parent. Then a check is made that each used
+ * {@link AxArtifactKey} and {@link AxReferenceKey} usage references a key that exists. Finally, a check is made to
+ * ensure that an {@link AxArtifactKey} instance exists for every {@link AxKeyInfo} instance.
*/
@Entity
@Table(name = "AxModel")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
-@XmlRootElement(name = "apexModel", namespace = "http://www.ericsson.com/apex")
+@XmlRootElement(name = "apexModel", namespace = "http://www.onap.org/policy/apex-pdp")
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxModel", namespace = "http://www.ericsson.com/apex", propOrder = { "key", "keyInformation" })
+@XmlType(name = "AxModel", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "key", "keyInformation" })
public class AxModel extends AxConcept {
private static final String IS_A_NULL_KEY = " is a null key";
- private static final long serialVersionUID = -771659065637205430L;
+ private static final long serialVersionUID = -771659065637205430L;
@EmbeddedId
@XmlElement(name = "key", required = true)
@@ -72,10 +74,8 @@ public class AxModel extends AxConcept {
// @formatter:off
@OneToOne(cascade = CascadeType.ALL)
- @JoinColumns({
- @JoinColumn(name = "keyInformationName", referencedColumnName = "name"),
- @JoinColumn(name = "keyInformationVersion", referencedColumnName = "version")
- })
+ @JoinColumns({ @JoinColumn(name = "keyInformationName", referencedColumnName = "name"),
+ @JoinColumn(name = "keyInformationVersion", referencedColumnName = "version") })
@XmlElement(name = "keyInformation", required = true)
private AxKeyInformation keyInformation;
// @formatter:on
@@ -89,12 +89,13 @@ public class AxModel extends AxConcept {
/**
* Copy constructor
+ *
* @param copyConcept the concept to copy from
*/
public AxModel(final AxModel copyConcept) {
- super(copyConcept);
+ super(copyConcept);
}
-
+
/**
* Constructor to create this concept with the specified key.
*
@@ -120,8 +121,9 @@ public class AxModel extends AxConcept {
}
/**
- * Registers this model with the {@link ModelService}. All models are registered with the model service so that models can be references from anywhere in
- * the Apex system without being passed as references through deep call chains.
+ * Registers this model with the {@link ModelService}. All models are registered with the model service so that
+ * models can be references from anywhere in the Apex system without being passed as references through deep call
+ * chains.
*/
public void register() {
ModelService.registerModel(AxKeyInformation.class, getKeyInformation());
@@ -130,7 +132,7 @@ public class AxModel extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKey()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
*/
@Override
public AxArtifactKey getKey() {
@@ -140,7 +142,7 @@ public class AxModel extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
*/
@Override
public List<AxKey> getKeys() {
@@ -186,14 +188,17 @@ public class AxModel extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#validate(com. ericsson.apex.model.basicmodel.concepts.AxValidationResult)
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxValidationResult)
*/
@Override
public AxValidationResult validate(final AxValidationResult resultIn) {
AxValidationResult result = resultIn;
if (key.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ result.addValidationMessage(
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
}
result = key.validate(result);
@@ -207,10 +212,9 @@ public class AxModel extends AxConcept {
for (final AxKey axKey : this.getKeys()) {
// Check for the two type of keys we have
if (axKey instanceof AxArtifactKey) {
- result = validateArtifactKeyInModel((AxArtifactKey) axKey, artifactKeySet, result);
- }
- else if (axKey instanceof AxReferenceKey) {
- result = validateReferenceKeyInModel((AxReferenceKey) axKey, referenceKeySet, result);
+ result = validateArtifactKeyInModel((AxArtifactKey) axKey, artifactKeySet, result);
+ } else if (axKey instanceof AxReferenceKey) {
+ result = validateReferenceKeyInModel((AxReferenceKey) axKey, referenceKeySet, result);
}
// It must be an AxKeyUse, nothing else is legal
else {
@@ -231,26 +235,28 @@ public class AxModel extends AxConcept {
// Check key information for unused key information
for (final AxArtifactKey keyInfoKey : keyInformation.getKeyInfoMap().keySet()) {
if (!artifactKeySet.contains(keyInfoKey)) {
- result.addValidationMessage(
- new AxValidationMessage(keyInfoKey, this.getClass(), ValidationResult.WARNING, "key not found for key information entry"));
+ result.addValidationMessage(new AxValidationMessage(keyInfoKey, this.getClass(),
+ ValidationResult.WARNING, "key not found for key information entry"));
}
}
return result;
}
- /**
+ /**
* Check for consistent usage of an artifact key in the model
+ *
* @param artifactKey The artifact key to check
- * @param artifactKeySet The set of artifact keys encountered so far, this key is appended to the set
+ * @param artifactKeySet The set of artifact keys encountered so far, this key is appended to the set
* @param result The validation result to append to
* @return the result of the validation
*/
- private AxValidationResult validateArtifactKeyInModel(final AxArtifactKey artifactKey, Set<AxArtifactKey> artifactKeySet, AxValidationResult result) {
+ private AxValidationResult validateArtifactKeyInModel(final AxArtifactKey artifactKey,
+ final Set<AxArtifactKey> artifactKeySet, final AxValidationResult result) {
// Null key check
if (artifactKey.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key " + artifactKey + IS_A_NULL_KEY));
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key " + artifactKey + IS_A_NULL_KEY));
}
// Null key name start check
@@ -261,34 +267,35 @@ public class AxModel extends AxConcept {
// Unique key check
if (artifactKeySet.contains(artifactKey)) {
- result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "duplicate key " + artifactKey + " found"));
- }
- else {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "duplicate key " + artifactKey + " found"));
+ } else {
artifactKeySet.add(artifactKey);
}
// Key information check
if (!keyInformation.getKeyInfoMap().containsKey(artifactKey)) {
- result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key information not found for key " + artifactKey));
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key information not found for key " + artifactKey));
}
-
+
return result;
- }
+ }
- /**
+ /**
* Check for consistent usage of a reference key in the model
+ *
* @param artifactKey The reference key to check
- * @param referenceKeySet The set of reference keys encountered so far, this key is appended to the set
+ * @param referenceKeySet The set of reference keys encountered so far, this key is appended to the set
* @param result The validation result to append to
* @return the result of the validation
*/
- private AxValidationResult validateReferenceKeyInModel(final AxReferenceKey referenceKey, Set<AxReferenceKey> referenceKeySet, AxValidationResult result) {
+ private AxValidationResult validateReferenceKeyInModel(final AxReferenceKey referenceKey,
+ final Set<AxReferenceKey> referenceKeySet, final AxValidationResult result) {
// Null key check
if (referenceKey.equals(AxReferenceKey.getNullKey())) {
- result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key " + referenceKey + IS_A_NULL_KEY));
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key " + referenceKey + IS_A_NULL_KEY));
}
// Null parent key check
@@ -299,8 +306,8 @@ public class AxModel extends AxConcept {
// Null local name check
if (referenceKey.getLocalName().equals(AxKey.NULL_KEY_NAME)) {
- result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key " + referenceKey + " has a null local name"));
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key " + referenceKey + " has a null local name"));
}
// Null key name start check
@@ -311,10 +318,9 @@ public class AxModel extends AxConcept {
// Unique key check
if (referenceKeySet.contains(referenceKey)) {
- result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "duplicate key " + referenceKey + " found"));
- }
- else {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "duplicate key " + referenceKey + " found"));
+ } else {
referenceKeySet.add(referenceKey);
}
@@ -325,44 +331,44 @@ public class AxModel extends AxConcept {
}
return result;
- }
-
- /**
+ }
+
+ /**
* Check for consistent usage of cross-key references in the model
+ *
* @param usedKeySet The set of all keys used in the model
- * @param artifactKeySet The set of artifact keys encountered so far, this key is appended to the set
- * @param referenceKeySet The set of reference keys encountered so far, this key is appended to the set
+ * @param artifactKeySet The set of artifact keys encountered so far, this key is appended to the set
+ * @param referenceKeySet The set of reference keys encountered so far, this key is appended to the set
* @param result The validation result to append to
* @return the result of the validation
*/
- private AxValidationResult validateKeyUses(final Set<AxKeyUse> usedKeySet, final Set<AxArtifactKey> artifactKeySet,
- final Set<AxReferenceKey> referenceKeySet, AxValidationResult result) {
+ private AxValidationResult validateKeyUses(final Set<AxKeyUse> usedKeySet, final Set<AxArtifactKey> artifactKeySet,
+ final Set<AxReferenceKey> referenceKeySet, final AxValidationResult result) {
// Check all key uses
for (final AxKeyUse usedKey : usedKeySet) {
if (usedKey.getKey() instanceof AxArtifactKey) {
// AxArtifact key usage, check the key exists
if (!artifactKeySet.contains(usedKey.getKey())) {
- result.addValidationMessage(new AxValidationMessage(usedKey.getKey(), this.getClass(), ValidationResult.INVALID,
- "an artifact key used in the model is not defined"));
+ result.addValidationMessage(new AxValidationMessage(usedKey.getKey(), this.getClass(),
+ ValidationResult.INVALID, "an artifact key used in the model is not defined"));
}
- }
- else {
+ } else {
// AxReference key usage, check the key exists
if (!referenceKeySet.contains(usedKey.getKey())) {
- result.addValidationMessage(new AxValidationMessage(usedKey.getKey(), this.getClass(), ValidationResult.INVALID,
- "a reference key used in the model is not defined"));
+ result.addValidationMessage(new AxValidationMessage(usedKey.getKey(), this.getClass(),
+ ValidationResult.INVALID, "a reference key used in the model is not defined"));
}
}
}
-
+
return result;
- }
+ }
- /*
+ /*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#clean()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
*/
@Override
public void clean() {
@@ -373,7 +379,7 @@ public class AxModel extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#toString()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
*/
@Override
public String toString() {
@@ -388,13 +394,15 @@ public class AxModel extends AxConcept {
return builder.toString();
}
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.basicmodel.concepts.AxConcept)
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public AxConcept copyTo(final AxConcept target) {
Assertions.argumentNotNull(target, "target may not be null");
final Object copyObject = target;
@@ -410,7 +418,7 @@ public class AxModel extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
*/
@Override
public int hashCode() {
@@ -424,7 +432,7 @@ public class AxModel extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
*/
@Override
public boolean equals(final Object obj) {
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxReferenceKey.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java
index 9401152d0..5965dd02b 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxReferenceKey.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.ArrayList;
import java.util.List;
@@ -31,42 +31,46 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * A reference key identifies entities in the system that are contained in other entities. Every contained concept in the system must have an
- * {@link AxReferenceKey} to identify it. Non-contained first order concepts are identified using an {@link AxArtifactKey} key.
+ * A reference key identifies entities in the system that are contained in other entities. Every contained concept in
+ * the system must have an {@link AxReferenceKey} to identify it. Non-contained first order concepts are identified
+ * using an {@link AxArtifactKey} key.
* <p>
- * An {@link AxReferenceKey} contains an {@link AxArtifactKey} key reference to the first order entity that contains it. The local name of the reference key
- * must uniquely identify the referenced concept among those concepts contained in the reference key's parent. In other words, if a parent concept has more than
- * one child, the local name in the key of all its children must be unique.
+ * An {@link AxReferenceKey} contains an {@link AxArtifactKey} key reference to the first order entity that contains it.
+ * The local name of the reference key must uniquely identify the referenced concept among those concepts contained in
+ * the reference key's parent. In other words, if a parent concept has more than one child, the local name in the key of
+ * all its children must be unique.
* <p>
- * If a reference key's parent is itself a reference key, then the parent's local name must be set in the reference key. If the parent is a first order concept,
- * then the parent's local name in the key will be set to NULL.
+ * If a reference key's parent is itself a reference key, then the parent's local name must be set in the reference key.
+ * If the parent is a first order concept, then the parent's local name in the key will be set to NULL.
* <p>
- * Key validation checks that the parent name and parent version fields match the {@link NAME_REGEXP} and {@link VERSION_REGEXP} regular expressions
- * respectively and that the local name fields match the {@link LOCAL_NAME_REGEXP} regular expression.
+ * Key validation checks that the parent name and parent version fields match the {@link NAME_REGEXP} and
+ * {@link VERSION_REGEXP} regular expressions respectively and that the local name fields match the
+ * {@link LOCAL_NAME_REGEXP} regular expression.
*/
@Embeddable
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexReferenceKey", namespace = "http://www.ericsson.com/apex")
-@XmlType(name = "AxReferenceKey", namespace = "http://www.ericsson.com/apex", propOrder = { "parentKeyName", "parentKeyVersion", "parentLocalName",
- "localName" })
+@XmlRootElement(name = "apexReferenceKey", namespace = "http://www.onap.org/policy/apex-pdp")
+@XmlType(name = "AxReferenceKey", namespace = "http://www.onap.org/policy/apex-pdp",
+ propOrder = { "parentKeyName", "parentKeyVersion", "parentLocalName", "localName" })
public class AxReferenceKey extends AxKey {
- private static final String PARENT_KEY_NAME = "parentKeyName";
- private static final String PARENT_KEY_VERSION = "parentKeyVersion";
- private static final String PARENT_LOCAL_NAME = "parentLocalName";
+ private static final String PARENT_KEY_NAME = "parentKeyName";
+ private static final String PARENT_KEY_VERSION = "parentKeyVersion";
+ private static final String PARENT_LOCAL_NAME = "parentLocalName";
private static final String LOCAL_NAME = "localName";
- private static final long serialVersionUID = 8932717618579392561L;
+ private static final long serialVersionUID = 8932717618579392561L;
- /** Regular expression to specify the structure of local names in reference keys.*/
+ /** Regular expression to specify the structure of local names in reference keys. */
public static final String LOCAL_NAME_REGEXP = "[A-Za-z0-9\\-_\\.]+|^$";
- /** Regular expression to specify the structure of IDs in reference keys.*/
- public static final String REFERENCE_KEY_ID_REGEXP = "[A-Za-z0-9\\-_]+:[0-9].[0-9].[0-9]:[A-Za-z0-9\\-_]+:[A-Za-z0-9\\-_]+";
+ /** Regular expression to specify the structure of IDs in reference keys. */
+ public static final String REFERENCE_KEY_ID_REGEXP =
+ "[A-Za-z0-9\\-_]+:[0-9].[0-9].[0-9]:[A-Za-z0-9\\-_]+:[A-Za-z0-9\\-_]+";
private static final int PARENT_NAME_FIELD = 0;
private static final int PARENT_VERSION_FIELD = 1;
@@ -102,7 +106,8 @@ public class AxReferenceKey extends AxKey {
* @param referenceKey the reference key to copy from
*/
public AxReferenceKey(final AxReferenceKey referenceKey) {
- this(referenceKey.getParentKeyName(), referenceKey.getParentKeyVersion(), referenceKey.getParentLocalName(), referenceKey.getLocalName());
+ this(referenceKey.getParentKeyName(), referenceKey.getParentKeyVersion(), referenceKey.getParentLocalName(),
+ referenceKey.getLocalName());
}
/**
@@ -135,8 +140,8 @@ public class AxReferenceKey extends AxKey {
}
/**
- * Constructor to create a reference key for the given parent reference key (specified by the parent reference key's artifact key and local name) with the
- * given local name.
+ * Constructor to create a reference key for the given parent reference key (specified by the parent reference key's
+ * artifact key and local name) with the given local name.
*
* @param axArtifactKey the artifact key of the parent reference key of this reference key
* @param parentLocalName the local name of the parent reference key of this reference key
@@ -147,8 +152,8 @@ public class AxReferenceKey extends AxKey {
}
/**
- * Constructor to create a reference key for the given parent artifact key (specified by the parent artifact key's name and version) with the given local
- * name.
+ * Constructor to create a reference key for the given parent artifact key (specified by the parent artifact key's
+ * name and version) with the given local name.
*
* @param parentKeyName the name of the parent artifact key of this reference key
* @param parentKeyVersion the version of the parent artifact key of this reference key
@@ -159,18 +164,22 @@ public class AxReferenceKey extends AxKey {
}
/**
- * Constructor to create a reference key for the given parent key (specified by the parent key's name, version nad local name) with the given local name.
+ * Constructor to create a reference key for the given parent key (specified by the parent key's name, version nad
+ * local name) with the given local name.
*
* @param parentKeyName the parent key name of this reference key
* @param parentKeyVersion the parent key version of this reference key
* @param parentLocalName the parent local name of this reference key
* @param localName the local name of this reference key
*/
- public AxReferenceKey(final String parentKeyName, final String parentKeyVersion, final String parentLocalName, final String localName) {
+ public AxReferenceKey(final String parentKeyName, final String parentKeyVersion, final String parentLocalName,
+ final String localName) {
super();
this.parentKeyName = Assertions.validateStringParameter(PARENT_KEY_NAME, parentKeyName, NAME_REGEXP);
- this.parentKeyVersion = Assertions.validateStringParameter(PARENT_KEY_VERSION, parentKeyVersion, VERSION_REGEXP);
- this.parentLocalName = Assertions.validateStringParameter(PARENT_LOCAL_NAME, parentLocalName, LOCAL_NAME_REGEXP);
+ this.parentKeyVersion =
+ Assertions.validateStringParameter(PARENT_KEY_VERSION, parentKeyVersion, VERSION_REGEXP);
+ this.parentLocalName =
+ Assertions.validateStringParameter(PARENT_LOCAL_NAME, parentLocalName, LOCAL_NAME_REGEXP);
this.localName = Assertions.validateStringParameter(LOCAL_NAME, localName, LOCAL_NAME_REGEXP);
}
@@ -189,10 +198,14 @@ public class AxReferenceKey extends AxKey {
final String[] nameVersionNameArray = conditionedId.split(":");
// Initiate the new key
- parentKeyName = Assertions.validateStringParameter(PARENT_KEY_NAME, nameVersionNameArray[PARENT_NAME_FIELD], NAME_REGEXP);
- parentKeyVersion = Assertions.validateStringParameter(PARENT_KEY_VERSION, nameVersionNameArray[PARENT_VERSION_FIELD], VERSION_REGEXP);
- parentLocalName = Assertions.validateStringParameter(PARENT_LOCAL_NAME, nameVersionNameArray[PARENT_LOCAL_NAME_FIELD], LOCAL_NAME_REGEXP);
- localName = Assertions.validateStringParameter(LOCAL_NAME, nameVersionNameArray[LOCAL_NAME_FIELD], LOCAL_NAME_REGEXP);
+ parentKeyName = Assertions.validateStringParameter(PARENT_KEY_NAME, nameVersionNameArray[PARENT_NAME_FIELD],
+ NAME_REGEXP);
+ parentKeyVersion = Assertions.validateStringParameter(PARENT_KEY_VERSION,
+ nameVersionNameArray[PARENT_VERSION_FIELD], VERSION_REGEXP);
+ parentLocalName = Assertions.validateStringParameter(PARENT_LOCAL_NAME,
+ nameVersionNameArray[PARENT_LOCAL_NAME_FIELD], LOCAL_NAME_REGEXP);
+ localName = Assertions.validateStringParameter(LOCAL_NAME, nameVersionNameArray[LOCAL_NAME_FIELD],
+ LOCAL_NAME_REGEXP);
}
/**
@@ -201,13 +214,14 @@ public class AxReferenceKey extends AxKey {
* @return a null reference key
*/
public static AxReferenceKey getNullKey() {
- return new AxReferenceKey(AxKey.NULL_KEY_NAME, AxKey.NULL_KEY_VERSION, AxKey.NULL_KEY_NAME, AxKey.NULL_KEY_NAME);
+ return new AxReferenceKey(AxKey.NULL_KEY_NAME, AxKey.NULL_KEY_VERSION, AxKey.NULL_KEY_NAME,
+ AxKey.NULL_KEY_NAME);
}
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKey()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
*/
@Override
public AxReferenceKey getKey() {
@@ -217,7 +231,7 @@ public class AxReferenceKey extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
*/
@Override
public List<AxKey> getKeys() {
@@ -229,7 +243,7 @@ public class AxReferenceKey extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxKey#getID()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxKey#getID()
*/
@Override
public String getID() {
@@ -313,7 +327,8 @@ public class AxReferenceKey extends AxKey {
* @param parentKeyVersion the parent key version of this reference key
*/
public void setParentKeyVersion(final String parentKeyVersion) {
- this.parentKeyVersion = Assertions.validateStringParameter(PARENT_KEY_VERSION, parentKeyVersion, VERSION_REGEXP);
+ this.parentKeyVersion =
+ Assertions.validateStringParameter(PARENT_KEY_VERSION, parentKeyVersion, VERSION_REGEXP);
}
/**
@@ -331,7 +346,8 @@ public class AxReferenceKey extends AxKey {
* @param parentLocalName the parent local name of this reference key
*/
public void setParentLocalName(final String parentLocalName) {
- this.parentLocalName = Assertions.validateStringParameter(PARENT_LOCAL_NAME, parentLocalName, LOCAL_NAME_REGEXP);
+ this.parentLocalName =
+ Assertions.validateStringParameter(PARENT_LOCAL_NAME, parentLocalName, LOCAL_NAME_REGEXP);
}
/**
@@ -355,7 +371,8 @@ public class AxReferenceKey extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxKey#getCompatibility(com. ericsson.apex.model.basicmodel.concepts.AxKey)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxKey#getCompatibility(org.onap.policy.apex.model.basicmodel.
+ * concepts.AxKey)
*/
@Override
public AxKey.Compatibility getCompatibility(final AxKey otherKey) {
@@ -370,7 +387,9 @@ public class AxReferenceKey extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxKey#isCompatible(com. ericsson.apex.model.basicmodel.concepts.AxKey)
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxKey#isCompatible(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxKey)
*/
@Override
public boolean isCompatible(final AxKey otherKey) {
@@ -385,36 +404,38 @@ public class AxReferenceKey extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#validate(com. ericsson.apex.model.basicmodel.concepts.AxValidationResult)
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxValidationResult)
*/
@Override
public AxValidationResult validate(final AxValidationResult result) {
try {
Assertions.validateStringParameter(PARENT_KEY_NAME, parentKeyName, NAME_REGEXP);
- }
- catch (final IllegalArgumentException e) {
- result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID, "parentKeyName invalid-" + e.getMessage()));
+ } catch (final IllegalArgumentException e) {
+ result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID,
+ "parentKeyName invalid-" + e.getMessage()));
}
try {
Assertions.validateStringParameter(PARENT_KEY_VERSION, parentKeyVersion, VERSION_REGEXP);
- }
- catch (final IllegalArgumentException e) {
- result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID, "parentKeyVersion invalid-" + e.getMessage()));
+ } catch (final IllegalArgumentException e) {
+ result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID,
+ "parentKeyVersion invalid-" + e.getMessage()));
}
try {
Assertions.validateStringParameter(PARENT_LOCAL_NAME, parentLocalName, LOCAL_NAME_REGEXP);
- }
- catch (final IllegalArgumentException e) {
- result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID, "parentLocalName invalid-" + e.getMessage()));
+ } catch (final IllegalArgumentException e) {
+ result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID,
+ "parentLocalName invalid-" + e.getMessage()));
}
try {
Assertions.validateStringParameter(LOCAL_NAME, localName, LOCAL_NAME_REGEXP);
- }
- catch (final IllegalArgumentException e) {
- result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID, "localName invalid-" + e.getMessage()));
+ } catch (final IllegalArgumentException e) {
+ result.addValidationMessage(new AxValidationMessage(this, this.getClass(), ValidationResult.INVALID,
+ "localName invalid-" + e.getMessage()));
}
return result;
@@ -423,7 +444,7 @@ public class AxReferenceKey extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#clean()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
*/
@Override
public void clean() {
@@ -436,7 +457,7 @@ public class AxReferenceKey extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#toString()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
*/
@Override
public String toString() {
@@ -455,13 +476,15 @@ public class AxReferenceKey extends AxKey {
return builder.toString();
}
- /*
- * (non-Javadoc)
- *
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.basicmodel.concepts.AxConcept)
- */
- @Override
- public AxConcept copyTo(final AxConcept target) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public AxConcept copyTo(final AxConcept target) {
Assertions.argumentNotNull(target, "target may not be null");
final Object copyObject = target;
@@ -479,7 +502,7 @@ public class AxReferenceKey extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
*/
@Override
public int hashCode() {
@@ -495,7 +518,7 @@ public class AxReferenceKey extends AxKey {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang. Object)
*/
@Override
public boolean equals(final Object obj) {
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxValidationMessage.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxValidationMessage.java
index ef8eb317c..7ca0b2f3c 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxValidationMessage.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxValidationMessage.java
@@ -1,31 +1,32 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * A validation message is created for each validation observation observed during validation of a concept. The message holds the key and
- * the class of the concept on which the observation was made as well as the type of observation and a message describing the observation.
+ * A validation message is created for each validation observation observed during validation of a concept. The message
+ * holds the key and the class of the concept on which the observation was made as well as the type of observation and a
+ * message describing the observation.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -43,7 +44,8 @@ public class AxValidationMessage {
* @param validationResult the type of observation made
* @param message a message describing the observation
*/
- public AxValidationMessage(final AxKey observedKey, final Class<?> observedClass, final ValidationResult validationResult, final String message) {
+ public AxValidationMessage(final AxKey observedKey, final Class<?> observedClass,
+ final ValidationResult validationResult, final String message) {
Assertions.argumentNotNull(observedKey, "observedKey may not be null");
Assertions.argumentNotNull(observedClass, "observedClass may not be null");
Assertions.argumentNotNull(validationResult, "validationResult may not be null");
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxValidationResult.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxValidationResult.java
index 363fd1596..664cf9500 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/AxValidationResult.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxValidationResult.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.LinkedList;
import java.util.List;
@@ -35,12 +35,19 @@ public class AxValidationResult {
public enum ValidationResult {
/** No problems or observations were detected during validation. */
VALID,
- /** Observations were made on a concept (such as blank descriptions) of a nature that will not affect the use of the concept. */
+ /**
+ * Observations were made on a concept (such as blank descriptions) of a nature that will not affect the use of
+ * the concept.
+ */
OBSERVATION,
- /** Warnings were made on a concept (such as defined but unused concepts) of a nature that may affect the use of the concept. */
+ /**
+ * Warnings were made on a concept (such as defined but unused concepts) of a nature that may affect the use of
+ * the concept.
+ */
WARNING,
/**
- * Errors were detected on a concept (such as referenced but undefined concepts) of a nature that will affect the use of the concept.
+ * Errors were detected on a concept (such as referenced but undefined concepts) of a nature that will affect
+ * the use of the concept.
*/
INVALID
}
@@ -52,8 +59,8 @@ public class AxValidationResult {
private final List<AxValidationMessage> messageList = new LinkedList<>();
/**
- * Check if a validation reported a valid concept, returns true if the model is usable (that is, even if the model has warnings or
- * observations).
+ * Check if a validation reported a valid concept, returns true if the model is usable (that is, even if the model
+ * has warnings or observations).
*
* @return true, if the concept is reported as valid and can be used
*/
@@ -89,8 +96,8 @@ public class AxValidationResult {
}
/**
- * Adds a validation message to the validation result, used by validate() implementations on {@link AxConcept} subclasses to report
- * validaiton observations.
+ * Adds a validation message to the validation result, used by validate() implementations on {@link AxConcept}
+ * subclasses to report validaiton observations.
*
* @param validationMessage the validation message
*/
@@ -115,23 +122,23 @@ public class AxValidationResult {
final StringBuilder builder = new StringBuilder();
switch (validationResult) {
- case VALID:
-
- builder.append("***validation of model successful***");
- return builder.toString();
- case OBSERVATION:
-
- builder.append("\n***observations noted during validation of model***\n");
- break;
- case WARNING:
-
- builder.append("\n***warnings issued during validation of model***\n");
- break;
- case INVALID:
- builder.append("\n***validation of model failed***\n");
- break;
- default:
- break;
+ case VALID:
+
+ builder.append("***validation of model successful***");
+ return builder.toString();
+ case OBSERVATION:
+
+ builder.append("\n***observations noted during validation of model***\n");
+ break;
+ case WARNING:
+
+ builder.append("\n***warnings issued during validation of model***\n");
+ break;
+ case INVALID:
+ builder.append("\n***validation of model failed***\n");
+ break;
+ default:
+ break;
}
for (final AxValidationMessage message : messageList) {
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/package-info.java
index 4d5c91c66..294a66496 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/concepts/package-info.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/package-info.java
@@ -1,33 +1,33 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
/**
* This package contains the fundamental concepts for all APEX models.
- *
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-@XmlSchema(namespace = "http://www.ericsson.com/apex", elementFormDefault = XmlNsForm.QUALIFIED, xmlns = {
- @XmlNs(namespaceURI = "http://www.ericsson.com/apex", prefix = "") })
+@XmlSchema(namespace = "http://www.onap.org/policy/apex-pdp", elementFormDefault = XmlNsForm.QUALIFIED,
+ xmlns = { @XmlNs(namespaceURI = "http://www.onap.org/policy/apex-pdp", prefix = "") })
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlNsForm;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/ApexDao.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java
index 5aab39c1b..461f3f113 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/ApexDao.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java
@@ -1,36 +1,36 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.dao;
+package org.onap.policy.apex.model.basicmodel.dao;
import java.util.Collection;
import java.util.List;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
/**
- * The Interface ApexDao describes the DAO interface for reading and writing Apex {@link AxConcept} concepts to and from databases using
- * JDBC.
+ * The Interface ApexDao describes the DAO interface for reading and writing Apex {@link AxConcept} concepts to and from
+ * databases using JDBC.
*
* @author Sergey Sachkov
* @author liam.fallon@ericsson.com
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/ApexDaoFactory.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java
index ecb8a4658..50724d2d7 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/ApexDaoFactory.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java
@@ -1,33 +1,33 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.dao;
+package org.onap.policy.apex.model.basicmodel.dao;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.utilities.Assertions;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * This factory class returns an Apex DAO for the configured persistence mechanism. The factory uses the plugin class specified in {@link DAOParameters} to
- * instantiate a DAO instance.
+ * This factory class returns an Apex DAO for the configured persistence mechanism. The factory uses the plugin class
+ * specified in {@link DAOParameters} to instantiate a DAO instance.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -49,16 +49,18 @@ public class ApexDaoFactory {
Object apexDaoObject = null;
try {
apexDaoObject = Class.forName(daoParameters.getPluginClass()).newInstance();
- }
- catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+ } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
LOGGER.error("Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e);
- throw new ApexException("Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e);
+ throw new ApexException(
+ "Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e);
}
// Check the class is an Apex DAO
if (!(apexDaoObject instanceof ApexDao)) {
- LOGGER.error("Specified Apex DAO plugin class \"" + daoParameters.getPluginClass() + "\" does not implement the ApexDao interface");
- throw new ApexException("Specified Apex DAO plugin class \"" + daoParameters.getPluginClass() + "\" does not implement the ApexDao interface");
+ LOGGER.error("Specified Apex DAO plugin class \"" + daoParameters.getPluginClass()
+ + "\" does not implement the ApexDao interface");
+ throw new ApexException("Specified Apex DAO plugin class \"" + daoParameters.getPluginClass()
+ + "\" does not implement the ApexDao interface");
}
return (ApexDao) apexDaoObject;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/DAOParameters.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DAOParameters.java
index ccf15fea7..5a44d18a8 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/DAOParameters.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DAOParameters.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.dao;
+package org.onap.policy.apex.model.basicmodel.dao;
import java.util.Properties;
@@ -29,7 +29,7 @@ import java.util.Properties;
*/
public class DAOParameters {
/** The default Apex DAO plugin class. */
- public static final String DEFAULT_PLUGIN_CLASS = "org.onap.apex.model.basicmodel.dao.impl.DefaultApexDao";
+ public static final String DEFAULT_PLUGIN_CLASS = "org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao";
private String pluginClass = DEFAULT_PLUGIN_CLASS;
private String persistenceUnit;
@@ -55,8 +55,8 @@ public class DAOParameters {
}
/**
- * Gets the persistence unit for the DAO. The persistence unit defines the JDBC properties the DAO will use. The persistence unit must defined in the
- * {@code META-INF/persistence.xml} resource file
+ * Gets the persistence unit for the DAO. The persistence unit defines the JDBC properties the DAO will use. The
+ * persistence unit must defined in the {@code META-INF/persistence.xml} resource file
*
* @return the persistence unit to use for JDBC access
*/
@@ -65,8 +65,8 @@ public class DAOParameters {
}
/**
- * Sets the persistence unit for the DAO. The persistence unit defines the JDBC properties the DAO will use. The persistence unit must defined in the
- * {@code META-INF/persistence.xml} resource file
+ * Sets the persistence unit for the DAO. The persistence unit defines the JDBC properties the DAO will use. The
+ * persistence unit must defined in the {@code META-INF/persistence.xml} resource file
*
* @param daoPersistenceUnit the persistence unit to use for JDBC access
*/
@@ -119,6 +119,7 @@ public class DAOParameters {
*/
@Override
public String toString() {
- return "DAOParameters [pluginClass=" + pluginClass + ", persistenceUnit=" + persistenceUnit + ", jdbcProperties=" + jdbcProperties + "]";
+ return "DAOParameters [pluginClass=" + pluginClass + ", persistenceUnit=" + persistenceUnit
+ + ", jdbcProperties=" + jdbcProperties + "]";
}
}
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/converters/CDATAConditioner.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDATAConditioner.java
index d949ab28a..9e840da2c 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/converters/CDATAConditioner.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDATAConditioner.java
@@ -1,32 +1,32 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.dao.converters;
+package org.onap.policy.apex.model.basicmodel.dao.converters;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import javax.xml.bind.annotation.adapters.XmlAdapter;
/**
- * The Class CDATAConditioner converts a CDATA String to and from database format by removing spaces at the ends of lines and
- * platform-specific new line endings.
+ * The Class CDATAConditioner converts a CDATA String to and from database format by removing spaces at the ends of
+ * lines and platform-specific new line endings.
*
* @author John Keeney (John.Keeney@ericsson.com)
*/
@@ -84,8 +84,7 @@ public class CDATAConditioner extends XmlAdapter<String, String> implements Attr
public static final String clean(final String in) {
if (in == null) {
return null;
- }
- else {
+ } else {
return in.replaceAll("\\s+$", "").replaceAll("\\r?\\n", NL);
}
}
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/converters/UUID2String.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/UUID2String.java
index 4e6b66025..f26dfc2de 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/converters/UUID2String.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/UUID2String.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.dao.converters;
+package org.onap.policy.apex.model.basicmodel.dao.converters;
import java.util.UUID;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/converters/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/package-info.java
index c7bad6777..f1e9a3ba7 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/converters/package-info.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/package-info.java
@@ -1,27 +1,28 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
/**
- * Contains converters used by APEX EclipseLink marshaling and unmarshaling of {@link org.onap.apex.model.basicmodel.concepts.AxConcept}
- * instances to and from files and databases.
- *
+ * Contains converters used by APEX EclipseLink marshaling and unmarshaling of
+ * {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} instances to and from files and databases.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.apex.model.basicmodel.dao.converters;
+
+package org.onap.policy.apex.model.basicmodel.dao.converters;
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java
new file mode 100644
index 000000000..228362bce
--- /dev/null
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java
@@ -0,0 +1,520 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.basicmodel.dao.impl;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.dao.ApexDao;
+import org.onap.policy.apex.model.basicmodel.dao.DAOParameters;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * The Class DefaultApexDao is an JPA implementation of the {@link ApexDao} class for Apex concepts ({@link AxConcept}).
+ * It uses the default JPA implementation in the javax {@link Persistence} class.
+ *
+ *
+ * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
+ */
+public class DefaultApexDao implements ApexDao {
+ private static final XLogger LOGGER = XLoggerFactory.getXLogger(DefaultApexDao.class);
+
+ private static final String SELECT_C_FROM = "SELECT c FROM ";
+ private static final String AND_C_KEY_LOCAL_NAME = "' AND c.key.localName='";
+ private static final String AND_C_KEY_PARENT_KEY_VERSION = "' AND c.key.parentKeyVersion='";
+ private static final String C_WHERE_C_KEY_PARENT_KEY_NAME = " c WHERE c.key.parentKeyName='";
+ private static final String AND_C_KEY_VERSION = "' AND c.key.version='";
+ private static final String C_WHERE_C_KEY_NAME = " c WHERE c.key.name='";
+ private static final String DELETE_FROM = "DELETE FROM ";
+
+ // Entity manager for JPA
+ private EntityManagerFactory emf = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.dao.ApexDao#init(org.onap.policy.apex.model.basicmodel.dao.DAOParameters)
+ */
+ @Override
+ public void init(final DAOParameters daoParameters) throws ApexException {
+ if (daoParameters == null || daoParameters.getPersistenceUnit() == null) {
+ LOGGER.error("Apex persistence unit parameter not set");
+ throw new ApexException("Apex persistence unit parameter not set");
+ }
+
+ LOGGER.debug("Creating Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" . . .");
+ try {
+ emf = Persistence.createEntityManagerFactory(daoParameters.getPersistenceUnit(),
+ daoParameters.getJdbcProperties());
+ } catch (final Exception e) {
+ LOGGER.warn("Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", e);
+ throw new ApexException(
+ "Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", e);
+ }
+ LOGGER.debug("Created Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\"");
+ }
+
+ /**
+ * Gets the entity manager for this DAO.
+ *
+ * @return the entity manager
+ */
+ protected final synchronized EntityManager getEntityManager() {
+ if (emf == null) {
+ LOGGER.warn("Apex DAO has not been initialized");
+ throw new ApexRuntimeException("Apex DAO has not been initialized");
+ }
+
+ return emf.createEntityManager();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#close()
+ */
+ @Override
+ public final void close() {
+ if (emf != null) {
+ emf.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#create(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public <T extends AxConcept> void create(final T obj) {
+ if (obj == null) {
+ return;
+ }
+ final EntityManager mg = getEntityManager();
+ try {
+ mg.getTransaction().begin();
+ mg.merge(obj);
+ mg.getTransaction().commit();
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#delete(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public <T extends AxConcept> void delete(final T obj) {
+ if (obj == null) {
+ return;
+ }
+ final EntityManager mg = getEntityManager();
+ try {
+ mg.getTransaction().begin();
+ mg.remove(mg.contains(obj) ? obj : mg.merge(obj));
+ mg.getTransaction().commit();
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#delete(java.lang.Class,
+ * org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey)
+ */
+ @Override
+ public <T extends AxConcept> void delete(final Class<T> aClass, final AxArtifactKey key) {
+ if (key == null) {
+ return;
+ }
+ final EntityManager mg = getEntityManager();
+ try {
+ mg.getTransaction().begin();
+ mg.createQuery(DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName() + AND_C_KEY_VERSION
+ + key.getVersion() + "'", aClass).executeUpdate();
+ mg.getTransaction().commit();
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#delete(java.lang.Class,
+ * org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey)
+ */
+ @Override
+ public <T extends AxConcept> void delete(final Class<T> aClass, final AxReferenceKey key) {
+ if (key == null) {
+ return;
+ }
+ final EntityManager mg = getEntityManager();
+ try {
+ mg.getTransaction().begin();
+ mg.createQuery(DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME + key.getParentKeyName()
+ + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + AND_C_KEY_LOCAL_NAME
+ + key.getLocalName() + "'", aClass).executeUpdate();
+ mg.getTransaction().commit();
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#create(java.util.Collection)
+ */
+ @Override
+ public <T extends AxConcept> void create(final Collection<T> objs) {
+ if (objs == null || objs.isEmpty()) {
+ return;
+ }
+ final EntityManager mg = getEntityManager();
+ try {
+ mg.getTransaction().begin();
+ for (final T t : objs) {
+ mg.merge(t);
+ }
+ mg.getTransaction().commit();
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#delete(java.util.Collection)
+ */
+ @Override
+ public <T extends AxConcept> void delete(final Collection<T> objs) {
+ if (objs == null || objs.isEmpty()) {
+ return;
+ }
+ final EntityManager mg = getEntityManager();
+ try {
+ mg.getTransaction().begin();
+ for (final T t : objs) {
+ mg.remove(mg.contains(t) ? t : mg.merge(t));
+ }
+ mg.getTransaction().commit();
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#deleteByArtifactKey(java.lang.Class, java.util.Collection)
+ */
+ @Override
+ public <T extends AxConcept> int deleteByArtifactKey(final Class<T> aClass, final Collection<AxArtifactKey> keys) {
+ if (keys == null || keys.isEmpty()) {
+ return 0;
+ }
+ int deletedCount = 0;
+ final EntityManager mg = getEntityManager();
+ try {
+ mg.getTransaction().begin();
+ for (final AxArtifactKey key : keys) {
+ deletedCount += mg.createQuery(DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName()
+ + AND_C_KEY_VERSION + key.getVersion() + "'", aClass).executeUpdate();
+ }
+ mg.getTransaction().commit();
+ } finally {
+ mg.close();
+ }
+ return deletedCount;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#deleteByReferenceKey(java.lang.Class,
+ * java.util.Collection)
+ */
+ @Override
+ public <T extends AxConcept> int deleteByReferenceKey(final Class<T> aClass,
+ final Collection<AxReferenceKey> keys) {
+ if (keys == null || keys.isEmpty()) {
+ return 0;
+ }
+ int deletedCount = 0;
+ final EntityManager mg = getEntityManager();
+ try {
+ mg.getTransaction().begin();
+ for (final AxReferenceKey key : keys) {
+ deletedCount +=
+ mg.createQuery(
+ DELETE_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME
+ + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION
+ + key.getParentKeyVersion() + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'",
+ aClass).executeUpdate();
+ }
+ mg.getTransaction().commit();
+ } finally {
+ mg.close();
+ }
+ return deletedCount;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#deleteAll(java.lang.Class)
+ */
+ @Override
+ public <T extends AxConcept> void deleteAll(final Class<T> aClass) {
+ final EntityManager mg = getEntityManager();
+ try {
+ mg.getTransaction().begin();
+ mg.createQuery(DELETE_FROM + aClass.getSimpleName() + " c ", aClass).executeUpdate();
+ mg.getTransaction().commit();
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#get(java.lang.Class,
+ * org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey)
+ */
+ @Override
+ public <T extends AxConcept> T get(final Class<T> aClass, final AxArtifactKey key) {
+ if (aClass == null) {
+ return null;
+ }
+ final EntityManager mg = getEntityManager();
+ try {
+ final T t = mg.find(aClass, key);
+ if (t != null) {
+ // This clone is created to force the JPA DAO to recurse down through the object
+ try {
+ final T clonedT = aClass.newInstance();
+ t.copyTo(clonedT);
+ return clonedT;
+ } catch (final Exception e) {
+ LOGGER.warn("Could not clone object of class \"" + aClass.getCanonicalName() + "\"", e);
+ return null;
+ }
+ } else {
+ return null;
+ }
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#get(java.lang.Class,
+ * org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey)
+ */
+ @Override
+ public <T extends AxConcept> T get(final Class<T> aClass, final AxReferenceKey key) {
+ if (aClass == null) {
+ return null;
+ }
+ final EntityManager mg = getEntityManager();
+ try {
+ final T t = mg.find(aClass, key);
+ if (t != null) {
+ try {
+ final T clonedT = aClass.newInstance();
+ t.copyTo(clonedT);
+ return clonedT;
+ } catch (final Exception e) {
+ LOGGER.warn("Could not clone object of class \"" + aClass.getCanonicalName() + "\"", e);
+ return null;
+ }
+ } else {
+ return null;
+ }
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#getAll(java.lang.Class)
+ */
+ @Override
+ public <T extends AxConcept> List<T> getAll(final Class<T> aClass) {
+ if (aClass == null) {
+ return Collections.emptyList();
+ }
+ final EntityManager mg = getEntityManager();
+ try {
+ return mg.createQuery(SELECT_C_FROM + aClass.getSimpleName() + " c", aClass).getResultList();
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#getAll(java.lang.Class,
+ * org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey)
+ */
+ @Override
+ public <T extends AxConcept> List<T> getAll(final Class<T> aClass, final AxArtifactKey parentKey) {
+ if (aClass == null) {
+ return Collections.emptyList();
+ }
+ final EntityManager mg = getEntityManager();
+ try {
+ return mg
+ .createQuery(SELECT_C_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME
+ + parentKey.getName() + AND_C_KEY_PARENT_KEY_VERSION + parentKey.getVersion() + "'", aClass)
+ .getResultList();
+ } finally {
+ mg.close();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#getArtifact(java.lang.Class,
+ * org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey)
+ */
+ @Override
+ public <T extends AxConcept> T getArtifact(final Class<T> aClass, final AxArtifactKey key) {
+ if (aClass == null || key == null) {
+ return null;
+ }
+ final EntityManager mg = getEntityManager();
+ List<T> ret;
+ try {
+ ret = mg.createQuery(SELECT_C_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName()
+ + AND_C_KEY_VERSION + key.getVersion() + "'", aClass).getResultList();
+ } finally {
+ mg.close();
+ }
+ if (ret == null || ret.isEmpty()) {
+ return null;
+ }
+ if (ret.size() > 1) {
+ throw new IllegalArgumentException("More than one result was returned for search for " + aClass
+ + " with key " + key.getID() + ": " + ret);
+ }
+ return ret.get(0);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#getArtifact(java.lang.Class,
+ * org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey)
+ */
+ @Override
+ public <T extends AxConcept> T getArtifact(final Class<T> aClass, final AxReferenceKey key) {
+ if (aClass == null || key == null) {
+ return null;
+ }
+ final EntityManager mg = getEntityManager();
+ List<T> ret;
+ try {
+ ret = mg.createQuery(SELECT_C_FROM + aClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME
+ + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion()
+ + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", aClass).getResultList();
+ } finally {
+ mg.close();
+ }
+ if (ret == null || ret.isEmpty()) {
+ return null;
+ }
+ if (ret.size() > 1) {
+ throw new IllegalArgumentException("More than one result was returned for search for " + aClass
+ + " with key " + key.getID() + ": " + ret);
+ }
+ return ret.get(0);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#update(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public <T extends AxConcept> T update(final T obj) {
+ final EntityManager mg = getEntityManager();
+ T ret;
+ try {
+ mg.getTransaction().begin();
+ ret = mg.merge(obj);
+ mg.flush();
+ mg.getTransaction().commit();
+ } finally {
+ mg.close();
+ }
+ return ret;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.dao.ApexDao#size(java.lang.Class)
+ */
+ @Override
+ public <T extends AxConcept> long size(final Class<T> aClass) {
+ if (aClass == null) {
+ return 0;
+ }
+ final EntityManager mg = getEntityManager();
+ long size = 0;
+ try {
+ size = mg.createQuery("SELECT COUNT(c) FROM " + aClass.getSimpleName() + " c", Long.class)
+ .getSingleResult();
+ } finally {
+ mg.close();
+ }
+ return size;
+ }
+}
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/impl/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java
index 16da22646..12e854f26 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/impl/package-info.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java
@@ -19,8 +19,8 @@
*/
/**
- * Contains a default DAO implementation for APEX {@link org.onap.apex.model.basicmodel.concepts.AxConcept} classes that uses javax persistence.
+ * Contains a default DAO implementation for APEX {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} classes that uses javax persistence.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.apex.model.basicmodel.dao.impl;
+package org.onap.policy.apex.model.basicmodel.dao.impl;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java
index 0ad255a9a..fe551b87a 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/dao/package-info.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java
@@ -1,27 +1,29 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
/**
- * Defines and implements the Data Access Object (DAO) that allows Apex {@link org.onap.apex.model.basicmodel.concepts.AxConcept} concepts to
- * be read from and written to databases over JDBC.
- *
+ * Defines and implements the Data Access Object (DAO) that allows Apex
+ * {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} concepts to be read from and written to databases over
+ * JDBC.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.apex.model.basicmodel.dao;
+
+package org.onap.policy.apex.model.basicmodel.dao;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelCreator.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelCreator.java
index 5a9de967f..7b6d830e9 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelCreator.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelCreator.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
/**
* This interface is implemented by factories that create Apex models. It is mainly used by unit test classes that generate Apex models for test purposes.
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelException.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelException.java
index 252bee4ed..8964a5bc2 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelException.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelException.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
/**
* This exception is invoked if an exception occurs in model handling.
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelFileWriter.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelFileWriter.java
index 8d9cf2ae0..2312b88db 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelFileWriter.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelFileWriter.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import java.io.File;
import java.io.FileOutputStream;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelReader.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java
index 84760f5db..b19255a5b 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelReader.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelReader.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import java.io.BufferedReader;
import java.io.IOException;
@@ -40,8 +40,8 @@ import javax.xml.validation.SchemaFactory;
import org.eclipse.persistence.jaxb.JAXBContextFactory;
import org.eclipse.persistence.jaxb.MarshallerProperties;
import org.eclipse.persistence.oxm.MediaType;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
import org.onap.policy.apex.model.utilities.Assertions;
import org.onap.policy.apex.model.utilities.ResourceUtils;
import org.onap.policy.apex.model.utilities.TextFileUtils;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelSaver.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaver.java
index 7f4efee99..16ea1f3fa 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelSaver.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelSaver.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import java.io.File;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
import org.onap.policy.apex.model.utilities.Assertions;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelStringWriter.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelStringWriter.java
index 882092c05..3d2e50b38 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelStringWriter.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelStringWriter.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import java.io.ByteArrayOutputStream;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
import org.onap.policy.apex.model.utilities.Assertions;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelWriter.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java
index 5b7a9568b..180c2447a 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexModelWriter.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexModelWriter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@@ -41,8 +41,8 @@ import javax.xml.transform.stream.StreamResult;
import org.eclipse.persistence.jaxb.JAXBContextFactory;
import org.eclipse.persistence.jaxb.MarshallerProperties;
import org.eclipse.persistence.oxm.MediaType;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
import org.onap.policy.apex.model.utilities.Assertions;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexSchemaGenerator.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexSchemaGenerator.java
index 5055df630..6e17ab94d 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/ApexSchemaGenerator.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/ApexSchemaGenerator.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import java.io.File;
import java.io.IOException;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/package-info.java
index 871a0ea49..081cff540 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/handling/package-info.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/handling/package-info.java
@@ -1,36 +1,35 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
/**
- * Contains a number of utility classes for handling APEX {@link org.onap.apex.model.basicmodel.concepts.AxModel} models and
- * {@link org.onap.apex.model.basicmodel.concepts.AxConcept} concepts.
- * Classes to read and write models to files, strings, and databases are included, as
- * well as classes to generate XML schemas for models.
- *
+ * Contains a number of utility classes for handling APEX {@link org.onap.policy.apex.model.basicmodel.concepts.AxModel}
+ * models and {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} concepts. Classes to read and write
+ * models to files, strings, and databases are included, as well as classes to generate XML schemas for models.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-@XmlSchema(namespace = "http://www.ericsson.com/apex", elementFormDefault = XmlNsForm.QUALIFIED, xmlns = {
- @XmlNs(namespaceURI = "http://www.ericsson.com/apex", prefix = "") })
+@XmlSchema(namespace = "http://www.onap.org/policy/apex-pdp", elementFormDefault = XmlNsForm.QUALIFIED,
+ xmlns = { @XmlNs(namespaceURI = "http://www.onap.org/policy/apex-pdp", prefix = "") })
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlNsForm;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java
index dbee9cc9d..8c76c5fc8 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/package-info.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java
@@ -26,4 +26,4 @@
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.apex.model.basicmodel;
+package org.onap.policy.apex.model.basicmodel;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/AbstractParameters.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/AbstractParameters.java
index 2cde32518..95bc853b8 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/AbstractParameters.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/AbstractParameters.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.service;
+package org.onap.policy.apex.model.basicmodel.service;
-import org.onap.apex.model.basicmodel.concepts.ApexRuntimeException;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
import org.onap.policy.apex.model.utilities.Assertions;
/**
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/ModelService.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java
index 688beaa4f..d1ecc6031 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/ModelService.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ModelService.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.service;
+package org.onap.policy.apex.model.basicmodel.service;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.onap.apex.model.basicmodel.concepts.ApexRuntimeException;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
/**
* The model service makes Apex models available to all classes in a JVM.
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/ParameterService.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ParameterService.java
index 9a254b0d6..062213093 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/ParameterService.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/ParameterService.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.service;
+package org.onap.policy.apex.model.basicmodel.service;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import org.onap.apex.model.basicmodel.concepts.ApexRuntimeException;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
/**
* The parameter service makes Apex parameters available to all classes in a JVM.
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/package-info.java
index da6c69898..a27e45d1a 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/service/package-info.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/service/package-info.java
@@ -23,4 +23,4 @@
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.apex.model.basicmodel.service;
+package org.onap.policy.apex.model.basicmodel.service;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/test/TestApexModel.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java
index e7e50677e..04b64207d 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/test/TestApexModel.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.test;
+package org.onap.policy.apex.model.basicmodel.test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.net.URL;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.dao.ApexDao;
-import org.onap.apex.model.basicmodel.dao.ApexDaoFactory;
-import org.onap.apex.model.basicmodel.dao.DAOParameters;
-import org.onap.apex.model.basicmodel.handling.ApexModelFileWriter;
-import org.onap.apex.model.basicmodel.handling.ApexModelReader;
-import org.onap.apex.model.basicmodel.handling.ApexModelWriter;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.dao.ApexDao;
+import org.onap.policy.apex.model.basicmodel.dao.ApexDaoFactory;
+import org.onap.policy.apex.model.basicmodel.dao.DAOParameters;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter;
import org.onap.policy.apex.model.utilities.ResourceUtils;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/test/TestApexModelCreator.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModelCreator.java
index 7213c6694..980748926 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/test/TestApexModelCreator.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModelCreator.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.test;
+package org.onap.policy.apex.model.basicmodel.test;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.handling.ApexModelCreator;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelCreator;
/**
* The Interface TestApexModelCreator is used to create models for Apex model tests. It is mainly used by unit tests for Apex domain models so that
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/test/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/package-info.java
index 6bd6b73fb..9bbdd1cce 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/test/package-info.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/package-info.java
@@ -23,4 +23,4 @@
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.apex.model.basicmodel.test;
+package org.onap.policy.apex.model.basicmodel.test;
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/xml/AxReferenceKeyAdapter.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/xml/AxReferenceKeyAdapter.java
index a2bfbb80a..28f0cf7af 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/xml/AxReferenceKeyAdapter.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/xml/AxReferenceKeyAdapter.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.xml;
+package org.onap.policy.apex.model.basicmodel.xml;
import java.io.Serializable;
@@ -27,20 +27,21 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlAdapter;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
/**
- * This class manages marshaling and unmarshaling of Apex {@link AxReferenceKey} concepts using JAXB. The local name in reference keys must have specific
- * handling.
+ * This class manages marshaling and unmarshaling of Apex {@link AxReferenceKey} concepts using JAXB. The local name in
+ * reference keys must have specific handling.
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
-@XmlType(namespace = "http://www.ericsson.com/apex")
+@XmlType(namespace = "http://www.onap.org/policy/apex-pdp")
public class AxReferenceKeyAdapter extends XmlAdapter<String, AxReferenceKey> implements Serializable {
private static final long serialVersionUID = -3480405083900107029L;
/*
* (non-Javadoc)
+ *
* @see javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object)
*/
@Override
@@ -50,6 +51,7 @@ public class AxReferenceKeyAdapter extends XmlAdapter<String, AxReferenceKey> im
/*
* (non-Javadoc)
+ *
* @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object)
*/
@Override
diff --git a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/xml/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/xml/package-info.java
index 77bc0c13b..290209d89 100644
--- a/model/basic-model/src/main/java/org/onap/apex/model/basicmodel/xml/package-info.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/xml/package-info.java
@@ -1,33 +1,33 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
/**
* Contains utility classes for managing marshaling and unmarshaling of APEX models using JAXB.
- *
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-@XmlSchema(namespace = "http://www.ericsson.com/apex", elementFormDefault = XmlNsForm.QUALIFIED, xmlns = {
- @XmlNs(namespaceURI = "http://www.ericsson.com/apex", prefix = "") })
+@XmlSchema(namespace = "http://www.onap.org/policy/apex-pdp", elementFormDefault = XmlNsForm.QUALIFIED,
+ xmlns = { @XmlNs(namespaceURI = "http://www.onap.org/policy/apex-pdp", prefix = "") })
-package org.onap.apex.model.basicmodel.xml;
+package org.onap.policy.apex.model.basicmodel.xml;
import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlNsForm;
diff --git a/model/basic-model/src/main/resources/xml/example.xsd b/model/basic-model/src/main/resources/xml/example.xsd
index 9f253f29c..75ecdc323 100644
--- a/model/basic-model/src/main/resources/xml/example.xsd
+++ b/model/basic-model/src/main/resources/xml/example.xsd
@@ -18,7 +18,7 @@
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-->
-<xs:schema elementFormDefault="qualified" version="1.0" targetNamespace="http://www.ericsson.com/apex" xmlns="http://www.ericsson.com/apex" xmlns:tns="http://www.ericsson.com/apex" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+<xs:schema elementFormDefault="qualified" version="1.0" targetNamespace="http://www.onap.org/policy/apex-pdp" xmlns="http://www.onap.org/policy/apex-pdp" xmlns:tns="http://www.onap.org/policy/apex-pdp" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="apexArtifactKey" type="AxArtifactKey"/>
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexBasicModel.java b/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexBasicModel.java
deleted file mode 100644
index e4d91b7a2..000000000
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexBasicModel.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.apex.model.basicmodel.handling;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.sql.Connection;
-import java.sql.DriverManager;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.dao.DAOParameters;
-import org.onap.apex.model.basicmodel.test.TestApexModel;
-
-public class TestApexBasicModel {
- private Connection connection;
- TestApexModel<AxModel> testApexModel;
-
- @Before
- public void setup() throws Exception {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
- connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
-
- testApexModel = new TestApexModel<AxModel>(AxModel.class, new TestApexBasicModelCreator());
- }
-
- @After
- public void teardown() throws Exception {
- connection.close();
- new File("derby.log").delete();
- }
-
- @Test
- public void testModelValid() throws Exception {
- AxValidationResult result = testApexModel.testApexModelValid();
- assertTrue(result.toString().equals(VALID_MODEL_STRING));
- }
-
- @Test
- public void testApexModelVaidateObservation() throws Exception {
- try {
- testApexModel.testApexModelVaidateObservation();
- }
- catch (ApexException e) {
- assertEquals("model should have observations", e.getMessage());
- }
- }
-
- @Test
- public void testApexModelVaidateWarning() throws Exception {
- AxValidationResult result = testApexModel.testApexModelVaidateWarning();
- assertTrue(result.toString().equals(WARNING_MODEL_STRING));
- }
-
- @Test
- public void testModelVaidateInvalidModel() throws Exception {
- AxValidationResult result = testApexModel.testApexModelVaidateInvalidModel();
- assertTrue(result.toString().equals(INVALID_MODEL_STRING));
- }
-
- @Test
- public void testModelVaidateMalstructured() throws Exception {
- AxValidationResult result = testApexModel.testApexModelVaidateMalstructured();
- assertTrue(result.toString().equals(INVALID_MODEL_MALSTRUCTURED_STRING));
- }
-
- @Test
- public void testModelWriteReadXML() throws Exception {
- testApexModel.testApexModelWriteReadXML();
- }
-
- @Test
- public void testModelWriteReadJSON() throws Exception {
- testApexModel.testApexModelWriteReadJSON();
- }
-
- @Test
- public void testModelWriteReadJPA() throws Exception {
- DAOParameters daoParameters = new DAOParameters();
- daoParameters.setPluginClass("org.onap.apex.model.basicmodel.dao.impl.DefaultApexDao");
- daoParameters.setPersistenceUnit("DAOTest");
-
- testApexModel.testApexModelWriteReadJPA(daoParameters);
- }
-
- // As there are no real concepts in a basic model, this is as near to a valid model as we can get
- private static final String VALID_MODEL_STRING = "\n" +
- "***warnings issued during validation of model***\n" +
- "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" +
- "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" +
- "********************************";
-
- private static final String WARNING_MODEL_STRING = "\n" +
- "***warnings issued during validation of model***\n" +
- "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" +
- "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" +
- "AxArtifactKey:(name=Unref0,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" +
- "AxArtifactKey:(name=Unref1,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n" +
- "********************************";
-
- private static final String INVALID_MODEL_STRING = "\n" +
- "***validation of model failed***\n" +
- "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" +
- "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n" +
- "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" +
- "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:duplicate UUID found on keyInfoMap entry AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):00000000-0000-0000-0000-000000000000\n" +
- "********************************";
-
- private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" +
- "***validation of model failed***\n" +
- "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" +
- "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxModel:INVALID:key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" +
- "********************************";
-}
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/AxKeyTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java
index a454aaf92..6ac46b14e 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/AxKeyTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -27,11 +27,11 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKey;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxKey.Compatibility;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey.Compatibility;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestAxKeyInfo.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java
index 6af662bdf..8368634bf 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestAxKeyInfo.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -29,9 +29,9 @@ import static org.junit.Assert.assertTrue;
import java.util.UUID;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestAxReferenceKey.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java
index 7ec3cbbbf..dbc925d66 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestAxReferenceKey.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -27,10 +27,10 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKey;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestEntity.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java
index 3e821f7c5..6ba380bb8 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestEntity.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.Arrays;
import java.util.List;
@@ -29,11 +29,11 @@ import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.apex.model.basicmodel.concepts.AxKey;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
@Entity
@Table(name = "TestEntity")
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestExceptions.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java
index 1d37cd8ed..1fc5209b0 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestExceptions.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -26,10 +26,10 @@ import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.ApexConceptException;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.ApexRuntimeException;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexConceptException;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestValidation.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java
index e8eff5230..93eb78b7c 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/TestValidation.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -26,11 +26,11 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationMessage;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/testKeyUse.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/testKeyUse.java
index ca1e5c191..10706f36a 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/concepts/testKeyUse.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/testKeyUse.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.concepts;
+package org.onap.policy.apex.model.basicmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -27,11 +27,11 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyUse;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxKey.Compatibility;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyUse;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey.Compatibility;
public class testKeyUse {
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/dao/EntityTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java
index 87779848e..e5d597375 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/dao/EntityTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.dao;
+package org.onap.policy.apex.model.basicmodel.dao;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -38,14 +38,11 @@ import java.util.UUID;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.apex.model.basicmodel.concepts.TestEntity;
-import org.onap.apex.model.basicmodel.dao.ApexDao;
-import org.onap.apex.model.basicmodel.dao.ApexDaoFactory;
-import org.onap.apex.model.basicmodel.dao.DAOParameters;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.TestEntity;
/**
* JUnit test class
@@ -75,16 +72,14 @@ public class EntityTest {
try {
apexDao.init(null);
fail("Test should throw an exception here");
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
assertEquals("Apex persistence unit parameter not set", e.getMessage());
}
try {
apexDao.init(daoParameters);
fail("Test should throw an exception here");
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
assertEquals("Apex persistence unit parameter not set", e.getMessage());
}
@@ -93,15 +88,13 @@ public class EntityTest {
try {
apexDao.init(daoParameters);
fail("Test should throw an exception here");
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
assertEquals("Creation of Apex persistence unit \"Dorothy\" failed", e.getMessage());
}
try {
apexDao.create(new AxArtifactKey());
fail("Test should throw an exception here");
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
assertEquals("Apex DAO has not been initialized", e.getMessage());
}
apexDao.close();
@@ -110,7 +103,7 @@ public class EntityTest {
@Test
public void testEntityTestAllOpsJPA() throws ApexException {
final DAOParameters daoParameters = new DAOParameters();
- daoParameters.setPluginClass("org.onap.apex.model.basicmodel.dao.impl.DefaultApexDao");
+ daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
daoParameters.setPersistenceUnit("DAOTest");
apexDao = new ApexDaoFactory().createApexDao(daoParameters);
@@ -123,7 +116,7 @@ public class EntityTest {
@Test
public void testEntityTestBadVals() throws ApexException {
final DAOParameters daoParameters = new DAOParameters();
- daoParameters.setPluginClass("org.onap.apex.model.basicmodel.dao.impl.DefaultApexDao");
+ daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
daoParameters.setPersistenceUnit("DAOTest");
apexDao = new ApexDaoFactory().createApexDao(daoParameters);
@@ -163,13 +156,16 @@ public class EntityTest {
apexDao.close();
}
- private void testAllOps(){
- final AxArtifactKey aKey0 = new AxArtifactKey("A-KEY0", "0.0.1");
- final AxArtifactKey aKey1 = new AxArtifactKey("A-KEY1", "0.0.1");
- final AxArtifactKey aKey2 = new AxArtifactKey("A-KEY2", "0.0.1");
- final AxKeyInfo keyInfo0 = new AxKeyInfo(aKey0, UUID.fromString("00000000-0000-0000-0000-000000000000"), "key description 0");
- final AxKeyInfo keyInfo1 = new AxKeyInfo(aKey1, UUID.fromString("00000000-0000-0000-0000-000000000001"), "key description 1");
- final AxKeyInfo keyInfo2 = new AxKeyInfo(aKey2, UUID.fromString("00000000-0000-0000-0000-000000000002"), "key description 2");
+ private void testAllOps() {
+ final AxArtifactKey aKey0 = new AxArtifactKey("A-KEY0", "0.0.1");
+ final AxArtifactKey aKey1 = new AxArtifactKey("A-KEY1", "0.0.1");
+ final AxArtifactKey aKey2 = new AxArtifactKey("A-KEY2", "0.0.1");
+ final AxKeyInfo keyInfo0 =
+ new AxKeyInfo(aKey0, UUID.fromString("00000000-0000-0000-0000-000000000000"), "key description 0");
+ final AxKeyInfo keyInfo1 =
+ new AxKeyInfo(aKey1, UUID.fromString("00000000-0000-0000-0000-000000000001"), "key description 1");
+ final AxKeyInfo keyInfo2 =
+ new AxKeyInfo(aKey2, UUID.fromString("00000000-0000-0000-0000-000000000002"), "key description 2");
apexDao.create(keyInfo0);
@@ -182,7 +178,7 @@ public class EntityTest {
final AxKeyInfo keyInfoBack1 = apexDao.getArtifact(AxKeyInfo.class, aKey0);
assertTrue(keyInfoBack0.equals(keyInfoBack1));
- final AxKeyInfo keyInfoBack2 = apexDao.getArtifact(AxKeyInfo.class, new AxArtifactKey("A-KEY3", "0.0.1"));
+ final AxKeyInfo keyInfoBack2 = apexDao.getArtifact(AxKeyInfo.class, new AxArtifactKey("A-KEY3", "0.0.1"));
assertNull(keyInfoBack2);
final Set<AxKeyInfo> keyInfoSetIn = new TreeSet<AxKeyInfo>();
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/dao/TestDaoMisc.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java
index 9109bc24b..9f5b72d39 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/dao/TestDaoMisc.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.dao;
+package org.onap.policy.apex.model.basicmodel.dao;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@@ -27,10 +27,8 @@ import static org.junit.Assert.fail;
import java.util.Properties;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.dao.ApexDaoFactory;
-import org.onap.apex.model.basicmodel.dao.DAOParameters;
-import org.onap.apex.model.basicmodel.dao.converters.CDATAConditioner;
-import org.onap.apex.model.basicmodel.dao.converters.UUID2String;
+import org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner;
+import org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
@@ -39,7 +37,7 @@ public class TestDaoMisc {
@Test
public void testUUID2StringMopUp() {
- UUID2String uuid2String = new UUID2String();
+ final UUID2String uuid2String = new UUID2String();
assertEquals("", uuid2String.convertToDatabaseColumn(null));
}
@@ -47,45 +45,47 @@ public class TestDaoMisc {
public void testCDataConditionerMopUp() {
assertNull(CDATAConditioner.clean(null));
}
-
+
@Test
public void testDaoFactory() {
- DAOParameters daoParameters = new DAOParameters();
+ final DAOParameters daoParameters = new DAOParameters();
daoParameters.setPluginClass("somewhere.over.the.rainbow");
try {
new ApexDaoFactory().createApexDao(daoParameters);
fail("test shold throw an exception here");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertEquals("Apex DAO class not found for DAO plugin \"somewhere.over.the.rainbow\"", e.getMessage());
}
-
+
daoParameters.setPluginClass("java.lang.String");
try {
new ApexDaoFactory().createApexDao(daoParameters);
fail("test shold throw an exception here");
- }
- catch (Exception e) {
- assertEquals("Specified Apex DAO plugin class \"java.lang.String\" does not implement the ApexDao interface", e.getMessage());
+ } catch (final Exception e) {
+ assertEquals(
+ "Specified Apex DAO plugin class \"java.lang.String\" does not implement the ApexDao interface",
+ e.getMessage());
}
}
-
+
@Test
public void testDaoParameters() {
- DAOParameters pars = new DAOParameters();
+ final DAOParameters pars = new DAOParameters();
pars.setJdbcProperties(new Properties());
assertEquals(0, pars.getJdbcProperties().size());
-
+
pars.setJdbcProperty("name", "Dorothy");
assertEquals("Dorothy", pars.getJdbcProperty("name"));
-
+
pars.setPersistenceUnit("Kansas");
assertEquals("Kansas", pars.getPersistenceUnit());
-
+
pars.setPluginClass("somewhere.over.the.rainbow");
assertEquals("somewhere.over.the.rainbow", pars.getPluginClass());
-
- assertEquals("DAOParameters [pluginClass=somewhere.over.the.rainbow, persistenceUnit=Kansas, jdbcProperties={name=Dorothy}]", pars.toString());
+
+ assertEquals(
+ "DAOParameters [pluginClass=somewhere.over.the.rainbow, persistenceUnit=Kansas, jdbcProperties={name=Dorothy}]",
+ pars.toString());
}
}
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/AxModelWithReferences.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java
index e08b4482c..38359052b 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/AxModelWithReferences.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import java.util.ArrayList;
import java.util.List;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKey;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
public class AxModelWithReferences extends AxModel {
private static final long serialVersionUID = -8194956638511120008L;
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java
new file mode 100644
index 000000000..d0423eb3a
--- /dev/null
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java
@@ -0,0 +1,133 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.basicmodel.handling;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.dao.DAOParameters;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
+
+public class TestApexBasicModel {
+ private Connection connection;
+ TestApexModel<AxModel> testApexModel;
+
+ @Before
+ public void setup() throws Exception {
+ Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
+ connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
+
+ testApexModel = new TestApexModel<AxModel>(AxModel.class, new TestApexBasicModelCreator());
+ }
+
+ @After
+ public void teardown() throws Exception {
+ connection.close();
+ new File("derby.log").delete();
+ }
+
+ @Test
+ public void testModelValid() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelValid();
+ assertTrue(result.toString().equals(VALID_MODEL_STRING));
+ }
+
+ @Test
+ public void testApexModelVaidateObservation() throws Exception {
+ try {
+ testApexModel.testApexModelVaidateObservation();
+ } catch (final ApexException e) {
+ assertEquals("model should have observations", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testApexModelVaidateWarning() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateWarning();
+ assertTrue(result.toString().equals(WARNING_MODEL_STRING));
+ }
+
+ @Test
+ public void testModelVaidateInvalidModel() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateInvalidModel();
+ assertTrue(result.toString().equals(INVALID_MODEL_STRING));
+ }
+
+ @Test
+ public void testModelVaidateMalstructured() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateMalstructured();
+ assertTrue(result.toString().equals(INVALID_MODEL_MALSTRUCTURED_STRING));
+ }
+
+ @Test
+ public void testModelWriteReadXML() throws Exception {
+ testApexModel.testApexModelWriteReadXML();
+ }
+
+ @Test
+ public void testModelWriteReadJSON() throws Exception {
+ testApexModel.testApexModelWriteReadJSON();
+ }
+
+ @Test
+ public void testModelWriteReadJPA() throws Exception {
+ final DAOParameters daoParameters = new DAOParameters();
+ daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
+ daoParameters.setPersistenceUnit("DAOTest");
+
+ testApexModel.testApexModelWriteReadJPA(daoParameters);
+ }
+
+ // As there are no real concepts in a basic model, this is as near to a valid model as we can get
+ private static final String VALID_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n"
+ + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
+ + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
+ + "********************************";
+
+ private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n"
+ + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
+ + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
+ + "AxArtifactKey:(name=Unref0,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
+ + "AxArtifactKey:(name=Unref1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
+ + "********************************";
+
+ private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n"
+ + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n"
+ + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n"
+ + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n"
+ + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:duplicate UUID found on keyInfoMap entry AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):00000000-0000-0000-0000-000000000000\n"
+ + "********************************";
+
+ private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n"
+ + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n"
+ + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:INVALID:key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n"
+ + "********************************";
+}
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java
index 9d29c08f0..1ab7a2666 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -31,17 +31,17 @@ import java.util.Set;
import org.junit.Before;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.basicmodel.concepts.AxKeyUse;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.apex.model.basicmodel.service.ModelService;
-import org.onap.apex.model.basicmodel.test.TestApexModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyUse;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.service.ModelService;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
public class TestApexBasicModelConcepts {
TestApexModel<AxModel> testApexModel;
@@ -53,7 +53,7 @@ public class TestApexBasicModelConcepts {
@Test
public void testModelConcepts() {
- AxModel model = testApexModel.getModel();
+ final AxModel model = testApexModel.getModel();
assertNotNull(model);
model.clean();
assertNotNull(model);
@@ -65,7 +65,7 @@ public class TestApexBasicModelConcepts {
model.register();
assertEquals(model.getKeyInformation(), ModelService.getModel(AxKeyInformation.class));
- AxModel clonedModel = new AxModel(model);
+ final AxModel clonedModel = new AxModel(model);
assertTrue(clonedModel.toString().startsWith("AxModel:(key=AxArtifactKey:(name=BasicModel"));
assertFalse(model.hashCode() == 0);
@@ -91,8 +91,8 @@ public class TestApexBasicModelConcepts {
model.getKeyInformation().generateKeyInfo(model);
assertNotNull(model.getKeyInformation());
- AxKeyInformation keyI = model.getKeyInformation();
- AxKeyInformation clonedKeyI = new AxKeyInformation(keyI);
+ final AxKeyInformation keyI = model.getKeyInformation();
+ final AxKeyInformation clonedKeyI = new AxKeyInformation(keyI);
assertFalse(keyI.equals(null));
assertFalse(keyI.equals(new AxArtifactKey()));
@@ -177,7 +177,7 @@ public class TestApexBasicModelConcepts {
result = clonedKeyI.validate(result);
assertEquals(ValidationResult.VALID, result.getValidationResult());
- AxKeyInfo mk = clonedKeyI.get(new AxArtifactKey("BasicModel", "0.0.1"));
+ final AxKeyInfo mk = clonedKeyI.get(new AxArtifactKey("BasicModel", "0.0.1"));
assertNotNull(mk);
mk.setKey(AxArtifactKey.getNullKey());
result = new AxValidationResult();
@@ -189,7 +189,7 @@ public class TestApexBasicModelConcepts {
result = new AxValidationResult();
result = clonedKeyI.validate(result);
assertEquals(ValidationResult.VALID, result.getValidationResult());
-
+
clonedModel.setKey(AxArtifactKey.getNullKey());
result = new AxValidationResult();
result = clonedModel.validate(result);
@@ -200,14 +200,14 @@ public class TestApexBasicModelConcepts {
result = clonedKeyI.validate(result);
assertEquals(ValidationResult.VALID, result.getValidationResult());
}
-
+
@Test
public void testModelConceptsWithReferences() {
- AxModelWithReferences mwr = new TestApexBasicModelCreator().getModelWithReferences();
+ final AxModelWithReferences mwr = new TestApexBasicModelCreator().getModelWithReferences();
assertNotNull(mwr);
mwr.getKeyInformation().getKeyInfoMap().clear();
mwr.getKeyInformation().generateKeyInfo(mwr);
-
+
AxValidationResult result = new AxValidationResult();
result = mwr.validate(result);
assertEquals(ValidationResult.VALID, result.getValidationResult());
@@ -235,7 +235,7 @@ public class TestApexBasicModelConcepts {
assertEquals(ValidationResult.VALID, result.getValidationResult());
// Duplicate Reference Key
- AxReferenceKey rKey = new AxReferenceKey(mwr.getKey(), "LocalName");
+ final AxReferenceKey rKey = new AxReferenceKey(mwr.getKey(), "LocalName");
mwr.addKey(rKey);
mwr.addKey(rKey);
result = new AxValidationResult();
@@ -247,9 +247,9 @@ public class TestApexBasicModelConcepts {
result = new AxValidationResult();
result = mwr.validate(result);
assertEquals(ValidationResult.VALID, result.getValidationResult());
-
+
// Key Use is legal
- AxKeyUse keyU = new AxKeyUse(mwr.getKey());
+ final AxKeyUse keyU = new AxKeyUse(mwr.getKey());
mwr.addKey(keyU);
result = new AxValidationResult();
result = mwr.validate(result);
@@ -257,7 +257,7 @@ public class TestApexBasicModelConcepts {
mwr.removeKey(keyU);
// Key Use on bad artifact key
- AxKeyUse keyBU = new AxKeyUse(new AxArtifactKey("SomeKey", "0.0.1"));
+ final AxKeyUse keyBU = new AxKeyUse(new AxArtifactKey("SomeKey", "0.0.1"));
mwr.addKey(keyBU);
result = new AxValidationResult();
result = mwr.validate(result);
@@ -265,7 +265,7 @@ public class TestApexBasicModelConcepts {
mwr.removeKey(keyBU);
// Key Use on bad reference key
- AxKeyUse keyBRU = new AxKeyUse(new AxReferenceKey("SomeKey", "0.0.1", "Local"));
+ final AxKeyUse keyBRU = new AxKeyUse(new AxReferenceKey("SomeKey", "0.0.1", "Local"));
mwr.addKey(keyBRU);
result = new AxValidationResult();
result = mwr.validate(result);
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexBasicModelCreator.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java
index fca6c4425..762c7555f 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexBasicModelCreator.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import java.util.UUID;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.test.TestApexModelCreator;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
public class TestApexBasicModelCreator implements TestApexModelCreator<AxModel> {
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexTestModelCreator0.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java
index 4b3c00226..ff958373e 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexTestModelCreator0.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.test.TestApexModelCreator;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
public class TestApexTestModelCreator0 implements TestApexModelCreator<AxModel> {
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexTestModelCreator1.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java
index e208bd850..d2aa738a0 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexTestModelCreator1.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import java.util.UUID;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.test.TestApexModelCreator;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
public class TestApexTestModelCreator1 implements TestApexModelCreator<AxModel> {
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexTestModelCreator2.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java
index 9b9eb13ac..85751bf12 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestApexTestModelCreator2.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.test.TestApexModelCreator;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
public class TestApexTestModelCreator2 implements TestApexModelCreator<AxModel> {
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestBasicModelTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
index ea5433f08..9ddd3cc7e 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestBasicModelTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
@@ -1,33 +1,33 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.test.TestApexModel;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
@@ -36,14 +36,14 @@ public class TestBasicModelTest {
@Test
public void testNormalModelCreator() throws ApexException {
- TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class, new TestApexBasicModelCreator());
+ final TestApexModel<AxModel> testApexModel =
+ new TestApexModel<AxModel>(AxModel.class, new TestApexBasicModelCreator());
testApexModel.testApexModelValid();
try {
testApexModel.testApexModelVaidateObservation();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertEquals("model should have observations", e.getMessage());
}
testApexModel.testApexModelVaidateWarning();
@@ -56,100 +56,94 @@ public class TestBasicModelTest {
@Test
public void testModelCreator0() throws ApexException {
- TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator0());
+ final TestApexModel<AxModel> testApexModel =
+ new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator0());
testApexModel.testApexModelValid();
try {
testApexModel.testApexModelVaidateObservation();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertEquals("model should have observations", e.getMessage());
}
try {
testApexModel.testApexModelVaidateWarning();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertEquals("model should have warnings", e.getMessage());
}
try {
testApexModel.testApexModelVaidateInvalidModel();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertEquals("should not be valid ***validation of model successful***", e.getMessage());
}
try {
testApexModel.testApexModelVaidateMalstructured();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertEquals("should not be valid ***validation of model successful***", e.getMessage());
}
}
@Test
public void testModelCreator1() throws ApexException {
- TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator1());
+ final TestApexModel<AxModel> testApexModel =
+ new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator1());
try {
testApexModel.testApexModelValid();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e.getMessage().startsWith("model is invalid"));
}
try {
testApexModel.testApexModelVaidateObservation();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e.getMessage().startsWith("model is invalid"));
}
try {
testApexModel.testApexModelVaidateWarning();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e.getMessage().startsWith("model is invalid"));
}
testApexModel.testApexModelVaidateInvalidModel();
testApexModel.testApexModelVaidateMalstructured();
}
-
+
@Test
public void testModelCreator2() throws ApexException {
- TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator2());
+ final TestApexModel<AxModel> testApexModel =
+ new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator2());
testApexModel.testApexModelValid();
testApexModel.testApexModelVaidateObservation();
try {
testApexModel.testApexModelVaidateWarning();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertEquals("model should have warnings", e.getMessage());
}
}
-
+
@Test
public void testModelCreator1XMLJSON() throws ApexException {
- TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator1());
+ final TestApexModel<AxModel> testApexModel =
+ new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator1());
try {
testApexModel.testApexModelWriteReadJSON();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e.getMessage().startsWith("error processing file"));
}
try {
testApexModel.testApexModelWriteReadXML();
fail("Test should throw an exception");
- }
- catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e.getMessage().startsWith("error processing file"));
}
}
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestConceptGetter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java
index a6ff9dc0b..83545bf06 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestConceptGetter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -30,12 +30,12 @@ import java.io.IOException;
import java.util.UUID;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.handling.ApexModelFileWriter;
-import org.onap.apex.model.basicmodel.handling.ApexModelReader;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestExceptions.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java
index 0dd271f98..5c8922793 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestExceptions.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -26,7 +26,7 @@ import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.handling.ApexModelException;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelFileWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java
index c2116a1d2..ec4d0a5a9 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelFileWriter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -27,9 +27,9 @@ import java.io.File;
import java.io.IOException;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.handling.ApexModelFileWriter;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelReader.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java
index 134f6ff89..140817e00 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelReader.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -34,10 +34,10 @@ import java.io.FileReader;
import java.io.IOException;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.handling.ApexModelReader;
-import org.onap.apex.model.basicmodel.handling.ApexModelWriter;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelSaver.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java
index 182d341aa..08f123cba 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelSaver.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import java.io.File;
import java.io.IOException;
@@ -26,9 +26,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.handling.ApexModelSaver;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelStringWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java
index 2f4fcd2c7..d2a504676 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelStringWriter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -28,10 +28,10 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.handling.ApexModelStringWriter;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
index a21c148b6..8e5af45b3 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestModelWriter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -29,9 +29,9 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.ApexException;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.handling.ApexModelWriter;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestSchemaGenerator.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java
index 2e10b51b6..cdf3b4615 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/TestSchemaGenerator.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.handling;
+package org.onap.policy.apex.model.basicmodel.handling;
import static org.junit.Assert.assertTrue;
@@ -30,7 +30,6 @@ import java.io.IOException;
import java.io.PrintStream;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.handling.ApexSchemaGenerator;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
@@ -41,50 +40,51 @@ public class TestSchemaGenerator {
public void test() throws IOException {
final ByteArrayOutputStream baos0 = new ByteArrayOutputStream();
System.setOut(new PrintStream(baos0));
-
+
final String[] args0 = {};
ApexSchemaGenerator.main(args0);
assertTrue(baos0.toString().contains("usage: ApexSchemaGenerator apex-root-class [schema-file-name]"));
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
-
+
final ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
System.setOut(new PrintStream(baos1));
-
- final String[] args1 = {"hello", "goodbye", "here"};
+
+ final String[] args1 = { "hello", "goodbye", "here" };
ApexSchemaGenerator.main(args1);
assertTrue(baos1.toString().contains("usage: ApexSchemaGenerator apex-root-class [schema-file-name]"));
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
-
+
final ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
System.setOut(new PrintStream(baos2));
-
- final String[] args2 = {"hello", "goodbye"};
+
+ final String[] args2 = { "hello", "goodbye" };
ApexSchemaGenerator.main(args2);
assertTrue(baos2.toString().contains("error on Apex schema output"));
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
-
+
final ByteArrayOutputStream baos3 = new ByteArrayOutputStream();
System.setOut(new PrintStream(baos3));
-
- final String[] args3 = {"hello"};
+
+ final String[] args3 = { "hello" };
ApexSchemaGenerator.main(args3);
assertTrue(baos3.toString().contains("could not create JAXB context, root class hello not found"));
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
-
+
final ByteArrayOutputStream baos4 = new ByteArrayOutputStream();
System.setOut(new PrintStream(baos4));
-
- final String[] args4 = {"org.onap.apex.model.basicmodel.concepts.AxModel"};
+
+ final String[] args4 = { "org.onap.policy.apex.model.basicmodel.concepts.AxModel" };
ApexSchemaGenerator.main(args4);
- assertTrue(baos4.toString().contains("targetNamespace=\"http://www.ericsson.com/apex\""));
+ assertTrue(baos4.toString().contains("targetNamespace=\"http://www.onap.org/policy/apex-pdp\""));
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
-
+
final ByteArrayOutputStream baos5 = new ByteArrayOutputStream();
System.setOut(new PrintStream(baos5));
-
+
final File tempFile = File.createTempFile("ApexSchemaGeneratorTest", "xsd");
- final String[] args5 = {"org.onap.apex.model.basicmodel.concepts.AxModel", tempFile.getCanonicalPath()};
-
+ final String[] args5 =
+ { "org.onap.policy.apex.model.basicmodel.concepts.AxModel", tempFile.getCanonicalPath() };
+
ApexSchemaGenerator.main(args5);
assertTrue(tempFile.length() > 100);
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/IllegalParameters.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/IllegalParameters.java
index 3cb4808bf..3a7fdf530 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/IllegalParameters.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/IllegalParameters.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.service;
+package org.onap.policy.apex.model.basicmodel.service;
-import org.onap.apex.model.basicmodel.service.AbstractParameters;
+import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/LegalParameters.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/LegalParameters.java
index 2bab6fd2a..3de3ecb58 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/LegalParameters.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/LegalParameters.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.service;
+package org.onap.policy.apex.model.basicmodel.service;
-import org.onap.apex.model.basicmodel.service.AbstractParameters;
+import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/TestAbstractParameters.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestAbstractParameters.java
index e9a0e2f0a..7afa14440 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/TestAbstractParameters.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestAbstractParameters.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.service;
+package org.onap.policy.apex.model.basicmodel.service;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -35,17 +35,21 @@ public class TestAbstractParameters {
public void testAbstractParameters() {
final LegalParameters parameters = new LegalParameters();
assertNotNull(parameters);
- assertEquals("AbstractParameters [parameterClassName=org.onap.apex.model.basicmodel.service.LegalParameters]", parameters.toString());
+ assertEquals(
+ "AbstractParameters [parameterClassName=org.onap.policy.apex.model.basicmodel.service.LegalParameters]",
+ parameters.toString());
assertEquals(LegalParameters.class, parameters.getParameterClass());
- assertEquals("org.onap.apex.model.basicmodel.service.LegalParameters", parameters.getParameterClassName());
-
+ assertEquals("org.onap.policy.apex.model.basicmodel.service.LegalParameters",
+ parameters.getParameterClassName());
+
try {
new IllegalParameters();
fail("test should throw an exception here");
- }
- catch (final Exception e) {
- assertEquals("class \"somewhere.over.the.rainbow\" not found or not an instance of \"org.onap.apex.model.basicmodel.service.IllegalParameters\"", e.getMessage());
+ } catch (final Exception e) {
+ assertEquals(
+ "class \"somewhere.over.the.rainbow\" not found or not an instance of \"org.onap.policy.apex.model.basicmodel.service.IllegalParameters\"",
+ e.getMessage());
}
}
}
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/TestModelService.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java
index 51af9baaf..9c20d837f 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/TestModelService.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.service;
+package org.onap.policy.apex.model.basicmodel.service;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -26,9 +26,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.basicmodel.handling.TestApexBasicModelCreator;
-import org.onap.apex.model.basicmodel.service.ModelService;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.handling.TestApexBasicModelCreator;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
@@ -42,36 +41,41 @@ public class TestModelService {
assertFalse(ModelService.existsModel(AxKeyInformation.class));
try {
ModelService.getModel(AxKeyInformation.class);
+ } catch (final Exception e) {
+ assertEquals(
+ "Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation not found in model service",
+ e.getMessage());
}
- catch (Exception e) {
- assertEquals("Model for org.onap.apex.model.basicmodel.concepts.AxKeyInformation not found in model service", e.getMessage());
- }
-
- ModelService.registerModel(AxKeyInformation.class, new TestApexBasicModelCreator().getModel().getKeyInformation());
+
+ ModelService.registerModel(AxKeyInformation.class,
+ new TestApexBasicModelCreator().getModel().getKeyInformation());
assertTrue(ModelService.existsModel(AxKeyInformation.class));
assertNotNull(ModelService.getModel(AxKeyInformation.class));
-
+
ModelService.deregisterModel(AxKeyInformation.class);
-
+
assertFalse(ModelService.existsModel(AxKeyInformation.class));
try {
ModelService.getModel(AxKeyInformation.class);
- }
- catch (Exception e) {
- assertEquals("Model for org.onap.apex.model.basicmodel.concepts.AxKeyInformation not found in model service", e.getMessage());
+ } catch (final Exception e) {
+ assertEquals(
+ "Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation not found in model service",
+ e.getMessage());
}
- ModelService.registerModel(AxKeyInformation.class, new TestApexBasicModelCreator().getModel().getKeyInformation());
+ ModelService.registerModel(AxKeyInformation.class,
+ new TestApexBasicModelCreator().getModel().getKeyInformation());
assertTrue(ModelService.existsModel(AxKeyInformation.class));
assertNotNull(ModelService.getModel(AxKeyInformation.class));
-
+
ModelService.clear();
assertFalse(ModelService.existsModel(AxKeyInformation.class));
try {
ModelService.getModel(AxKeyInformation.class);
- }
- catch (Exception e) {
- assertEquals("Model for org.onap.apex.model.basicmodel.concepts.AxKeyInformation not found in model service", e.getMessage());
+ } catch (final Exception e) {
+ assertEquals(
+ "Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation not found in model service",
+ e.getMessage());
}
}
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/TestParameterService.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestParameterService.java
index ff2a9c876..e84b3e252 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/service/TestParameterService.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestParameterService.java
@@ -1,24 +1,24 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.service;
+package org.onap.policy.apex.model.basicmodel.service;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -26,7 +26,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.service.ParameterService;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
@@ -40,38 +39,41 @@ public class TestParameterService {
assertFalse(ParameterService.existsParameters(LegalParameters.class));
try {
ParameterService.getParameters(LegalParameters.class);
+ } catch (final Exception e) {
+ assertEquals(
+ "Parameters for org.onap.policy.apex.model.basicmodel.service.LegalParameters not found in parameter service",
+ e.getMessage());
}
- catch (final Exception e) {
- assertEquals("Parameters for org.onap.apex.model.basicmodel.service.LegalParameters not found in parameter service", e.getMessage());
- }
-
+
ParameterService.registerParameters(LegalParameters.class, new LegalParameters());
assertTrue(ParameterService.existsParameters(LegalParameters.class));
assertNotNull(ParameterService.getParameters(LegalParameters.class));
-
+
ParameterService.deregisterParameters(LegalParameters.class);
-
+
assertFalse(ParameterService.existsParameters(LegalParameters.class));
try {
ParameterService.getParameters(LegalParameters.class);
- }
- catch (final Exception e) {
- assertEquals("Parameters for org.onap.apex.model.basicmodel.service.LegalParameters not found in parameter service", e.getMessage());
+ } catch (final Exception e) {
+ assertEquals(
+ "Parameters for org.onap.policy.apex.model.basicmodel.service.LegalParameters not found in parameter service",
+ e.getMessage());
}
ParameterService.registerParameters(LegalParameters.class, new LegalParameters());
assertTrue(ParameterService.existsParameters(LegalParameters.class));
assertNotNull(ParameterService.getParameters(LegalParameters.class));
-
+
assertNotNull(ParameterService.getAll());
ParameterService.clear();
assertFalse(ParameterService.existsParameters(LegalParameters.class));
try {
ParameterService.getParameters(LegalParameters.class);
+ } catch (final Exception e) {
+ assertEquals(
+ "Parameters for org.onap.policy.apex.model.basicmodel.service.LegalParameters not found in parameter service",
+ e.getMessage());
}
- catch (final Exception e) {
- assertEquals("Parameters for org.onap.apex.model.basicmodel.service.LegalParameters not found in parameter service", e.getMessage());
- }
-
+
}
}
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java
index b723439b5..bde0956b8 100644
--- a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.basicmodel.xml;
+package org.onap.policy.apex.model.basicmodel.xml;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/basic-model/src/test/resources/META-INF/persistence.xml b/model/basic-model/src/test/resources/META-INF/persistence.xml
index 5d02906fc..a7bf1f6ac 100644
--- a/model/basic-model/src/test/resources/META-INF/persistence.xml
+++ b/model/basic-model/src/test/resources/META-INF/persistence.xml
@@ -23,14 +23,14 @@
<persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.apex.model.basicmodel.dao.converters.CDATAConditioner</class>
- <class>org.onap.apex.model.basicmodel.dao.converters.UUID2String</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxArtifactKey</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxReferenceKey</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxKeyInfo</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxKeyInformation</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxModel</class>
- <class>org.onap.apex.model.basicmodel.concepts.TestEntity</class>
+ <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class>
+ <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxModel</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.TestEntity</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
diff --git a/model/basic-model/src/test/resources/logback-test.xml b/model/basic-model/src/test/resources/logback-test.xml
index d9d77f797..4ece82083 100644
--- a/model/basic-model/src/test/resources/logback-test.xml
+++ b/model/basic-model/src/test/resources/logback-test.xml
@@ -44,8 +44,7 @@
<appender-ref ref="STDOUT" />
</logger>
- <appender name="FILE"
- class="ch.qos.logback.core.FileAppender">
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${LOG_DIR}/apex.log</file>
<encoder>
<pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
@@ -53,8 +52,7 @@
</encoder>
</appender>
- <appender name="CTXT_FILE"
- class="ch.qos.logback.core.FileAppender">
+ <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
<file>${LOG_DIR}/apex_ctxt.log</file>
<encoder>
<pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
@@ -62,11 +60,11 @@
</encoder>
</appender>
- <logger name="com.ericsson.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
- <logger name="com.ericsson.apex.core.context" level="INFO" additivity="false">
+ <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
</configuration>
diff --git a/model/context-model/pom.xml b/model/context-model/pom.xml
index 9f7766c79..b7ee5b447 100644
--- a/model/context-model/pom.xml
+++ b/model/context-model/pom.xml
@@ -36,12 +36,6 @@
<artifactId>basic-model</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.13.1.1</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
@@ -57,10 +51,10 @@
<goal>java</goal>
</goals>
<configuration>
- <mainClass>org.onap.apex.model.basicmodel.handling.ApexSchemaGenerator</mainClass>
+ <mainClass>org.onap.policy.apex.model.basicmodel.handling.ApexSchemaGenerator</mainClass>
<classpathScope>compile</classpathScope>
<arguments>
- <argument>org.onap.apex.model.contextmodel.concepts.AxContextModel</argument>
+ <argument>org.onap.policy.apex.model.contextmodel.concepts.AxContextModel</argument>
<argument>${project.build.directory}/model/xml/apex-context-model.xsd</argument>
</arguments>
</configuration>
diff --git a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextAlbum.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
index 045ea0aba..27f9b8b9b 100644
--- a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextAlbum.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
@@ -5,20 +5,20 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import java.util.List;
@@ -35,43 +35,42 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.apex.model.basicmodel.concepts.AxKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyUse;
-import org.onap.apex.model.basicmodel.concepts.AxValidationMessage;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyUse;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
import org.onap.policy.apex.model.utilities.Assertions;
/**
* This class is used to define an album of context.
* <p>
- * A context album is a distributed map of context that will be distributed across all process
- * instances that require access to it. This class defines the schema (structure) of the items in
- * the context album, whether the items on the context album are writable or not, and what the scope
- * of the context album is.
+ * A context album is a distributed map of context that will be distributed across all process instances that require
+ * access to it. This class defines the schema (structure) of the items in the context album, whether the items on the
+ * context album are writable or not, and what the scope of the context album is.
* <p>
- * The structure of items (objects) the context album is defined as a schema, which is understood by
- * whatever schema implementation is being used for the context album.
+ * The structure of items (objects) the context album is defined as a schema, which is understood by whatever schema
+ * implementation is being used for the context album.
* <p>
- * The scope of a context album is a string field, understood by whatever distribution mechanism is
- * being used for the context album. The distribution mechanism uses the scope of the context album
- * to decide to which executable entities a given context album is distributed.
+ * The scope of a context album is a string field, understood by whatever distribution mechanism is being used for the
+ * context album. The distribution mechanism uses the scope of the context album to decide to which executable entities
+ * a given context album is distributed.
* <p>
- * The writable flag on a context album defines whether users of a context album can write to the
- * context album or just read objects from the context album.
+ * The writable flag on a context album defines whether users of a context album can write to the context album or just
+ * read objects from the context album.
* <p>
- * Validation checks that the album key and the context schema key are not null and that the scope
- * field is not undefined and matches the regular expression {@link SCOPE_REGEXP}.
+ * Validation checks that the album key and the context schema key are not null and that the scope field is not
+ * undefined and matches the regular expression {@link SCOPE_REGEXP}.
*/
@Entity
@Table(name = "AxContextAlbum")
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexContextAlbum", namespace = "http://www.ericsson.com/apex")
-@XmlType(name = "AxContextAlbum", namespace = "http://www.ericsson.com/apex",
- propOrder = {"key", "scope", "isWritable", "itemSchema"})
+@XmlRootElement(name = "apexContextAlbum", namespace = "http://www.onap.org/policy/apex-pdp")
+@XmlType(name = "AxContextAlbum", namespace = "http://www.onap.org/policy/apex-pdp",
+ propOrder = { "key", "scope", "isWritable", "itemSchema" })
public class AxContextAlbum extends AxConcept {
private static final String SCOPE_STRING = "scope";
@@ -113,9 +112,9 @@ public class AxContextAlbum extends AxConcept {
// @formatter:on
/**
- * The default constructor creates a context album with a null artifact key. The scope of the
- * context album is set as {@link SCOPE_UNDEFINED}, the album is writable, and the artifact key
- * of the context schema is set to the null artifact key.
+ * The default constructor creates a context album with a null artifact key. The scope of the context album is set
+ * as {@link SCOPE_UNDEFINED}, the album is writable, and the artifact key of the context schema is set to the null
+ * artifact key.
*/
public AxContextAlbum() {
this(new AxArtifactKey());
@@ -126,7 +125,7 @@ public class AxContextAlbum extends AxConcept {
/**
* Copy constructor
- *
+ *
* @param copyConcept the concept to copy from
*/
public AxContextAlbum(final AxContextAlbum copyConcept) {
@@ -134,9 +133,9 @@ public class AxContextAlbum extends AxConcept {
}
/**
- * The keyed constructor creates a context album with the specified artifact key. The scope of
- * the context album is set as {@link SCOPE_UNDEFINED}, the album is writable, and the artifact
- * key of the context schema is set to the null artifact key.
+ * The keyed constructor creates a context album with the specified artifact key. The scope of the context album is
+ * set as {@link SCOPE_UNDEFINED}, the album is writable, and the artifact key of the context schema is set to the
+ * null artifact key.
*
* @param key the key of the context album
*/
@@ -168,7 +167,7 @@ public class AxContextAlbum extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKey()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
*/
@Override
public AxArtifactKey getKey() {
@@ -178,7 +177,7 @@ public class AxContextAlbum extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
*/
@Override
public List<AxKey> getKeys() {
@@ -257,7 +256,7 @@ public class AxContextAlbum extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#validate(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.
* basicmodel.concepts.AxValidationResult)
*/
@Override
@@ -294,7 +293,7 @@ public class AxContextAlbum extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#clean()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
*/
@Override
public void clean() {
@@ -306,7 +305,7 @@ public class AxContextAlbum extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#toString()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
*/
@Override
public String toString() {
@@ -328,7 +327,7 @@ public class AxContextAlbum extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.
* basicmodel.concepts.AxConcept)
*/
@Override
@@ -350,7 +349,7 @@ public class AxContextAlbum extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
*/
@Override
public int hashCode() {
@@ -366,7 +365,7 @@ public class AxContextAlbum extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
diff --git a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextAlbums.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
index e48d064cb..f9d34cef6 100644
--- a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextAlbums.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
@@ -5,20 +5,20 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import java.util.List;
import java.util.Map;
@@ -40,33 +40,32 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.apex.model.basicmodel.concepts.AxConceptGetter;
-import org.onap.apex.model.basicmodel.concepts.AxConceptGetterImpl;
-import org.onap.apex.model.basicmodel.concepts.AxKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationMessage;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetterImpl;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * This class is a context album container and holds a map of the context albums for an entire Apex
- * model. All Apex models that use context albums must have an {@link AxContextAlbums} field. The
- * {@link AxContextAlbums} class implements the helper methods of the {@link AxConceptGetter}
- * interface to allow {@link AxContextAlbum} instances to be retrieved by calling methods directly
- * on this class without referencing the contained map.
+ * This class is a context album container and holds a map of the context albums for an entire Apex model. All Apex
+ * models that use context albums must have an {@link AxContextAlbums} field. The {@link AxContextAlbums} class
+ * implements the helper methods of the {@link AxConceptGetter} interface to allow {@link AxContextAlbum} instances to
+ * be retrieved by calling methods directly on this class without referencing the contained map.
* <p>
- * Validation checks that the container key is not null. An observation is issued if no context
- * albums are defined in the container. If context albums do exist, they are checked to ensure that
- * keys and values are not null and that the map key matches the key in the map value for all album
- * entries. Each context album entry is then validated individually.
+ * Validation checks that the container key is not null. An observation is issued if no context albums are defined in
+ * the container. If context albums do exist, they are checked to ensure that keys and values are not null and that the
+ * map key matches the key in the map value for all album entries. Each context album entry is then validated
+ * individually.
*/
@Entity
@Table(name = "AxContextAlbums")
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxContextAlbums", namespace = "http://www.ericsson.com/apex", propOrder = {"key", "albums"})
+@XmlType(name = "AxContextAlbums", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "key", "albums" })
public final class AxContextAlbums extends AxConcept implements AxConceptGetter<AxContextAlbum> {
private static final long serialVersionUID = -4844259809024470975L;
@@ -84,8 +83,8 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
// @formatter:on
/**
- * The Default Constructor creates a {@link AxContextAlbums} object with a null artifact key and
- * creates an empty context album map.
+ * The Default Constructor creates a {@link AxContextAlbums} object with a null artifact key and creates an empty
+ * context album map.
*/
public AxContextAlbums() {
this(new AxArtifactKey());
@@ -93,7 +92,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/**
* Copy constructor
- *
+ *
* @param copyConcept the concept to copy from
*/
public AxContextAlbums(final AxContextAlbums copyConcept) {
@@ -101,8 +100,8 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
}
/**
- * The Key Constructor creates a {@link AxContextAlbums} object with the given artifact key and
- * creates an empty context album map.
+ * The Key Constructor creates a {@link AxContextAlbums} object with the given artifact key and creates an empty
+ * context album map.
*
* @param key the key of the context album container
*/
@@ -127,10 +126,9 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
}
/**
- * When a model is unmarshalled from disk or from the database, the context album map is
- * returned as a raw hash map. This method is called by JAXB after unmarshaling and is used to
- * convert the hash map to a {@link NavigableMap} so that it will work with the
- * {@link AxConceptGetter} interface.
+ * When a model is unmarshalled from disk or from the database, the context album map is returned as a raw hash map.
+ * This method is called by JAXB after unmarshaling and is used to convert the hash map to a {@link NavigableMap} so
+ * that it will work with the {@link AxConceptGetter} interface.
*
* @param u the unmarshaler that is unmarshaling the model
* @param parent the parent object of this object in the unmarshaler
@@ -146,7 +144,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKey()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
*/
@Override
public AxArtifactKey getKey() {
@@ -156,7 +154,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
*/
@Override
public List<AxKey> getKeys() {
@@ -202,7 +200,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#clean()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
*/
@Override
public void clean() {
@@ -216,7 +214,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#toString()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
*/
@Override
public String toString() {
@@ -236,7 +234,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#validate(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.
* basicmodel.concepts.AxValidationResult)
*/
@Override
@@ -281,7 +279,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.
* basicmodel.concepts.AxConcept)
*/
@Override
@@ -306,7 +304,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
*/
@Override
public int hashCode() {
@@ -320,7 +318,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
@@ -373,7 +371,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConceptGetter#get(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(org.onap.policy.apex.model.
* basicmodel.concepts.AxArtifactKey)
*/
@Override
@@ -384,7 +382,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConceptGetter#get(java.lang.String)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(java.lang.String)
*/
@Override
public AxContextAlbum get(final String conceptKeyName) {
@@ -394,8 +392,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConceptGetter#get(java.lang.String,
- * java.lang.String)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(java.lang.String, java.lang.String)
*/
@Override
public AxContextAlbum get(final String conceptKeyName, final String conceptKeyVersion) {
@@ -406,7 +403,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String)
*/
@Override
public Set<AxContextAlbum> getAll(final String conceptKeyName) {
@@ -416,8 +413,7 @@ public final class AxContextAlbums extends AxConcept implements AxConceptGetter<
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String,
- * java.lang.String)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String, java.lang.String)
*/
@Override
public Set<AxContextAlbum> getAll(final String conceptKeyName, final String conceptKeyVersion) {
diff --git a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextModel.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
index dcd381872..2aa6fc70a 100644
--- a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextModel.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
@@ -5,20 +5,20 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import java.util.List;
@@ -34,32 +34,31 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.apex.model.basicmodel.concepts.AxKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.basicmodel.concepts.AxModel;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.service.ModelService;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.service.ModelService;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * A container class for an Apex context model. This class is a container class that allows an Apex
- * model to be constructed that just contains context and the key information for that context. The
- * model contains schema definitions and the definitions of context albums that use those schemas.
- * In the case where Apex context is being used without policy or independent of policy, an Apex
- * context model is sufficient to get Apex context working.
+ * A container class for an Apex context model. This class is a container class that allows an Apex model to be
+ * constructed that just contains context and the key information for that context. The model contains schema
+ * definitions and the definitions of context albums that use those schemas. In the case where Apex context is being
+ * used without policy or independent of policy, an Apex context model is sufficient to get Apex context working.
* <p>
- * Validation runs {@link AxModel} validation on the model. In addition, the
- * {@link AxContextSchemas} and {@link AxContextAlbums} validation is run on the context schemas and
- * albums in the model.
+ * Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and
+ * {@link AxContextAlbums} validation is run on the context schemas and albums in the model.
*/
@Entity
@Table(name = "AxContextModel")
-@XmlRootElement(name = "apexContextModel", namespace = "http://www.ericsson.com/apex")
+@XmlRootElement(name = "apexContextModel", namespace = "http://www.onap.org/policy/apex-pdp")
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxContextModel", namespace = "http://www.ericsson.com/apex", propOrder = {"schemas", "albums"})
+@XmlType(name = "AxContextModel", namespace = "http://www.onap.org/policy/apex-pdp",
+ propOrder = { "schemas", "albums" })
public class AxContextModel extends AxModel {
private static final long serialVersionUID = 8800599637708309945L;
@@ -83,16 +82,16 @@ public class AxContextModel extends AxModel {
// @formatter:on
/**
- * The Default Constructor creates a {@link AxContextModel} object with a null artifact key and
- * creates an empty context model.
+ * The Default Constructor creates a {@link AxContextModel} object with a null artifact key and creates an empty
+ * context model.
*/
public AxContextModel() {
this(new AxArtifactKey());
}
/**
- * The Key Constructor creates a {@link AxContextModel} object with the given artifact key and
- * creates an empty context model.
+ * The Key Constructor creates a {@link AxContextModel} object with the given artifact key and creates an empty
+ * context model.
*
* @param key the key of the context model
*/
@@ -104,7 +103,7 @@ public class AxContextModel extends AxModel {
/**
* Copy constructor
- *
+ *
* @param copyConcept the concept to copy from
*/
public AxContextModel(final AxContextModel copyConcept) {
@@ -112,8 +111,8 @@ public class AxContextModel extends AxModel {
}
/**
- * Constructor that initiates a {@link AxContextModel} with schemas and keys for those schemas.
- * An empty {@link AxContextAlbums} container is created.
+ * Constructor that initiates a {@link AxContextModel} with schemas and keys for those schemas. An empty
+ * {@link AxContextAlbums} container is created.
*
* @param key the key of the context model
* @param schemas the context schema definitions
@@ -145,7 +144,7 @@ public class AxContextModel extends AxModel {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxModel#register()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#register()
*/
@Override
public void register() {
@@ -157,7 +156,7 @@ public class AxContextModel extends AxModel {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxModel#getKeys()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#getKeys()
*/
@Override
public List<AxKey> getKeys() {
@@ -210,7 +209,7 @@ public class AxContextModel extends AxModel {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxModel#validate(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#validate(org.onap.policy.apex.model.
* basicmodel.concepts.AxValidationResult)
*/
@Override
@@ -225,7 +224,7 @@ public class AxContextModel extends AxModel {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxModel#clean()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#clean()
*/
@Override
public void clean() {
@@ -237,7 +236,7 @@ public class AxContextModel extends AxModel {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxModel#toString()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#toString()
*/
@Override
public String toString() {
@@ -256,7 +255,7 @@ public class AxContextModel extends AxModel {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.
* basicmodel.concepts.AxConcept)
*/
@Override
@@ -277,7 +276,7 @@ public class AxContextModel extends AxModel {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxModel#hashCode()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#hashCode()
*/
@Override
public int hashCode() {
@@ -292,7 +291,7 @@ public class AxContextModel extends AxModel {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxModel#equals(java.lang.Object)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
@@ -320,7 +319,7 @@ public class AxContextModel extends AxModel {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxModel#compareTo(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#compareTo(org.onap.policy.apex.model.
* basicmodel.concepts.AxConcept)
*/
@Override
diff --git a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextSchema.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java
index 852e3f552..3abcebee9 100644
--- a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextSchema.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java
@@ -5,20 +5,20 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import java.util.List;
@@ -34,42 +34,40 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.apex.model.basicmodel.concepts.AxKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationMessage;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.apex.model.basicmodel.dao.converters.CDATAConditioner;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * This class holds a data schema definition in Apex. A data schema describes the structure of a
- * single atom of data handled by Apex. This atom of data can be a primitive type such as an integer
- * or a string, or it can be a more complex data type such as a Java object or an object described
- * using a data definition language such as Avro. The schema flavour defines the type of schema
- * being defined and the schema itself defines the schema. The schema flavour is used by Apex to
- * look up and load a plugin class that understands and interprets the schema definition and can
+ * This class holds a data schema definition in Apex. A data schema describes the structure of a single atom of data
+ * handled by Apex. This atom of data can be a primitive type such as an integer or a string, or it can be a more
+ * complex data type such as a Java object or an object described using a data definition language such as Avro. The
+ * schema flavour defines the type of schema being defined and the schema itself defines the schema. The schema flavour
+ * is used by Apex to look up and load a plugin class that understands and interprets the schema definition and can
* create instances of classes for the schema.
* <p>
- * An {@link AxContextSchema} is used to define each parameter in Apex events, the messages that
- * enter, exit, and are passed internally in Apex. In addition, an Apex {@link AxContextAlbum}
- * instances hold a map of {@link AxContextSchema} instances to represent the context being managed
- * as an {@link AxContextAlbum}. For example, the state of all cells in a mobile network might be
- * represented as an {@link AxContextAlbum} with its {@link AxContextSchema} being defined as @code
- * cell} objects.
+ * An {@link AxContextSchema} is used to define each parameter in Apex events, the messages that enter, exit, and are
+ * passed internally in Apex. In addition, an Apex {@link AxContextAlbum} instances hold a map of
+ * {@link AxContextSchema} instances to represent the context being managed as an {@link AxContextAlbum}. For example,
+ * the state of all cells in a mobile network might be represented as an {@link AxContextAlbum} with its
+ * {@link AxContextSchema} being defined as @code cell} objects.
* <p>
- * Validation checks that the schema key is not null. It also checks that the schema flavour is
- * defined and matches the regular expression {@link SCHEMA_FLAVOUR_REGEXP}. Finally, validation
- * checks that the defined schema is not a blank or empty string.
+ * Validation checks that the schema key is not null. It also checks that the schema flavour is defined and matches the
+ * regular expression {@link SCHEMA_FLAVOUR_REGEXP}. Finally, validation checks that the defined schema is not a blank
+ * or empty string.
*/
@Entity
@Table(name = "AxContextSchema")
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexContextSchema", namespace = "http://www.ericsson.com/apex")
-@XmlType(name = "AxContextSchema", namespace = "http://www.ericsson.com/apex",
- propOrder = {"key", "schemaFlavour", "schemaDefinition"})
+@XmlRootElement(name = "apexContextSchema", namespace = "http://www.onap.org/policy/apex-pdp")
+@XmlType(name = "AxContextSchema", namespace = "http://www.onap.org/policy/apex-pdp",
+ propOrder = { "key", "schemaFlavour", "schemaDefinition" })
public class AxContextSchema extends AxConcept {
private static final String SCHEMA_FLAVOUR = "schemaFlavour";
@@ -101,9 +99,8 @@ public class AxContextSchema extends AxConcept {
private String schemaDefinition;
/**
- * The default constructor creates a context schema with a null artifact key. The flavour of the
- * context album is set as {@link SCHEMA_FLAVOUR_UNDEFINED} and the schema itself is defined as
- * an empty string.
+ * The default constructor creates a context schema with a null artifact key. The flavour of the context album is
+ * set as {@link SCHEMA_FLAVOUR_UNDEFINED} and the schema itself is defined as an empty string.
*/
public AxContextSchema() {
this(new AxArtifactKey());
@@ -112,7 +109,7 @@ public class AxContextSchema extends AxConcept {
/**
* Copy constructor
- *
+ *
* @param copyConcept the concept to copy from
*/
public AxContextSchema(final AxContextSchema copyConcept) {
@@ -120,9 +117,8 @@ public class AxContextSchema extends AxConcept {
}
/**
- * The key constructor creates a context schema with the given artifact key. The flavour of the
- * context album is set as {@link SCHEMA_FLAVOUR_UNDEFINED} and the schema itself is defined as
- * an empty string.
+ * The key constructor creates a context schema with the given artifact key. The flavour of the context album is set
+ * as {@link SCHEMA_FLAVOUR_UNDEFINED} and the schema itself is defined as an empty string.
*
* @param key the key
*/
@@ -151,7 +147,7 @@ public class AxContextSchema extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKey()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
*/
@Override
public AxArtifactKey getKey() {
@@ -161,7 +157,7 @@ public class AxContextSchema extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
*/
@Override
public List<AxKey> getKeys() {
@@ -218,7 +214,7 @@ public class AxContextSchema extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#validate(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.
* basicmodel.concepts.AxValidationResult)
*/
@Override
@@ -256,7 +252,7 @@ public class AxContextSchema extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#clean()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
*/
@Override
public void clean() {
@@ -268,7 +264,7 @@ public class AxContextSchema extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#toString()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
*/
@Override
public String toString() {
@@ -288,7 +284,7 @@ public class AxContextSchema extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.
* basicmodel.concepts.AxConcept)
*/
@Override
@@ -309,7 +305,7 @@ public class AxContextSchema extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
*/
@Override
public int hashCode() {
@@ -324,7 +320,7 @@ public class AxContextSchema extends AxConcept {
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
diff --git a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextSchemas.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java
index b4a7e4ada..df94a87a9 100644
--- a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/AxContextSchemas.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java
@@ -5,20 +5,20 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import java.util.List;
import java.util.Map;
@@ -40,33 +40,31 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.apex.model.basicmodel.concepts.AxConceptGetter;
-import org.onap.apex.model.basicmodel.concepts.AxConceptGetterImpl;
-import org.onap.apex.model.basicmodel.concepts.AxKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationMessage;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetterImpl;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * This class is a context schema container and holds a map of the context schemas for an entire
- * Apex model. All Apex models that use context schemas must have an {@link AxContextSchemas} field.
- * The {@link AxContextSchemas} class implements the helper methods of the {@link AxConceptGetter}
- * interface to allow {@link AxContextSchema} instances to be retrieved by calling methods directly
- * on this class without referencing the contained map.
+ * This class is a context schema container and holds a map of the context schemas for an entire Apex model. All Apex
+ * models that use context schemas must have an {@link AxContextSchemas} field. The {@link AxContextSchemas} class
+ * implements the helper methods of the {@link AxConceptGetter} interface to allow {@link AxContextSchema} instances to
+ * be retrieved by calling methods directly on this class without referencing the contained map.
* <p>
- * Validation checks that the container key is not null. An error is issued if no context schemas
- * are defined in the container. Each context schema entry is checked to ensure that its key and
- * value are not null and that the key matches the key in the map value. Each context schema entry
- * is then validated individually.
+ * Validation checks that the container key is not null. An error is issued if no context schemas are defined in the
+ * container. Each context schema entry is checked to ensure that its key and value are not null and that the key
+ * matches the key in the map value. Each context schema entry is then validated individually.
*/
@Entity
@Table(name = "AxContextSchemas")
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxContextSchemas", namespace = "http://www.ericsson.com/apex", propOrder = {"key", "schemas"})
+@XmlType(name = "AxContextSchemas", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "key", "schemas" })
public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxContextSchema> {
private static final long serialVersionUID = -3203734282886453582L;
@@ -87,8 +85,8 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
// @formatter:on
/**
- * The Default Constructor creates a {@link AxContextSchemas} object with a null artifact key
- * and creates an empty context schemas map.
+ * The Default Constructor creates a {@link AxContextSchemas} object with a null artifact key and creates an empty
+ * context schemas map.
*/
public AxContextSchemas() {
this(new AxArtifactKey());
@@ -96,7 +94,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/**
* Copy constructor
- *
+ *
* @param copyConcept the concept to copy from
*/
public AxContextSchemas(final AxContextSchemas copyConcept) {
@@ -104,8 +102,8 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
}
/**
- * The Key Constructor creates a {@link AxContextSchemas} object with the given artifact key and
- * creates an empty context schemas map.
+ * The Key Constructor creates a {@link AxContextSchemas} object with the given artifact key and creates an empty
+ * context schemas map.
*
* @param key the key of the context album container
*/
@@ -130,10 +128,9 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
}
/**
- * When a model is unmarshalled from disk or from the database, the context schema map is
- * returned as a raw hash map. This method is called by JAXB after unmarshaling and is used to
- * convert the hash map to a {@link NavigableMap} so that it will work with the
- * {@link AxConceptGetter} interface.
+ * When a model is unmarshalled from disk or from the database, the context schema map is returned as a raw hash
+ * map. This method is called by JAXB after unmarshaling and is used to convert the hash map to a
+ * {@link NavigableMap} so that it will work with the {@link AxConceptGetter} interface.
*
* @param u the unmarshaler that is unmarshaling the model
* @param parent the parent object of this object in the unmarshaler
@@ -149,7 +146,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKey()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
*/
@Override
public AxArtifactKey getKey() {
@@ -159,7 +156,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
*/
@Override
public List<AxKey> getKeys() {
@@ -203,7 +200,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#validate(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.
* basicmodel.concepts.AxValidationResult)
*/
@Override
@@ -246,7 +243,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#clean()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
*/
@Override
public void clean() {
@@ -260,7 +257,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#toString()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
*/
@Override
public String toString() {
@@ -278,7 +275,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#copyTo(com.ericsson.apex.model.
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.
* basicmodel.concepts.AxConcept)
*/
@Override
@@ -304,7 +301,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
*/
@Override
public int hashCode() {
@@ -318,7 +315,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
@@ -370,7 +367,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#get(com.ericsson.apex.core.
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#get(org.onap.policy.apex.core.
* basicmodel.concepts.AxArtifactKey)
*/
@Override
@@ -381,7 +378,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang.String)
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang.String)
*/
@Override
public AxContextSchema get(final String conceptKeyName) {
@@ -391,8 +388,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang.String,
- * java.lang.String)
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#get(java.lang.String, java.lang.String)
*/
@Override
public AxContextSchema get(final String conceptKeyName, final String conceptKeyVersion) {
@@ -403,7 +399,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String)
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String)
*/
@Override
public Set<AxContextSchema> getAll(final String conceptKeyName) {
@@ -413,8 +409,7 @@ public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxCon
/*
* (non-Javadoc)
*
- * @see com.ericsson.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String,
- * java.lang.String)
+ * @see org.onap.policy.apex.core.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String, java.lang.String)
*/
@Override
public Set<AxContextSchema> getAll(final String conceptKeyName, final String conceptKeyVersion) {
diff --git a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/package-info.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/package-info.java
index f89f2f803..a7aa3a5ad 100644
--- a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/concepts/package-info.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/package-info.java
@@ -5,23 +5,24 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
/**
- * Contains the concepts required to manage context in APEX. It defines the main APEX concepts of
- * Context Schemas and Context Albums.
- *
+ * Contains the concepts required to manage context in APEX. It defines the main APEX concepts of Context Schemas and
+ * Context Albums.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.apex.model.contextmodel.concepts;
+
+package org.onap.policy.apex.model.contextmodel.concepts;
diff --git a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/handling/ContextComparer.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparer.java
index 8d654be74..7a5ebfd22 100644
--- a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/handling/ContextComparer.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/ContextComparer.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.handling;
+package org.onap.policy.apex.model.contextmodel.handling;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbums;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchema;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchemas;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
import org.onap.policy.apex.model.utilities.comparison.KeyedMapComparer;
import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference;
diff --git a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/handling/package-info.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/package-info.java
index bfc44f7e0..ec1fa893f 100644
--- a/model/context-model/src/main/java/org/onap/apex/model/contextmodel/handling/package-info.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/handling/package-info.java
@@ -24,4 +24,4 @@
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.apex.model.contextmodel.handling;
+package org.onap.policy.apex.model.contextmodel.handling;
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModelCreator.java b/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModelCreator.java
deleted file mode 100644
index b53d8d04d..000000000
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModelCreator.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.apex.model.contextmodel.handling;
-
-import java.util.UUID;
-
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.basicmodel.test.TestApexModelCreator;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbums;
-import org.onap.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchema;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchemas;
-
-public class TestApexContextModelCreator implements TestApexModelCreator<AxContextModel> {
-
- @Override
- public AxContextModel getModel() {
- final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "com.ericsson.apex.concept.TestContextItem000");
- final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "com.ericsson.apex.concept.TestContextItem00A");
-
- final AxContextSchemas contextSchemas = new AxContextSchemas(new AxArtifactKey("ContextSchemas", "0.0.1"));
- contextSchemas.getSchemasMap().put(schema0.getKey(), schema0);
- contextSchemas.getSchemasMap().put(schema1.getKey(), schema1);
-
- final AxContextAlbum contextAlbum0 = new AxContextAlbum(new AxArtifactKey("contextAlbum0", "0.0.1"), "APPLICATION", true, schema0.getKey());
- final AxContextAlbum contextAlbum1 = new AxContextAlbum(new AxArtifactKey("contextAlbum1", "0.0.1"), "GLOBAL" , false, schema1.getKey());
-
- final AxContextAlbums axContext = new AxContextAlbums(new AxArtifactKey("contextAlbums", "0.0.1"));
- axContext.getAlbumsMap().put(contextAlbum0.getKey(), contextAlbum0);
- axContext.getAlbumsMap().put(contextAlbum1.getKey(), contextAlbum1);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
- final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"), contextSchemas, axContext, keyInformation);
-
- contextModel.setKeyInformation(keyInformation);
- contextModel.getKeyInformation().getKeyInfoMap().put(schema0 .getKey(), new AxKeyInfo(schema0 .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000001"), "axContextSchema0"));
- contextModel.getKeyInformation().getKeyInfoMap().put(schema1 .getKey(), new AxKeyInfo(schema1 .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000002"), "axContextSchema1"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextSchemas.getKey(), new AxKeyInfo(contextSchemas.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000003"), "ContextSchemas"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextAlbum0 .getKey(), new AxKeyInfo(contextAlbum0 .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000004"), "contextAlbum0"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextAlbum1 .getKey(), new AxKeyInfo(contextAlbum1 .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000005"), "contextAlbum1"));
- contextModel.getKeyInformation().getKeyInfoMap().put(axContext .getKey(), new AxKeyInfo(axContext .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000006"), "axContext"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextModel .getKey(), new AxKeyInfo(contextModel .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000007"), "contextModel"));
- contextModel.getKeyInformation().getKeyInfoMap().put(keyInformation.getKey(), new AxKeyInfo(keyInformation.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000008"), "keyInformation"));
-
- return contextModel;
- }
-
- @Override
- public AxContextModel getInvalidModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getAlbums().get(new AxArtifactKey("contextAlbum0", "0.0.1")).setScope("UNDEFINED");
-
- contextModel.getSchemas().get(new AxArtifactKey("StringType", "0.0.1")).setSchema("");
-
- return contextModel;
- }
-
- public AxContextModel getMalstructuredModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getAlbums().get(new AxArtifactKey("contextAlbum1", "0.0.1")).setKey(new AxArtifactKey("contextAlbum1", "0.0.2"));;
- contextModel.getSchemas().get(new AxArtifactKey("MapType", "0.0.1")).setKey(new AxArtifactKey("MapType", "0.0.2"));;
-
- return contextModel;
- }
-
- @Override
- public AxContextModel getObservationModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getKeyInformation().get("contextAlbum1", "0.0.1").setDescription("");
-
- return contextModel;
- }
-
- @Override
- public AxContextModel getWarningModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getKeyInformation().get("contextAlbum1", "0.0.1").setUuid(UUID.fromString("00000000-0000-0000-0000-000000000000"));
-
- return contextModel;
- }
-}
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextAlbums.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java
index 476cda9a3..710c44e5b 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextAlbums.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -28,11 +28,11 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbums;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextModel.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java
index cab40f316..163e50018 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextModel.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -27,11 +27,11 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbums;
-import org.onap.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchemas;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextSchemas.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java
index 1e81c5a95..e9e9564ac 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextSchemas.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -28,11 +28,11 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchema;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchemas;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModel.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java
index 0723a6827..477755ccc 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModel.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java
@@ -5,20 +5,20 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.handling;
+package org.onap.policy.apex.model.contextmodel.handling;
import static org.junit.Assert.assertTrue;
@@ -29,10 +29,10 @@ import java.sql.DriverManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.dao.DAOParameters;
-import org.onap.apex.model.basicmodel.test.TestApexModel;
-import org.onap.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.dao.DAOParameters;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
public class TestApexContextModel {
private Connection connection;
@@ -95,7 +95,7 @@ public class TestApexContextModel {
@Test
public void testModelWriteReadJPA() throws Exception {
final DAOParameters daoParameters = new DAOParameters();
- daoParameters.setPluginClass("org.onap.apex.model.basicmodel.dao.impl.DefaultApexDao");
+ daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
daoParameters.setPersistenceUnit("DAOTest");
testApexModel.testApexModelWriteReadJPA(daoParameters);
@@ -103,25 +103,25 @@ public class TestApexContextModel {
private static final String VALID_MODEL_STRING = "***validation of model successful***";
- private static final String OBSERVATION_MODEL_STRING =
- "\n" + "***observations noted during validation of model***\n"
- + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n"
- + "********************************";
+ private static final String OBSERVATION_MODEL_STRING = "\n"
+ + "***observations noted during validation of model***\n"
+ + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n"
+ + "********************************";
private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n"
- + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n"
+ + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n"
+ "********************************";
private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=StringType,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextSchema:INVALID:no schemaDefinition specified, schemaDefinition may not be blank\n"
- + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n"
+ + "AxArtifactKey:(name=StringType,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema:INVALID:no schemaDefinition specified, schemaDefinition may not be blank\n"
+ + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n"
+ "********************************";
private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=ContextModel,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextModel:INVALID:key information not found for key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n"
- + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextModel:WARNING:key not found for key information entry\n"
- + "AxArtifactKey:(name=ContextSchemas,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:key on schemas entry AxArtifactKey:(name=MapType,version=0.0.1) does not equal entry key AxArtifactKey:(name=MapType,version=0.0.2)\n"
- + "AxArtifactKey:(name=contextAlbums,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextAlbums:INVALID:key on context album entry key AxArtifactKey:(name=contextAlbum1,version=0.0.1) does not equal context album value key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n"
+ + "AxArtifactKey:(name=ContextModel,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextModel:INVALID:key information not found for key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n"
+ + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextModel:WARNING:key not found for key information entry\n"
+ + "AxArtifactKey:(name=ContextSchemas,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:key on schemas entry AxArtifactKey:(name=MapType,version=0.0.1) does not equal entry key AxArtifactKey:(name=MapType,version=0.0.2)\n"
+ + "AxArtifactKey:(name=contextAlbums,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums:INVALID:key on context album entry key AxArtifactKey:(name=contextAlbum1,version=0.0.1) does not equal context album value key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n"
+ "********************************";
}
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java
new file mode 100644
index 000000000..4e8d8d5a9
--- /dev/null
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.contextmodel.handling;
+
+import java.util.UUID;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
+
+public class TestApexContextModelCreator implements TestApexModelCreator<AxContextModel> {
+
+ @Override
+ public AxContextModel getModel() {
+ final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java",
+ "org.onap.policy.apex.concept.TestContextItem000");
+ final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java",
+ "org.onap.policy.apex.concept.TestContextItem00A");
+
+ final AxContextSchemas contextSchemas = new AxContextSchemas(new AxArtifactKey("ContextSchemas", "0.0.1"));
+ contextSchemas.getSchemasMap().put(schema0.getKey(), schema0);
+ contextSchemas.getSchemasMap().put(schema1.getKey(), schema1);
+
+ final AxContextAlbum contextAlbum0 =
+ new AxContextAlbum(new AxArtifactKey("contextAlbum0", "0.0.1"), "APPLICATION", true, schema0.getKey());
+ final AxContextAlbum contextAlbum1 =
+ new AxContextAlbum(new AxArtifactKey("contextAlbum1", "0.0.1"), "GLOBAL", false, schema1.getKey());
+
+ final AxContextAlbums axContext = new AxContextAlbums(new AxArtifactKey("contextAlbums", "0.0.1"));
+ axContext.getAlbumsMap().put(contextAlbum0.getKey(), contextAlbum0);
+ axContext.getAlbumsMap().put(contextAlbum1.getKey(), contextAlbum1);
+
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+ final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"),
+ contextSchemas, axContext, keyInformation);
+
+ contextModel.setKeyInformation(keyInformation);
+ contextModel.getKeyInformation().getKeyInfoMap().put(schema0.getKey(), new AxKeyInfo(schema0.getKey(),
+ UUID.fromString("00000000-0000-0000-0000-000000000001"), "axContextSchema0"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(schema1.getKey(), new AxKeyInfo(schema1.getKey(),
+ UUID.fromString("00000000-0000-0000-0000-000000000002"), "axContextSchema1"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(contextSchemas.getKey(), new AxKeyInfo(
+ contextSchemas.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000003"), "ContextSchemas"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(contextAlbum0.getKey(), new AxKeyInfo(
+ contextAlbum0.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000004"), "contextAlbum0"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(contextAlbum1.getKey(), new AxKeyInfo(
+ contextAlbum1.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000005"), "contextAlbum1"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(axContext.getKey(), new AxKeyInfo(axContext.getKey(),
+ UUID.fromString("00000000-0000-0000-0000-000000000006"), "axContext"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(contextModel.getKey(), new AxKeyInfo(contextModel.getKey(),
+ UUID.fromString("00000000-0000-0000-0000-000000000007"), "contextModel"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(keyInformation.getKey(), new AxKeyInfo(
+ keyInformation.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000008"), "keyInformation"));
+
+ return contextModel;
+ }
+
+ @Override
+ public AxContextModel getInvalidModel() {
+ final AxContextModel contextModel = getModel();
+
+ contextModel.getAlbums().get(new AxArtifactKey("contextAlbum0", "0.0.1")).setScope("UNDEFINED");
+
+ contextModel.getSchemas().get(new AxArtifactKey("StringType", "0.0.1")).setSchema("");
+
+ return contextModel;
+ }
+
+ @Override
+ public AxContextModel getMalstructuredModel() {
+ final AxContextModel contextModel = getModel();
+
+ contextModel.getAlbums().get(new AxArtifactKey("contextAlbum1", "0.0.1"))
+ .setKey(new AxArtifactKey("contextAlbum1", "0.0.2"));;
+ contextModel.getSchemas().get(new AxArtifactKey("MapType", "0.0.1"))
+ .setKey(new AxArtifactKey("MapType", "0.0.2"));;
+
+ return contextModel;
+ }
+
+ @Override
+ public AxContextModel getObservationModel() {
+ final AxContextModel contextModel = getModel();
+
+ contextModel.getKeyInformation().get("contextAlbum1", "0.0.1").setDescription("");
+
+ return contextModel;
+ }
+
+ @Override
+ public AxContextModel getWarningModel() {
+ final AxContextModel contextModel = getModel();
+
+ contextModel.getKeyInformation().get("contextAlbum1", "0.0.1")
+ .setUuid(UUID.fromString("00000000-0000-0000-0000-000000000000"));
+
+ return contextModel;
+ }
+}
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparison.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java
index fe87509b9..794cfa9f7 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparison.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java
@@ -18,18 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.handling;
+package org.onap.policy.apex.model.contextmodel.handling;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchema;
-import org.onap.apex.model.contextmodel.handling.ContextComparer;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.handling.ContextComparer;
import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference;
/**
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparisonFactory.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java
index 1850c222d..2c6f8e172 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparisonFactory.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java
@@ -5,48 +5,52 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.handling;
+package org.onap.policy.apex.model.contextmodel.handling;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
/**
* This class creates sample Policy Models
- *
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestContextComparisonFactory {
public AxContextModel getFullModel() {
- final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema000");
- final AxContextSchema testContextSchema00A = new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema00A");
- final AxContextSchema testContextSchema00C = new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema00C");
-
- final AxContextAlbum externalContextAlbum = new AxContextAlbum(new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false,
- testContextSchema000.getKey());
- final AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"), "GLOBAL", true, testContextSchema00A.getKey());
- final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"), "APPLICATION", true,
- testContextSchema00C.getKey());
- final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true,
- testContextSchema00C.getKey());
+ final AxContextSchema testContextSchema000 =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema000");
+ final AxContextSchema testContextSchema00A =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema00A");
+ final AxContextSchema testContextSchema00C =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema00C");
+
+ final AxContextAlbum externalContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false, testContextSchema000.getKey());
+ final AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"),
+ "GLOBAL", true, testContextSchema00A.getKey());
+ final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
+ "APPLICATION", true, testContextSchema00C.getKey());
+ final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema00C.getKey());
final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
@@ -66,12 +70,15 @@ public class TestContextComparisonFactory {
}
public AxContextModel getShellModel() {
- final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema000");
- final AxContextSchema testContextSchema00A = new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema00A");
- final AxContextSchema testContextSchema00C = new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema00C");
+ final AxContextSchema testContextSchema000 =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema000");
+ final AxContextSchema testContextSchema00A =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema00A");
+ final AxContextSchema testContextSchema00C =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema00C");
final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
@@ -82,11 +89,12 @@ public class TestContextComparisonFactory {
}
public AxContextModel getSingleEntryModel() {
- final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema000");
+ final AxContextSchema testContextSchema000 =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema000");
- final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true,
- testContextSchema000.getKey());
+ final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema000.getKey());
final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
@@ -97,17 +105,19 @@ public class TestContextComparisonFactory {
}
public AxContextModel getNoGlobalContextModel() {
- final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema000");
- final AxContextSchema testContextSchema00C = new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema00C");
-
- final AxContextAlbum externalContextAlbum = new AxContextAlbum(new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false,
- testContextSchema000.getKey());
- final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"), "APPLICATION", true,
- testContextSchema00C.getKey());
- final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true,
- testContextSchema00C.getKey());
+ final AxContextSchema testContextSchema000 =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema000");
+ final AxContextSchema testContextSchema00C =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema00C");
+
+ final AxContextAlbum externalContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false, testContextSchema000.getKey());
+ final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
+ "APPLICATION", true, testContextSchema00C.getKey());
+ final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema00C.getKey());
final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
diff --git a/model/context-model/src/test/resources/META-INF/persistence.xml b/model/context-model/src/test/resources/META-INF/persistence.xml
index d9203b4be..ec9357851 100644
--- a/model/context-model/src/test/resources/META-INF/persistence.xml
+++ b/model/context-model/src/test/resources/META-INF/persistence.xml
@@ -23,19 +23,19 @@
<persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.apex.model.basicmodel.dao.converters.CDATAConditioner</class>
- <class>org.onap.apex.model.basicmodel.dao.converters.UUID2String</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxArtifactKey</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxConcept</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxKeyInfo</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxKeyInformation</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxModel</class>
- <class>org.onap.apex.model.basicmodel.concepts.TestEntity</class>
- <class>org.onap.apex.model.contextmodel.concepts.AxContextSchema</class>
- <class>org.onap.apex.model.contextmodel.concepts.AxContextSchemas</class>
- <class>org.onap.apex.model.contextmodel.concepts.AxContextAlbum</class>
- <class>org.onap.apex.model.contextmodel.concepts.AxContextAlbums</class>
- <class>org.onap.apex.model.contextmodel.concepts.AxContextModel</class>
+ <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class>
+ <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxModel</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.TestEntity</class>
+ <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema</class>
+ <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas</class>
+ <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum</class>
+ <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums</class>
+ <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextModel</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
diff --git a/model/context-model/src/test/resources/json/ContextModel.json b/model/context-model/src/test/resources/json/ContextModel.json
index cbaabc63b..2c93ef1c2 100644
--- a/model/context-model/src/test/resources/json/ContextModel.json
+++ b/model/context-model/src/test/resources/json/ContextModel.json
@@ -85,7 +85,7 @@
"name" : "StringType",
"version" : "0.0.1"
},
- "javaType" : "com.ericsson.apex.core.contextmodel.concepts.TestContextItem000"
+ "javaType" : "org.onap.policy.apex.core.contextmodel.concepts.TestContextItem000"
},
"isWritable" : true,
"valueString" : ""
@@ -96,7 +96,7 @@
"name" : "MapType",
"version" : "0.0.1"
},
- "javaType" : "com.ericsson.apex.core.contextmodel.concepts.TestContextItem00A"
+ "javaType" : "org.onap.policy.apex.core.contextmodel.concepts.TestContextItem00A"
},
"isWritable" : true,
"valueString" : ""
@@ -107,7 +107,7 @@
"name" : "StringType",
"version" : "0.0.1"
},
- "javaType" : "com.ericsson.apex.core.contextmodel.concepts.TestContextItem000"
+ "javaType" : "org.onap.policy.apex.core.contextmodel.concepts.TestContextItem000"
},
"isWritable" : true,
"valueString" : ""
@@ -118,7 +118,7 @@
"name" : "MapType",
"version" : "0.0.1"
},
- "javaType" : "com.ericsson.apex.core.contextmodel.concepts.TestContextItem00A"
+ "javaType" : "org.onap.policy.apex.core.contextmodel.concepts.TestContextItem00A"
},
"isWritable" : true,
"valueString" : ""
@@ -141,7 +141,7 @@
"name" : "MapType",
"version" : "0.0.1"
},
- "javaType" : "com.ericsson.apex.core.contextmodel.concepts.TestContextItem00A"
+ "javaType" : "org.onap.policy.apex.core.contextmodel.concepts.TestContextItem00A"
},
"isWritable" : true
},
diff --git a/model/context-model/src/test/resources/logback-test.xml b/model/context-model/src/test/resources/logback-test.xml
index 07bc02591..628f02397 100644
--- a/model/context-model/src/test/resources/logback-test.xml
+++ b/model/context-model/src/test/resources/logback-test.xml
@@ -40,7 +40,7 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="com.ericsson.apex.core.contextmodel" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.contextmodel" level="TRACE" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
@@ -48,7 +48,7 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="com.ericsson.apex.core" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core" level="TRACE" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
@@ -68,11 +68,11 @@
</encoder>
</appender>
- <logger name="com.ericsson.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
- <logger name="com.ericsson.apex.core.context" level="INFO" additivity="false">
+ <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
</configuration>
diff --git a/model/event-model/pom.xml b/model/event-model/pom.xml
new file mode 100644
index 000000000..8e60a8bf4
--- /dev/null
+++ b/model/event-model/pom.xml
@@ -0,0 +1,67 @@
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.policy.apex-pdp.model</groupId>
+ <artifactId>model</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>event-model</artifactId>
+ <name>${project.artifactId}</name>
+ <description>Event Models used in Apex</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.policy.apex-pdp.model</groupId>
+ <artifactId>context-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-xml-schema</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <mainClass>org.onap.policy.apex.model.basicmodel.handling.ApexSchemaGenerator</mainClass>
+ <classpathScope>compile</classpathScope>
+ <arguments>
+ <argument>org.onap.policy.apex.model.eventmodel.concepts.AxEventModel</argument>
+ <argument>${project.build.directory}/model/xml/apex-event-model.xsd</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project> \ No newline at end of file
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java
new file mode 100644
index 000000000..4944f1b8a
--- /dev/null
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java
@@ -0,0 +1,560 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.concepts;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.utilities.Assertions;
+
+/**
+ * This class defines an Apex event. An {@link AxEvent} is used to kick off execution of policies in Apex and is emitted
+ * by policies when they completer execution. In addition, Apex uses {@link AxEvent} instances internally to pass
+ * control from one Apex state to the next during execution.
+ * <p>
+ * The {@link AxArtifactKey} of an event uniquely identifies it in an Apex system and the name field in the key is the
+ * name of the event.
+ * <p>
+ * Each {@link AxEvent} has a name space, which is usually set to identify the domain of application of an event. For
+ * example a 4G cell power event might have the name space {@code org.onap.radio.4g} and the name {@code PowerEvent}.
+ * The source and target of the event are reserved to hold an identifier that defines the sender and receiver of an
+ * event respectively. The definition and structure of these fields is reserved for future use and their use by
+ * applications is currently not recommended.
+ * <p>
+ * The parameters that an event has are defined as a map of {@link AxField} instances.
+ * <p>
+ * Validation checks that the event key is valid. If name space is a blank string, a warning is issued. Blank source or
+ * target fields result in observations being issued. An event may not have any parameters. If it has parameters, the
+ * name and value of each parameter entry is checked to ensure they are not null. Then the local name of each parameter
+ * is checked to ensure it matches the event parameter key on the event. Finally, the parent key of each parameter is
+ * checked to ensure it matches the event key.
+ */
+@Entity
+@Table(name = "AxEvent")
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement(name = "apexEvent", namespace = "http://www.onap.org/policy/apex-pdp")
+@XmlType(name = "AxEvent", namespace = "http://www.onap.org/policy/apex-pdp",
+ propOrder = { "key", "nameSpace", "source", "target", "parameterMap" })
+
+public class AxEvent extends AxConcept {
+ private static final long serialVersionUID = -1460388382582984269L;
+
+ private static final String WHITESPACE_REGEXP = "\\s+$";
+
+ /** The key of the event, unique in the Apex system. */
+ @EmbeddedId
+ @XmlElement(name = "key", required = true)
+ // CHECKSTYLE:OFF: checkstyle:VisibilityMonitor
+ protected AxArtifactKey key;
+ // CHECKSTYLE:ON: checkstyle:VisibilityMonitor
+
+ @Column(name = "nameSpace")
+ @XmlElement(required = true)
+ private String nameSpace;
+
+ @Column(name = "source")
+ @XmlElement(required = true)
+ private String source;
+
+ @Column(name = "target")
+ @XmlElement(required = true)
+ private String target;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @XmlElement(name = "parameter", required = true)
+ private Map<String, AxField> parameterMap;
+
+ /**
+ * The default constructor creates an event with a null artifact key. The event name space, source, and target are
+ * all defined as empty strings and the parameter map is initialized as an empty map.
+ */
+ public AxEvent() {
+ this(new AxArtifactKey());
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param copyConcept the concept to copy from
+ */
+ public AxEvent(final AxEvent copyConcept) {
+ super(copyConcept);
+ }
+
+ /**
+ * The default constructor creates an event with the given artifact key. The event name space, source, and target
+ * are all defined as empty strings and the parameter map is initialized as an empty map.
+ *
+ * @param key the key of the event
+ */
+ public AxEvent(final AxArtifactKey key) {
+ this(key, "", "", "", new TreeMap<String, AxField>());
+ }
+
+ /**
+ * This constructor creates an event with the given artifact key and name space. The event source, and target are
+ * all defined as empty strings and the parameter map is initialized as an empty map.
+ *
+ * @param key the key of the event
+ * @param nameSpace the name space of the event
+ */
+ public AxEvent(final AxArtifactKey key, final String nameSpace) {
+ this(key, nameSpace, "", "", new TreeMap<String, AxField>());
+ }
+
+ /**
+ * This constructor creates an event with the given artifact key, name space, source and target. The parameter map
+ * is initialized as an empty map.
+ *
+ * @param key the key of the event
+ * @param nameSpace the name space of the event
+ * @param source the source of the event
+ * @param target the target of the event
+ */
+ public AxEvent(final AxArtifactKey key, final String nameSpace, final String source, final String target) {
+ this(key, nameSpace, source, target, new TreeMap<String, AxField>());
+ }
+
+ /**
+ * This constructor creates an event with all its fields defined.
+ *
+ * @param key the key of the event
+ * @param nameSpace the name space of the event
+ * @param source the source of the event
+ * @param target the target of the event
+ * @param parameterMap the map of parameters that the event has
+ */
+ public AxEvent(final AxArtifactKey key, final String nameSpace, final String source, final String target,
+ final SortedMap<String, AxField> parameterMap) {
+ super();
+ Assertions.argumentNotNull(key, "key may not be null");
+ Assertions.argumentNotNull(nameSpace, "nameSpace may not be null");
+ Assertions.argumentNotNull(source, "source may not be null");
+ Assertions.argumentNotNull(target, "target may not be null");
+ Assertions.argumentNotNull(parameterMap, "parameterMap may not be null");
+
+ this.key = key;
+ this.nameSpace = nameSpace;
+ this.source = source;
+ this.target = target;
+ this.parameterMap = parameterMap;
+ }
+
+ /**
+ * This method checks that an event has all the fields in the {@code otherFieldSet} set defined on it.
+ *
+ * @param otherFieldSet the set of fields to check for existence on this event
+ * @return true, if all the {@code otherFieldSet} fields are defined on this event
+ */
+ public boolean hasFields(final Set<AxField> otherFieldSet) {
+ return parameterMap.values().containsAll(otherFieldSet);
+ }
+
+ /**
+ * When an event is unmarshalled from disk or from the database, the parent key in the reference keys in its
+ * parameter map are not set. This method is called by JAXB after unmarshaling and is used to set the parent key of
+ * the {@link AxField} instances in the parameter map to be the key of the event that contains them.
+ *
+ * @param u the unmarshaler that is unmarshaling the model
+ * @param parent the parent object of this object in the unmarshaler
+ */
+ public void afterUnmarshal(final Unmarshaller u, final Object parent) {
+ for (final AxField parameter : parameterMap.values()) {
+ parameter.getKey().setParentArtifactKey(key);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
+ */
+ @Override
+ public AxArtifactKey getKey() {
+ return key;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ */
+ @Override
+ public List<AxKey> getKeys() {
+ final List<AxKey> keyList = key.getKeys();
+
+ for (final AxField field : parameterMap.values()) {
+ keyList.addAll(field.getKeys());
+ }
+ return keyList;
+ }
+
+ /**
+ * Sets the key of the event.
+ *
+ * @param key the key of the event
+ */
+ public void setKey(final AxArtifactKey key) {
+ Assertions.argumentNotNull(key, "key may not be null");
+ this.key = key;
+
+ for (final AxField parameter : parameterMap.values()) {
+ parameter.getKey().setParentArtifactKey(key);
+ }
+ }
+
+ /**
+ * Gets the name space of the event.
+ *
+ * @return the name space of the event
+ */
+ public String getNameSpace() {
+ return nameSpace;
+ }
+
+ /**
+ * Sets the name space of the event.
+ *
+ * @param nameSpace the name space of the event
+ */
+ public void setNameSpace(final String nameSpace) {
+ Assertions.argumentNotNull(nameSpace, "nameSpace may not be null");
+ this.nameSpace = nameSpace.trim();
+ }
+
+ /**
+ * Gets the source of the event.
+ *
+ * @return the source of the event
+ */
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * Sets the source of the event.
+ *
+ * @param source the source of the event
+ */
+ public void setSource(final String source) {
+ Assertions.argumentNotNull(source, "source may not be null");
+ this.source = source.trim();
+ }
+
+ /**
+ * Gets the target of the event.
+ *
+ * @return the target of the event
+ */
+ public String getTarget() {
+ return target;
+ }
+
+ /**
+ * Sets the target of the event.
+ *
+ * @param target the target of the event
+ */
+ public void setTarget(final String target) {
+ Assertions.argumentNotNull(target, "target may not be null");
+ this.target = target.trim();
+ }
+
+ /**
+ * Gets the event parameter map.
+ *
+ * @return the event parameter map
+ */
+ public Map<String, AxField> getParameterMap() {
+ return parameterMap;
+ }
+
+ /**
+ * Gets the fields defined on the event as a set.
+ *
+ * @return the fields defined on the event as a set
+ */
+ public Set<AxField> getFields() {
+ return new TreeSet<>(parameterMap.values());
+ }
+
+ /**
+ * Sets the event parameter map, containing all the fields of the event.
+ *
+ * @param parameterMap the event parameter map
+ */
+ public void setParameterMap(final Map<String, AxField> parameterMap) {
+ Assertions.argumentNotNull(parameterMap, "parameterMap may not be null");
+ this.parameterMap = parameterMap;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxValidationResult)
+ */
+ @Override
+ public AxValidationResult validate(final AxValidationResult resultIn) {
+ AxValidationResult result = resultIn;
+
+ if (key.equals(AxArtifactKey.getNullKey())) {
+ result.addValidationMessage(
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ }
+
+ result = key.validate(result);
+
+ if (nameSpace.replaceAll(WHITESPACE_REGEXP, "").length() == 0) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.WARNING,
+ "nameSpace on event is blank"));
+ }
+
+ if (source.replaceAll(WHITESPACE_REGEXP, "").length() == 0) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION,
+ "source on event is blank"));
+ }
+
+ if (target.replaceAll(WHITESPACE_REGEXP, "").length() == 0) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION,
+ "target on event is blank"));
+ }
+
+ for (final Entry<String, AxField> eventParameterEntry : parameterMap.entrySet()) {
+ if (eventParameterEntry.getKey() == null || eventParameterEntry.getKey().equals(AxKey.NULL_KEY_NAME)) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key on parameter " + eventParameterEntry.getKey() + " may not be the null key"));
+ } else if (eventParameterEntry.getValue() == null) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "value on parameter " + eventParameterEntry.getKey() + " may not be null"));
+ } else {
+ result = vaidateEventParameters(eventParameterEntry, result);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Validate an event parameter entry
+ *
+ * @param eventParameterEntry the event parameter entry
+ * @param result the validation result to append to
+ * @return The validation result
+ */
+ private AxValidationResult vaidateEventParameters(final Entry<String, AxField> eventParameterEntry,
+ final AxValidationResult result) {
+ if (!eventParameterEntry.getKey().equals(eventParameterEntry.getValue().getKey().getLocalName())) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key on parameter " + eventParameterEntry.getKey() + " does not equal parameter field local name "
+ + eventParameterEntry.getValue().getKey().getLocalName()));
+ }
+
+ if (!eventParameterEntry.getValue().getKey().getParentArtifactKey().equals(key)) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "parent key on parameter field " + eventParameterEntry.getValue().getKey()
+ + " does not equal event key"));
+ }
+
+ return eventParameterEntry.getValue().validate(result);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
+ */
+ @Override
+ public void clean() {
+ key.clean();
+ nameSpace = nameSpace.trim();
+ source = source.trim();
+ target = target.trim();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
+ */
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(this.getClass().getSimpleName());
+ builder.append(":(");
+ builder.append("key=");
+ builder.append(key);
+ builder.append(",nameSpace=");
+ builder.append(nameSpace);
+ builder.append(",source=");
+ builder.append(source);
+ builder.append(",target=");
+ builder.append(target);
+ builder.append(",parameter=");
+ builder.append(parameterMap);
+ builder.append(")");
+ return builder.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public AxConcept copyTo(final AxConcept targetObject) {
+ Assertions.argumentNotNull(targetObject, "targetObject may not be null");
+
+ final Object copyObject = targetObject;
+ Assertions.instanceOf(copyObject, AxEvent.class);
+
+ final AxEvent copy = (AxEvent) copyObject;
+
+ final Map<String, AxField> newParameterMap = new TreeMap<>();
+ for (final Entry<String, AxField> eventParameterMapEntry : parameterMap.entrySet()) {
+ newParameterMap.put(eventParameterMapEntry.getKey(), new AxField(eventParameterMapEntry.getValue()));
+ }
+ copy.setParameterMap(newParameterMap);
+
+ copy.setKey(new AxArtifactKey(key));
+ copy.setNameSpace(nameSpace);
+ copy.setSource(source);
+ copy.setTarget(target);
+
+ return copy;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + key.hashCode();
+ result = prime * result + nameSpace.hashCode();
+ result = prime * result + source.hashCode();
+ result = prime * result + target.hashCode();
+ result = prime * result + parameterMap.hashCode();
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (this == obj) {
+ return true;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ final AxEvent other = (AxEvent) obj;
+ if (!key.equals(other.key)) {
+ return false;
+ }
+ if (!nameSpace.equals(other.nameSpace)) {
+ return false;
+ }
+ if (!source.equals(other.source)) {
+ return false;
+ }
+ if (!target.equals(other.target)) {
+ return false;
+ }
+ return parameterMap.equals(other.parameterMap);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ public int compareTo(final AxConcept otherObj) {
+ if (otherObj == null) {
+ return -1;
+ }
+ if (this == otherObj) {
+ return 0;
+ }
+ if (getClass() != otherObj.getClass()) {
+ return this.hashCode() - otherObj.hashCode();
+ }
+
+ final AxEvent other = (AxEvent) otherObj;
+ if (!key.equals(other.key)) {
+ return key.compareTo(other.key);
+ }
+ if (!nameSpace.equals(other.nameSpace)) {
+ return nameSpace.compareTo(other.nameSpace);
+ }
+ if (!source.equals(other.source)) {
+ return target.compareTo(other.source);
+ }
+ if (!target.equals(other.target)) {
+ return target.compareTo(other.target);
+ }
+ if (!parameterMap.equals(other.parameterMap)) {
+ return (parameterMap.hashCode() - other.parameterMap.hashCode());
+ }
+
+ return 0;
+ }
+}
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java
new file mode 100644
index 000000000..3447ff8f9
--- /dev/null
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java
@@ -0,0 +1,330 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.concepts;
+
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.service.ModelService;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
+import org.onap.policy.apex.model.utilities.Assertions;
+
+/**
+ * A container class for an Apex event model. This class is a container class that allows an Apex model to be
+ * constructed that contains events and context and the key information for those events and context. The model contains
+ * schema definitions and the definitions of events that use those schemas.
+ * <p>
+ * Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and
+ * {@link AxEvents} validation is run on the context schemas and events in the model.
+ */
+
+@Entity
+@Table(name = "AxEventModel")
+
+@XmlRootElement(name = "apexEventModel", namespace = "http://www.onap.org/policy/apex-pdp")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "AxEventModel", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "schemas", "events" })
+
+public class AxEventModel extends AxModel {
+ private static final long serialVersionUID = 8800599637708309945L;
+
+ // @formatter:off
+ @OneToOne(cascade = CascadeType.ALL)
+ @JoinColumns({ @JoinColumn(name = "schemasName", referencedColumnName = "name"),
+ @JoinColumn(name = "schemasVersion", referencedColumnName = "version") })
+ @XmlElement(name = "schemas", required = true)
+ private AxContextSchemas schemas;
+
+ @OneToOne(cascade = CascadeType.ALL)
+ @JoinColumns({ @JoinColumn(name = "eventsName", referencedColumnName = "name"),
+ @JoinColumn(name = "eventsVersion", referencedColumnName = "version") })
+ @XmlElement(name = "events", required = true)
+ private AxEvents events;
+ // @formatter:on
+
+ /**
+ * The Default Constructor creates a {@link AxEventModel} object with a null artifact key and creates an empty event
+ * model.
+ */
+ public AxEventModel() {
+ this(new AxArtifactKey());
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param copyConcept the concept to copy from
+ */
+ public AxEventModel(final AxEventModel copyConcept) {
+ super(copyConcept);
+ }
+
+ /**
+ * The Key Constructor creates a {@link AxEventModel} object with the given artifact key and creates an empty event
+ * model.
+ *
+ * @param key the event model key
+ */
+ public AxEventModel(final AxArtifactKey key) {
+ this(key, new AxContextSchemas(new AxArtifactKey(key.getName() + "_Schemas", key.getVersion())),
+ new AxKeyInformation(new AxArtifactKey(key.getName() + "_KeyInfo", key.getVersion())),
+ new AxEvents(new AxArtifactKey(key.getName() + "_Events", key.getVersion())));
+ }
+
+ /**
+ * Constructor that initiates a {@link AxEventModel} with all its fields.
+ *
+ * @param key the event model key
+ * @param schemas the schemas for events in the event model
+ * @param keyInformation the key information for context schemas and events in the event model
+ * @param events the events in the event model
+ */
+ public AxEventModel(final AxArtifactKey key, final AxContextSchemas schemas, final AxKeyInformation keyInformation,
+ final AxEvents events) {
+ super(key, keyInformation);
+ Assertions.argumentNotNull(events, "events may not be null");
+
+ this.schemas = schemas;
+ this.events = events;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#register()
+ */
+ @Override
+ public void register() {
+ super.register();
+ ModelService.registerModel(AxContextSchemas.class, getSchemas());
+ ModelService.registerModel(AxEvents.class, getEvents());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#getKeys()
+ */
+ @Override
+ public List<AxKey> getKeys() {
+ final List<AxKey> keyList = super.getKeys();
+
+ keyList.addAll(schemas.getKeys());
+ keyList.addAll(events.getKeys());
+
+ return keyList;
+ }
+
+ /**
+ * Gets the context schemas.
+ *
+ * @return the context schemas
+ */
+ public AxContextSchemas getSchemas() {
+ return schemas;
+ }
+
+ /**
+ * Sets the context schemas.
+ *
+ * @param schemas the context schemas
+ */
+ public void setSchemas(final AxContextSchemas schemas) {
+ Assertions.argumentNotNull(schemas, "schemas may not be null");
+ this.schemas = schemas;
+ }
+
+ /**
+ * Gets the events from the model.
+ *
+ * @return the events
+ */
+ public AxEvents getEvents() {
+ return events;
+ }
+
+ /**
+ * Sets the events in the model.
+ *
+ * @param events the events
+ */
+ public void setEvents(final AxEvents events) {
+ Assertions.argumentNotNull(events, "events may not be null");
+ this.events = events;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxModel#validate(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxValidationResult)
+ */
+ @Override
+ public AxValidationResult validate(final AxValidationResult resultIn) {
+ AxValidationResult result = resultIn;
+
+ result = super.validate(result);
+ result = schemas.validate(result);
+ return events.validate(result);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#clean()
+ */
+ @Override
+ public void clean() {
+ super.clean();
+ schemas.clean();
+ events.clean();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#toString()
+ */
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(this.getClass().getSimpleName());
+ builder.append(":(");
+ builder.append(super.toString());
+ builder.append(",schemas=");
+ builder.append(schemas);
+ builder.append(",events=");
+ builder.append(events);
+ builder.append(")");
+ return builder.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public AxConcept copyTo(final AxConcept targetObject) {
+ Assertions.argumentNotNull(targetObject, "target may not be null");
+
+ final Object copyObject = targetObject;
+ Assertions.instanceOf(copyObject, AxEventModel.class);
+
+ final AxEventModel copy = ((AxEventModel) copyObject);
+ super.copyTo(targetObject);
+ copy.setSchemas(new AxContextSchemas(schemas));
+ copy.setEvents(new AxEvents(events));
+
+ return copy;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + super.hashCode();
+ result = prime * result + schemas.hashCode();
+ result = prime * result + events.hashCode();
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxModel#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ throw new IllegalArgumentException("comparison object may not be null");
+ }
+
+ if (this == obj) {
+ return true;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ final AxEventModel other = (AxEventModel) obj;
+ if (!super.equals(other)) {
+ return false;
+ }
+ if (!schemas.equals(other.schemas)) {
+ return false;
+ }
+ return events.equals(other.events);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxModel#compareTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public int compareTo(final AxConcept otherObj) {
+ Assertions.argumentNotNull(otherObj, "comparison object may not be null");
+
+ if (this == otherObj) {
+ return 0;
+ }
+ if (getClass() != otherObj.getClass()) {
+ return this.hashCode() - otherObj.hashCode();
+ }
+
+ final AxEventModel other = (AxEventModel) otherObj;
+ if (!super.equals(other)) {
+ return super.compareTo(other);
+ }
+ if (!schemas.equals(other.schemas)) {
+ return schemas.compareTo(other.schemas);
+ }
+ return events.compareTo(other.events);
+ }
+}
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java
new file mode 100644
index 000000000..df398c2c9
--- /dev/null
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java
@@ -0,0 +1,420 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.concepts;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.NavigableMap;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.persistence.CascadeType;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetterImpl;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.utilities.Assertions;
+
+/**
+ * This class is an event container and holds a map of the events for an entire Apex model. All Apex models that use
+ * events must have an {@link AxEvents} field. The {@link AxEvents} class implements the helper methods of the
+ * {@link AxConceptGetter} interface to allow {@link AxEvents} instances to be retrieved by calling methods directly on
+ * this class without referencing the contained map.
+ * <p>
+ * Validation checks that the container key is not null. An error is issued if no events are defined in the container.
+ * Each event entry is checked to ensure that its key and value are not null and that the key matches the key in the map
+ * value. Each event entry is then validated individually.
+ */
+@Entity
+@Table(name = "AxEvents")
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "AxEvents", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "key", "eventMap" })
+
+public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> {
+ private static final long serialVersionUID = 4290442590545820316L;
+
+ @EmbeddedId
+ @XmlElement(name = "key", required = true)
+ private AxArtifactKey key;
+
+ // @formatter:off
+ @ManyToMany(cascade = CascadeType.ALL)
+ @JoinTable(
+ joinColumns = { @JoinColumn(name = "eventMapName", referencedColumnName = "name"),
+ @JoinColumn(name = "eventMapVersion", referencedColumnName = "version") },
+ inverseJoinColumns = { @JoinColumn(name = "eventName", referencedColumnName = "name"),
+ @JoinColumn(name = "eventVersion", referencedColumnName = "version") })
+ @XmlElement(required = true)
+ private Map<AxArtifactKey, AxEvent> eventMap;
+ // @formatter:on
+
+ /**
+ * The Default Constructor creates a {@link AxEvents} object with a null artifact key and creates an empty event
+ * map.
+ */
+ public AxEvents() {
+ this(new AxArtifactKey());
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param copyConcept the concept to copy from
+ */
+ public AxEvents(final AxEvents copyConcept) {
+ super(copyConcept);
+ }
+
+ /**
+ * The Key Constructor creates a {@link AxEvents} object with the given artifact key and creates an empty event map.
+ *
+ * @param key the event container key
+ */
+ public AxEvents(final AxArtifactKey key) {
+ this(key, new TreeMap<AxArtifactKey, AxEvent>());
+ }
+
+ /**
+ * This Constructor creates an event container with all of its fields defined.
+ *
+ * @param key the event container key
+ * @param eventMap the events to be stored in the event container
+ */
+ public AxEvents(final AxArtifactKey key, final Map<AxArtifactKey, AxEvent> eventMap) {
+ super();
+ Assertions.argumentNotNull(key, "key may not be null");
+ Assertions.argumentNotNull(eventMap, "eventMap may not be null");
+
+ this.key = key;
+ this.eventMap = new TreeMap<>();
+ this.eventMap.putAll(eventMap);
+ }
+
+ /**
+ * When a model is unmarshalled from disk or from the database, the event map is returned as a raw hash map. This
+ * method is called by JAXB after unmarshaling and is used to convert the hash map to a {@link NavigableMap} so that
+ * it will work with the {@link AxConceptGetter} interface.
+ *
+ * @param u the unmarshaler that is unmarshaling the model
+ * @param parent the parent object of this object in the unmarshaler
+ */
+ public void afterUnmarshal(final Unmarshaller u, final Object parent) {
+ // The map must be navigable to allow name and version searching, unmarshaling returns a hash map
+ final NavigableMap<AxArtifactKey, AxEvent> navigableEventMap = new TreeMap<>();
+ navigableEventMap.putAll(eventMap);
+ eventMap = navigableEventMap;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
+ */
+ @Override
+ public AxArtifactKey getKey() {
+ return key;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ */
+ @Override
+ public List<AxKey> getKeys() {
+ final List<AxKey> keyList = key.getKeys();
+
+ for (final AxEvent event : eventMap.values()) {
+ keyList.addAll(event.getKeys());
+ }
+
+ return keyList;
+ }
+
+ /**
+ * Sets the key of the event container.
+ *
+ * @param key the event container key
+ */
+ public void setKey(final AxArtifactKey key) {
+ Assertions.argumentNotNull(key, "key may not be null");
+ this.key = key;
+ }
+
+ /**
+ * Gets the event map containing the events in the event container.
+ *
+ * @return the event map with all the events in the event container
+ */
+ public Map<AxArtifactKey, AxEvent> getEventMap() {
+ return eventMap;
+ }
+
+ /**
+ * Sets the event map containing the events in the event container.
+ *
+ * @param eventMap the event map containing the events in the event container
+ */
+ public void setEventMap(final Map<AxArtifactKey, AxEvent> eventMap) {
+ Assertions.argumentNotNull(eventMap, "eventMap may not be null");
+ this.eventMap = new TreeMap<>();
+ this.eventMap.putAll(eventMap);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxValidationResult)
+ */
+ @Override
+ public AxValidationResult validate(final AxValidationResult resultIn) {
+ AxValidationResult result = resultIn;
+
+ if (key.equals(AxArtifactKey.getNullKey())) {
+ result.addValidationMessage(
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ }
+
+ result = key.validate(result);
+
+ if (eventMap.size() == 0) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "eventMap may not be empty"));
+ } else {
+ for (final Entry<AxArtifactKey, AxEvent> eventEntry : eventMap.entrySet()) {
+ if (eventEntry.getKey().equals(AxArtifactKey.getNullKey())) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key on event entry " + eventEntry.getKey() + " may not be the null key"));
+ } else if (eventEntry.getValue() == null) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "value on event entry " + eventEntry.getKey() + " may not be null"));
+ } else {
+ if (!eventEntry.getKey().equals(eventEntry.getValue().getKey())) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(),
+ ValidationResult.INVALID, "key on event entry key " + eventEntry.getKey()
+ + " does not equal event value key " + eventEntry.getValue().getKey()));
+ }
+
+ result = eventEntry.getValue().validate(result);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
+ */
+ @Override
+ public void clean() {
+ key.clean();
+ for (final Entry<AxArtifactKey, AxEvent> eventEntry : eventMap.entrySet()) {
+ eventEntry.getKey().clean();
+ eventEntry.getValue().clean();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
+ */
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(this.getClass().getSimpleName());
+ builder.append(":(");
+ builder.append("key=");
+ builder.append(key);
+ builder.append(",eventMap=");
+ builder.append(eventMap);
+ builder.append(")");
+ return builder.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public AxConcept copyTo(final AxConcept targetObject) {
+ Assertions.argumentNotNull(targetObject, "target may not be null");
+
+ final Object copyObject = targetObject;
+ Assertions.instanceOf(copyObject, AxEvents.class);
+
+ final AxEvents copy = (AxEvents) copyObject;
+ copy.setKey(new AxArtifactKey(key));
+ final Map<AxArtifactKey, AxEvent> newEventMap = new TreeMap<>();
+ for (final Entry<AxArtifactKey, AxEvent> eventMapEntry : eventMap.entrySet()) {
+ newEventMap.put(new AxArtifactKey(eventMapEntry.getKey()), new AxEvent(eventMapEntry.getValue()));
+ }
+ copy.setEventMap(newEventMap);
+
+ return copy;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + key.hashCode();
+ result = prime * result + eventMap.hashCode();
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (this == obj) {
+ return true;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ final AxEvents other = (AxEvents) obj;
+ if (!key.equals(other.key)) {
+ return false;
+ }
+ return eventMap.equals(other.eventMap);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ public int compareTo(final AxConcept otherObj) {
+ if (otherObj == null) {
+ return -1;
+ }
+ if (this == otherObj) {
+ return 0;
+ }
+ if (getClass() != otherObj.getClass()) {
+ return this.hashCode() - otherObj.hashCode();
+ }
+
+ final AxEvents other = (AxEvents) otherObj;
+ if (!key.equals(other.key)) {
+ return key.compareTo(other.key);
+ }
+ if (!eventMap.equals(other.eventMap)) {
+ return (eventMap.hashCode() - other.eventMap.hashCode());
+ }
+
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(org.onap.policy.apex.model.basicmodel.
+ * concepts. AxArtifactKey)
+ */
+ @Override
+ public AxEvent get(final AxArtifactKey conceptKey) {
+ return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).get(conceptKey);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(java.lang.String)
+ */
+ @Override
+ public AxEvent get(final String conceptKeyName) {
+ return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).get(conceptKeyName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#get(java.lang.String, java.lang.String)
+ */
+ @Override
+ public AxEvent get(final String conceptKeyName, final String conceptKeyVersion) {
+ return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).get(conceptKeyName,
+ conceptKeyVersion);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String)
+ */
+ @Override
+ public Set<AxEvent> getAll(final String conceptKeyName) {
+ return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).getAll(conceptKeyName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConceptGetter#getAll(java.lang.String, java.lang.String)
+ */
+ @Override
+ public Set<AxEvent> getAll(final String conceptKeyName, final String conceptKeyVersion) {
+ return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).getAll(conceptKeyName,
+ conceptKeyVersion);
+ }
+}
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java
new file mode 100644
index 000000000..4aee0ebca
--- /dev/null
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java
@@ -0,0 +1,406 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.concepts;
+
+import java.util.List;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyUse;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
+import org.onap.policy.apex.model.utilities.Assertions;
+
+/**
+ * In Apex, a field is an input or output parameter to or from a concept. For example, the parameters of an event are
+ * fields and the input and output of a task is defined as a collection of fields.
+ * <p>
+ * A field has an {@link AxReferenceKey} key that defines its name and parent, and a {@link AxArtifactKey} key to a
+ * context schema that defines the structure of the data atom that holds the value of the field. Fields can be specified
+ * as being optional but are mandatory by default.
+ * <p>
+ * Validation checks that the field key and the field schema reference key are not null.
+ */
+@Entity
+@Table(name = "AxField")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement(name = "apexField", namespace = "http://www.onap.org/policy/apex-pdp")
+@XmlType(name = "AxField", namespace = "http://www.onap.org/policy/apex-pdp",
+ propOrder = { "key", "fieldSchemaKey", "optional" })
+
+public class AxField extends AxConcept {
+ private static final String KEY_MAY_NOT_BE_NULL = "key may not be null";
+ private static final String FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL = "fieldSchemaKey may not be null";
+
+ private static final long serialVersionUID = -6443016863162692288L;
+
+ private static final int HASH_PRIME_0 = 1231;
+ private static final int HASH_PRIME_1 = 1237;
+
+ @EmbeddedId()
+ @XmlElement(name = "key", required = true)
+ @XmlJavaTypeAdapter(AxReferenceKeyAdapter.class)
+ private AxReferenceKey key;
+
+ // @formatter:off
+ @Embedded
+ @AttributeOverrides({ @AttributeOverride(name = "name", column = @Column(name = "fieldSchemaName")),
+ @AttributeOverride(name = "version", column = @Column(name = "fieldSchemaVersion")) })
+ @Column(name = "fieldSchemaKey")
+ @XmlElement(required = true)
+ private AxArtifactKey fieldSchemaKey;
+ // @formatter:on
+
+ @Column(name = "optional")
+ @XmlElement(required = false)
+ private boolean optional;
+
+ /**
+ * The default constructor creates a field with a null artifact and schema key.
+ */
+ public AxField() {
+ this(new AxReferenceKey());
+ optional = false;
+ }
+
+ /**
+ * The default constructor creates a field with the given artifact key and a null schema key.
+ *
+ * @param key the field key
+ */
+ public AxField(final AxReferenceKey key) {
+ this(key, new AxArtifactKey());
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param copyConcept the concept to copy from
+ */
+ public AxField(final AxField copyConcept) {
+ super(copyConcept);
+ }
+
+ /**
+ * Constructor to create the field with both its keys defined.
+ *
+ * @param key the field key
+ * @param fieldSchemaKey the key of the field schema to use for this field
+ */
+ public AxField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey) {
+ super();
+ Assertions.argumentNotNull(key, KEY_MAY_NOT_BE_NULL);
+ Assertions.argumentNotNull(fieldSchemaKey, FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL);
+
+ this.key = key;
+ this.fieldSchemaKey = fieldSchemaKey;
+ }
+
+ /**
+ * Constructor to create the field with all its fields defined.
+ *
+ * @param key the field key
+ * @param fieldSchemaKey the key of the field schema to use for this field
+ * @param optional true if this field is optional
+ */
+ public AxField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey, final boolean optional) {
+ super();
+ Assertions.argumentNotNull(key, KEY_MAY_NOT_BE_NULL);
+ Assertions.argumentNotNull(fieldSchemaKey, FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL);
+
+ this.key = key;
+ this.fieldSchemaKey = fieldSchemaKey;
+ this.optional = optional;
+ }
+
+ /**
+ * Constructor to create the field with the local name of its reference key defined and its schema key defined.
+ *
+ * @param localName the local name of the field reference key
+ * @param fieldSchemaKey the key of the field schema to use for this field
+ */
+ public AxField(final String localName, final AxArtifactKey fieldSchemaKey) {
+ super();
+ Assertions.argumentNotNull(localName, "localName may not be null");
+ Assertions.argumentNotNull(fieldSchemaKey, FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL);
+
+ key = new AxReferenceKey();
+ key.setLocalName(localName);
+ this.fieldSchemaKey = fieldSchemaKey;
+ }
+
+ /**
+ * Constructor to create the field with the local name of its reference key defined, its schema key and optionality
+ * defined.
+ *
+ * @param localName the local name of the field reference key
+ * @param fieldSchemaKey the key of the field schema to use for this field
+ * @param optional true if this field is optional
+ */
+ public AxField(final String localName, final AxArtifactKey fieldSchemaKey, final boolean optional) {
+ super();
+ Assertions.argumentNotNull(localName, "localName may not be null");
+ Assertions.argumentNotNull(fieldSchemaKey, FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL);
+
+ key = new AxReferenceKey();
+ key.setLocalName(localName);
+ this.fieldSchemaKey = fieldSchemaKey;
+ this.optional = optional;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
+ */
+ @Override
+ public AxReferenceKey getKey() {
+ return key;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
+ */
+ @Override
+ public List<AxKey> getKeys() {
+ final List<AxKey> keyList = key.getKeys();
+ keyList.add(new AxKeyUse(fieldSchemaKey));
+ return keyList;
+ }
+
+ /**
+ * Sets the reference key of the field.
+ *
+ * @param key the field reference key
+ */
+ public void setKey(final AxReferenceKey key) {
+ Assertions.argumentNotNull(key, KEY_MAY_NOT_BE_NULL);
+ this.key = key;
+ }
+
+ /**
+ * Gets the key of the field schema.
+ *
+ * @return the field schema key
+ */
+ public AxArtifactKey getSchema() {
+ return fieldSchemaKey;
+ }
+
+ /**
+ * Sets the key of the field schema.
+ *
+ * @param schema the field schema key
+ */
+ public void setSchema(final AxArtifactKey schema) {
+ Assertions.argumentNotNull(schema, "schema may not be null");
+ this.fieldSchemaKey = schema;
+ }
+
+ /**
+ * Gets the optionality of the field.
+ *
+ * @return the field optional flag
+ */
+ public boolean getOptional() {
+ return optional;
+ }
+
+ /**
+ * Sets the optionality of the field.
+ *
+ * @param optional the optionality of the field
+ */
+ public void setOptional(final boolean optional) {
+ this.optional = optional;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxValidationResult)
+ */
+ @Override
+ public AxValidationResult validate(final AxValidationResult resultIn) {
+ AxValidationResult result = resultIn;
+
+ if (key.equals(AxReferenceKey.getNullKey())) {
+ result.addValidationMessage(
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ }
+
+ result = key.validate(result);
+
+ if (fieldSchemaKey.equals(AxArtifactKey.getNullKey())) {
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "fieldSchemaKey is a null key: " + fieldSchemaKey));
+ }
+ return fieldSchemaKey.validate(result);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
+ */
+ @Override
+ public void clean() {
+ key.clean();
+ fieldSchemaKey.clean();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
+ */
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(this.getClass().getSimpleName());
+ builder.append(":(");
+ builder.append("key=");
+ builder.append(key);
+ builder.append(",fieldSchemaKey=");
+ builder.append(fieldSchemaKey);
+ builder.append(",optional=");
+ builder.append(optional);
+ builder.append(")");
+ return builder.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+ * AxConcept)
+ */
+ @Override
+ public AxConcept copyTo(final AxConcept targetObject) {
+ Assertions.argumentNotNull(targetObject, "target may not be null");
+
+ final Object copyObject = targetObject;
+ Assertions.instanceOf(copyObject, AxField.class);
+
+ final AxField copy = ((AxField) copyObject);
+ copy.setKey(new AxReferenceKey(key));
+ copy.setSchema(new AxArtifactKey(fieldSchemaKey));
+ copy.setOptional(optional);
+ return copy;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + key.hashCode();
+ result = prime * result + fieldSchemaKey.hashCode();
+ result = prime * result + (optional ? HASH_PRIME_0 : HASH_PRIME_1);
+ return result;
+ }
+
+ /*
+ * (nonJavadoc)
+ *
+ * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (this == obj) {
+ return true;
+ }
+
+ if (!(obj instanceof AxField)) {
+ return false;
+ }
+
+ final AxField other = (AxField) obj;
+ if (!key.getLocalName().equals(other.key.getLocalName())) {
+ return false;
+ }
+ if (optional != other.optional) {
+ return false;
+ }
+ return fieldSchemaKey.equals(other.fieldSchemaKey);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ public int compareTo(final AxConcept otherObj) {
+ if (otherObj == null) {
+ return 1;
+ }
+ if (this == otherObj) {
+ return 0;
+ }
+ if (!(otherObj instanceof AxField)) {
+ return this.hashCode() - otherObj.hashCode();
+ }
+
+ final AxField other = (AxField) otherObj;
+ if (!key.getLocalName().equals(other.key.getLocalName())) {
+ return key.getLocalName().compareTo(other.key.getLocalName());
+ }
+ if (optional != other.optional) {
+ return (optional ? 1 : -1);
+ }
+ return fieldSchemaKey.compareTo(other.fieldSchemaKey);
+ }
+}
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java
new file mode 100644
index 000000000..e7a9a2af5
--- /dev/null
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.concepts;
+
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+
+/**
+ * This class specializes the {@link AxField} class for use as input fields on events.
+ */
+@Entity
+@Table(name = "AxInputField")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement(name = "apexInputField", namespace = "http://www.onap.org/policy/apex-pdp")
+@XmlType(name = "AxInputField", namespace = "http://www.onap.org/policy/apex-pdp")
+
+public class AxInputField extends AxField {
+ private static final long serialVersionUID = 2090324845463750391L;
+
+ /**
+ * The default constructor creates a field with a null artifact and schema key.
+ */
+ public AxInputField() {
+ super();
+ }
+
+ /**
+ * The default constructor creates a field with the given artifact key and a null schema key.
+ *
+ * @param key the field key
+ */
+ public AxInputField(final AxReferenceKey key) {
+ super(key);
+ }
+
+ /**
+ * Constructor to create the field with both its keys defined.
+ *
+ * @param key the field key
+ * @param fieldSchemaKey the key of the field schema to use for this field
+ */
+ public AxInputField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey) {
+ super(key, fieldSchemaKey);
+ }
+
+ /**
+ * Constructor to create the field with both its keys defined and optional flag specified.
+ *
+ * @param key the field key
+ * @param fieldSchemaKey the key of the field schema to use for this field
+ * @param optional true if the task field is optional, false otherwise
+ */
+ public AxInputField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey, final boolean optional) {
+ super(key, fieldSchemaKey, optional);
+ }
+
+ /**
+ * Constructor to create the field with the local name of its reference key defined and its schema key defined.
+ *
+ * @param localName the local name of the field reference key
+ * @param fieldSchemaKey the key of the field schema to use for this field
+ */
+ public AxInputField(final String localName, final AxArtifactKey fieldSchemaKey) {
+ super(localName, fieldSchemaKey);
+ }
+
+ /**
+ * Copy constructor, create an input field as a copy of another input field.
+ *
+ * @param field the input field to copy from
+ */
+ public AxInputField(final AxInputField field) {
+ super(new AxReferenceKey(field.getKey()), new AxArtifactKey(field.getSchema()));
+ }
+}
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java
new file mode 100644
index 000000000..1dd2ecb7a
--- /dev/null
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.concepts;
+
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+
+/**
+ * This class specializes the {@link AxField} class for use as output fields on events.
+ */
+@Entity
+@Table(name = "AxOutputField")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement(name = "apexOutputField", namespace = "http://www.onap.org/policy/apex-pdp")
+@XmlType(name = "AxOutputField", namespace = "http://www.onap.org/policy/apex-pdp")
+
+public class AxOutputField extends AxField {
+ private static final long serialVersionUID = 2090324845463750391L;
+
+ /**
+ * The default constructor creates a field with a null artifact and schema key.
+ */
+ public AxOutputField() {
+ super();
+ }
+
+ /**
+ * The default constructor creates a field with the given artifact key and a null schema key.
+ *
+ * @param key the field key
+ */
+ public AxOutputField(final AxReferenceKey key) {
+ super(key);
+ }
+
+ /**
+ * Constructor to create the field with both its keys defined.
+ *
+ * @param key the field key
+ * @param fieldSchemaKey the key of the field schema to use for this field
+ */
+ public AxOutputField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey) {
+ super(key, fieldSchemaKey);
+ }
+
+ /**
+ * Constructor to create the field with both its keys defined and optional flag specified.
+ *
+ * @param key the field key
+ * @param fieldSchemaKey the key of the field schema to use for this field
+ * @param optional true if the task field is optional, false otherwise
+ */
+ public AxOutputField(final AxReferenceKey key, final AxArtifactKey fieldSchemaKey, final boolean optional) {
+ super(key, fieldSchemaKey, optional);
+ }
+
+ /**
+ * Constructor to create the field with the local name of its reference key defined and its schema key defined.
+ *
+ * @param localName the local name of the field reference key
+ * @param fieldSchemaKey the key of the field schema to use for this field
+ */
+ public AxOutputField(final String localName, final AxArtifactKey fieldSchemaKey) {
+ super(localName, fieldSchemaKey);
+ }
+
+ /**
+ * Copy constructor, create an output field as a copy of another output field.
+ *
+ * @param field the output field to copy from
+ */
+ public AxOutputField(final AxOutputField field) {
+ super(new AxReferenceKey(field.getKey()), new AxArtifactKey(field.getSchema()));
+ }
+}
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java
new file mode 100644
index 000000000..7b20b3939
--- /dev/null
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+/**
+ * Contains the concepts required to manage events in APEX. It defines the main Apex concepts of events and fields.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+
+@XmlSchema(namespace = "http://www.onap.org/policy/apex-pdp", elementFormDefault = XmlNsForm.QUALIFIED,
+ xmlns = { @XmlNs(namespaceURI = "http://www.onap.org/policy/apex-pdp", prefix = "") })
+
+package org.onap.policy.apex.model.eventmodel.concepts;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEventModel.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEventModel.java
new file mode 100644
index 000000000..dbff0666d
--- /dev/null
+++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEventModel.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.concepts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
+import org.onap.policy.apex.model.eventmodel.concepts.AxEventModel;
+import org.onap.policy.apex.model.eventmodel.concepts.AxEvents;
+
+/**
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class TestEventModel {
+
+ @Test
+ public void testEventModel() {
+ assertNotNull(new AxEventModel());
+ assertNotNull(new AxEventModel(new AxArtifactKey()));
+ assertNotNull(
+ new AxEventModel(new AxArtifactKey(), new AxContextSchemas(), new AxKeyInformation(), new AxEvents()));
+
+ final AxArtifactKey modelKey = new AxArtifactKey("ModelKey", "0.0.1");
+ final AxArtifactKey schemasKey = new AxArtifactKey("SchemasKey", "0.0.1");
+ final AxArtifactKey eventsKey = new AxArtifactKey("EventsKey", "0.0.1");
+ final AxArtifactKey keyInfoKey = new AxArtifactKey("SchemasKey", "0.0.1");
+ final AxEventModel model = new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
+ new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey));
+ model.register();
+
+ model.clean();
+ assertNotNull(model);
+ assertEquals("AxEventModel:(AxEventModel:(key=AxArtifactKey:(nam", model.toString().substring(0, 50));
+
+ final AxEventModel clonedModel = new AxEventModel(model);
+
+ assertFalse(model.hashCode() == 0);
+
+ assertTrue(model.equals(model));
+ assertTrue(model.equals(clonedModel));
+ assertFalse(model.equals("Hello"));
+ assertFalse(model.equals(new AxEventModel(new AxArtifactKey())));
+ assertFalse(model.equals(new AxEventModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey),
+ new AxEvents(eventsKey))));
+ assertFalse(model.equals(new AxEventModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(),
+ new AxEvents(eventsKey))));
+ assertFalse(model.equals(new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
+ new AxKeyInformation(keyInfoKey), new AxEvents())));
+ assertTrue(model.equals(new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
+ new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey))));
+
+ assertEquals(0, model.compareTo(model));
+ assertEquals(0, model.compareTo(clonedModel));
+ assertNotEquals(0, model.compareTo(new AxArtifactKey()));
+ assertNotEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(),
+ new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey))));
+ assertNotEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
+ new AxKeyInformation(), new AxEvents(eventsKey))));
+ assertNotEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
+ new AxKeyInformation(keyInfoKey), new AxEvents())));
+ assertEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
+ new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey))));
+ }
+}
diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java
new file mode 100644
index 000000000..5456dfad8
--- /dev/null
+++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestEvents.java
@@ -0,0 +1,298 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.concepts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.junit.Test;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
+import org.onap.policy.apex.model.eventmodel.concepts.AxEvents;
+import org.onap.policy.apex.model.eventmodel.concepts.AxField;
+
+/**
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class TestEvents {
+
+ @Test
+ public void testEvents() {
+ final TreeMap<String, AxField> parameterMap = new TreeMap<>();
+ final TreeMap<String, AxField> parameterMapEmpty = new TreeMap<>();
+
+ assertNotNull(new AxEvent());
+ assertNotNull(new AxEvent(new AxArtifactKey()));
+ assertNotNull(new AxEvent(new AxArtifactKey(), "namespace"));
+ assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target"));
+ assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target"));
+ assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target", parameterMap));
+
+ final AxEvent event = new AxEvent();
+
+ final AxArtifactKey eventKey = new AxArtifactKey("EventName", "0.0.1");
+ event.setKey(eventKey);
+ assertEquals("EventName:0.0.1", event.getKey().getID());
+ assertEquals("EventName:0.0.1", event.getKeys().get(0).getID());
+
+ event.setNameSpace("namespace");
+ assertEquals("namespace", event.getNameSpace());
+
+ event.setSource("source");
+ assertEquals("source", event.getSource());
+
+ event.setTarget("target");
+ assertEquals("target", event.getTarget());
+
+ event.setParameterMap(parameterMap);
+ assertEquals(0, event.getParameterMap().size());
+
+ final AxField eventField =
+ new AxField(new AxReferenceKey(eventKey, "Field0"), new AxArtifactKey("Field0Schema", "0.0.1"));
+ event.getParameterMap().put(eventField.getKey().getLocalName(), eventField);
+ assertEquals(1, event.getParameterMap().size());
+
+ final AxField eventFieldBadParent =
+ new AxField(new AxReferenceKey(new AxArtifactKey("OtherEvent", "0.0.01"), "Field0"),
+ new AxArtifactKey("Field0Schema", "0.0.1"));
+
+ final AxArtifactKey newEventKey = new AxArtifactKey("NewEventName", "0.0.1");
+ event.setKey(newEventKey);
+ assertEquals("NewEventName:0.0.1", event.getKey().getID());
+ assertEquals("NewEventName:0.0.1", event.getKeys().get(0).getID());
+ assertEquals("NewEventName:0.0.1",
+ event.getParameterMap().get("Field0").getKey().getParentArtifactKey().getID());
+ event.setKey(eventKey);
+ assertEquals("EventName:0.0.1", event.getKey().getID());
+ assertEquals("EventName:0.0.1", event.getKeys().get(0).getID());
+
+ assertTrue("Field0", event.getFields().contains(eventField));
+ assertTrue(event.hasFields(new TreeSet<AxField>(parameterMap.values())));
+
+ AxValidationResult result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult());
+
+ event.setKey(AxArtifactKey.getNullKey());
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ event.setKey(eventKey);
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ event.setNameSpace("");
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.WARNING, result.getValidationResult());
+
+ event.setNameSpace("namespace");
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ event.setSource("");
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.OBSERVATION, result.getValidationResult());
+
+ event.setSource("source");
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ event.setTarget("");
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.OBSERVATION, result.getValidationResult());
+
+ event.setTarget("target");
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ event.getParameterMap().put(AxKey.NULL_KEY_NAME, null);
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ event.getParameterMap().remove(AxKey.NULL_KEY_NAME);
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ event.getParameterMap().put("NullField", null);
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ event.getParameterMap().remove("NullField");
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ event.getParameterMap().put("NullField", eventField);
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ event.getParameterMap().remove("NullField");
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ event.getParameterMap().put("BadParent", eventFieldBadParent);
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ event.getParameterMap().remove("BadParent");
+ result = new AxValidationResult();
+ result = event.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ event.clean();
+ event.afterUnmarshal(null, null);
+
+ final AxEvent clonedEvent = new AxEvent(event);
+ assertEquals("AxEvent:(key=AxArtifactKey:(name=EventName,version=0.0.1),nameSpace=namespace",
+ clonedEvent.toString().substring(0, 77));
+
+ assertFalse(event.hashCode() == 0);
+
+ assertTrue(event.equals(event));
+ assertTrue(event.equals(clonedEvent));
+ assertFalse(event.equals(null));
+ assertFalse(event.equals("Hello"));
+ assertFalse(
+ event.equals(new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap)));
+ assertFalse(event.equals(new AxEvent(eventKey, "namespace1", "source", "target", parameterMap)));
+ assertFalse(event.equals(new AxEvent(eventKey, "namespace", "source2", "target", parameterMap)));
+ assertFalse(event.equals(new AxEvent(eventKey, "namespace", "source", "target3", parameterMap)));
+ assertFalse(event.equals(new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty)));
+ assertTrue(event.equals(new AxEvent(eventKey, "namespace", "source", "target", parameterMap)));
+
+ assertEquals(0, event.compareTo(event));
+ assertEquals(0, event.compareTo(clonedEvent));
+ assertNotEquals(0, event.compareTo(new AxArtifactKey()));
+ assertNotEquals(0, event.compareTo(null));
+ assertNotEquals(0, event
+ .compareTo(new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap)));
+ assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace1", "source", "target", parameterMap)));
+ assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source2", "target", parameterMap)));
+ assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target3", parameterMap)));
+ assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty)));
+ assertEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMap)));
+
+ assertNotNull(event.getKeys());
+
+ final AxEvents events = new AxEvents();
+ result = new AxValidationResult();
+ result = events.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ // Invalid, no events in event map
+ events.setKey(new AxArtifactKey("EventsKey", "0.0.1"));
+ assertEquals("EventsKey:0.0.1", events.getKey().getID());
+
+ result = new AxValidationResult();
+ result = events.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ events.getEventMap().put(eventKey, event);
+ result = new AxValidationResult();
+ result = events.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ events.getEventMap().put(AxArtifactKey.getNullKey(), null);
+ result = new AxValidationResult();
+ result = events.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ events.getEventMap().remove(AxArtifactKey.getNullKey());
+ result = new AxValidationResult();
+ result = events.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ events.getEventMap().put(new AxArtifactKey("NullValueKey", "0.0.1"), null);
+ result = new AxValidationResult();
+ result = events.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ events.getEventMap().remove(new AxArtifactKey("NullValueKey", "0.0.1"));
+ result = new AxValidationResult();
+ result = events.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ events.getEventMap().put(new AxArtifactKey("BadEventKey", "0.0.1"), event);
+ result = new AxValidationResult();
+ result = events.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ events.getEventMap().remove(new AxArtifactKey("BadEventKey", "0.0.1"));
+ result = new AxValidationResult();
+ result = events.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ events.clean();
+ events.afterUnmarshal(null, null);
+
+ final AxEvents clonedEvents = new AxEvents(events);
+ assertEquals("AxEvents:(key=AxArtifactKey:(name=EventsKey,version=0.0.1),e",
+ clonedEvents.toString().substring(0, 60));
+
+ assertFalse(events.hashCode() == 0);
+
+ assertTrue(events.equals(events));
+ assertTrue(events.equals(clonedEvents));
+ assertFalse(events.equals(null));
+ assertFalse(events.equals("Hello"));
+ assertFalse(events.equals(new AxEvents(new AxArtifactKey())));
+
+ assertEquals(0, events.compareTo(events));
+ assertEquals(0, events.compareTo(clonedEvents));
+ assertNotEquals(0, events.compareTo(null));
+ assertNotEquals(0, events.compareTo(new AxArtifactKey()));
+ assertNotEquals(0, events.compareTo(new AxEvents(new AxArtifactKey())));
+
+ clonedEvents.get(eventKey).setSource("AnotherSource");
+ assertNotEquals(0, events.compareTo(clonedEvents));
+
+ assertEquals(events.getKey(), events.getKeys().get(0));
+
+ assertEquals("EventName", events.get("EventName").getKey().getName());
+ assertEquals("EventName", events.get("EventName", "0.0.1").getKey().getName());
+ assertEquals(1, events.getAll("EventName", "0.0.1").size());
+ assertEquals(0, events.getAll("NonExistantEventsName").size());
+ }
+}
diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java
new file mode 100644
index 000000000..11b8b745e
--- /dev/null
+++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/TestField.java
@@ -0,0 +1,136 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.concepts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
+import org.onap.policy.apex.model.eventmodel.concepts.AxField;
+import org.onap.policy.apex.model.eventmodel.concepts.AxInputField;
+import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField;
+
+/**
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class TestField {
+
+ @Test
+ public void testField() {
+ assertNotNull(new AxField());
+ assertNotNull(new AxField(new AxReferenceKey()));
+ assertNotNull(new AxField(new AxReferenceKey(), new AxArtifactKey()));
+ assertNotNull(new AxField(new AxReferenceKey(), new AxArtifactKey(), false));
+ assertNotNull(new AxField("LocalName", new AxArtifactKey(), false));
+ assertNotNull(new AxField("LocalName", new AxArtifactKey()));
+ assertNotNull(new AxField("LocalName", new AxArtifactKey(), false));
+
+ assertNotNull(new AxInputField());
+ assertNotNull(new AxInputField(new AxReferenceKey()));
+ assertNotNull(new AxInputField(new AxReferenceKey(), new AxArtifactKey()));
+ assertNotNull(new AxInputField(new AxReferenceKey(), new AxArtifactKey(), true));
+ assertNotNull(new AxInputField("LocalName", new AxArtifactKey()));
+ assertNotNull(new AxInputField(new AxInputField()));
+
+ assertNotNull(new AxOutputField());
+ assertNotNull(new AxOutputField(new AxReferenceKey()));
+ assertNotNull(new AxOutputField(new AxReferenceKey(), new AxArtifactKey()));
+ assertNotNull(new AxOutputField(new AxReferenceKey(), new AxArtifactKey(), false));
+ assertNotNull(new AxOutputField("LocalName", new AxArtifactKey()));
+ assertNotNull(new AxOutputField(new AxOutputField()));
+
+ final AxField field = new AxField();
+
+ final AxReferenceKey fieldKey = new AxReferenceKey("FieldName", "0.0.1", "PLN", "LN");
+ field.setKey(fieldKey);
+ assertEquals("FieldName:0.0.1:PLN:LN", field.getKey().getID());
+ assertEquals("FieldName:0.0.1:PLN:LN", field.getKeys().get(0).getID());
+
+ final AxArtifactKey schemaKey = new AxArtifactKey("SchemaName", "0.0.1");
+ field.setSchema(schemaKey);
+ assertEquals("SchemaName:0.0.1", field.getSchema().getID());
+
+ assertEquals(false, field.getOptional());
+ field.setOptional(true);
+ assertEquals(true, field.getOptional());
+
+ AxValidationResult result = new AxValidationResult();
+ result = field.validate(result);
+ assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult());
+
+ field.setKey(AxReferenceKey.getNullKey());
+ result = new AxValidationResult();
+ result = field.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ field.setKey(fieldKey);
+ result = new AxValidationResult();
+ result = field.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ field.setSchema(AxArtifactKey.getNullKey());
+ result = new AxValidationResult();
+ result = field.validate(result);
+ assertEquals(ValidationResult.INVALID, result.getValidationResult());
+
+ field.setSchema(schemaKey);
+ result = new AxValidationResult();
+ result = field.validate(result);
+ assertEquals(ValidationResult.VALID, result.getValidationResult());
+
+ field.clean();
+
+ final AxField clonedField = new AxField(field);
+ assertEquals(
+ "AxField:(key=AxReferenceKey:(parentKeyName=FieldName,parentKeyVersion=0.0.1,parentLocalName=PLN,localName=LN),fieldSchemaKey=AxArtifactKey:(name=SchemaName,version=0.0.1),optional=true)",
+ clonedField.toString());
+
+ assertFalse(field.hashCode() == 0);
+
+ assertTrue(field.equals(field));
+ assertTrue(field.equals(clonedField));
+ assertFalse(field.equals(null));
+ assertFalse(field.equals("Hello"));
+ assertFalse(field.equals(new AxField(AxReferenceKey.getNullKey(), AxArtifactKey.getNullKey(), false)));
+ assertFalse(field.equals(new AxField(fieldKey, AxArtifactKey.getNullKey(), false)));
+ assertFalse(field.equals(new AxField(fieldKey, schemaKey, false)));
+ assertTrue(field.equals(new AxField(fieldKey, schemaKey, true)));
+
+ assertEquals(0, field.compareTo(field));
+ assertEquals(0, field.compareTo(clonedField));
+ assertNotEquals(0, field.compareTo(new AxArtifactKey()));
+ assertNotEquals(0, field.compareTo(null));
+ assertNotEquals(0,
+ field.compareTo(new AxField(AxReferenceKey.getNullKey(), AxArtifactKey.getNullKey(), false)));
+ assertNotEquals(0, field.compareTo(new AxField(fieldKey, AxArtifactKey.getNullKey(), false)));
+ assertNotEquals(0, field.compareTo(new AxField(fieldKey, schemaKey, false)));
+ assertEquals(0, field.compareTo(new AxField(fieldKey, schemaKey, true)));
+
+ assertNotNull(field.getKeys());
+ }
+}
diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java
new file mode 100644
index 000000000..ee2638a54
--- /dev/null
+++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModel.java
@@ -0,0 +1,184 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.handling;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.dao.DAOParameters;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
+import org.onap.policy.apex.model.eventmodel.concepts.AxEventModel;
+
+public class TestApexEventModel {
+ private Connection connection;
+ TestApexModel<AxEventModel> testApexModel;
+
+ @Before
+ public void setup() throws Exception {
+ Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
+ connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
+
+ testApexModel = new TestApexModel<AxEventModel>(AxEventModel.class, new TestApexEventModelCreator());
+ }
+
+ @After
+ public void teardown() throws Exception {
+ connection.close();
+ new File("derby.log").delete();
+ }
+
+ @Test
+ public void testModelValid() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelValid();
+ assertTrue(result.toString().equals(VALID_MODEL_STRING));
+ }
+
+ @Test
+ public void testApexModelVaidateObservation() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateObservation();
+ assertTrue(result.toString().equals(OBSERVATION_MODEL_STRING));
+ }
+
+ @Test
+ public void testApexModelVaidateWarning() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateWarning();
+ assertTrue(result.toString().equals(WARNING_MODEL_STRING));
+ }
+
+ @Test
+ public void testModelVaidateInvalidModel() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateInvalidModel();
+ assertTrue(result.toString().equals(INVALID_MODEL_STRING));
+ }
+
+ @Test
+ public void testModelVaidateMalstructured() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateMalstructured();
+ assertTrue(result.toString().equals(INVALID_MODEL_MALSTRUCTURED_STRING));
+ }
+
+ @Test
+ public void testModelWriteReadXML() throws Exception {
+ testApexModel.testApexModelWriteReadXML();
+ }
+
+ @Test
+ public void testModelWriteReadJSON() throws Exception {
+ testApexModel.testApexModelWriteReadJSON();
+ }
+
+ @Test
+ public void testModelWriteReadJPA() throws Exception {
+ final DAOParameters daoParameters = new DAOParameters();
+ daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
+ daoParameters.setPersistenceUnit("DAOTest");
+
+ testApexModel.testApexModelWriteReadJPA(daoParameters);
+ }
+
+ private static final String VALID_MODEL_STRING = "***validation of model successful***";
+
+ private static final String OBSERVATION_MODEL_STRING = "\n"
+ + "***observations noted during validation of model***\n"
+ + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "AxArtifactKey:(name=event2,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event2,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "********************************";
+
+ private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n"
+ + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n"
+ + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "AxArtifactKey:(name=event2,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n"
+ + "AxArtifactKey:(name=event2,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event2,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "********************************";
+
+ private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n"
+ + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:keyInfoMap may not be empty\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=smallEventModel,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=Schemas,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=BigIntType,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=BooleanType,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=IntType,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=MapType,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=SetType,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=StringType,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=smallEventMap,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=event0,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par0)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par2)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par3)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par4)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par5)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par6)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:duplicate key AxArtifactKey:(name=event1,version=0.0.1) found\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:duplicate key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar) found\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n"
+ + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event0,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:INVALID:parent key on parameter field AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar) does not equal event key\n"
+ + "AxArtifactKey:(name=smallEventMap,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:key on event entry key AxArtifactKey:(name=event2,version=0.0.1) does not equal event value key AxArtifactKey:(name=event1,version=0.0.1)\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:INVALID:parent key on parameter field AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar) does not equal event key\n"
+ + "********************************";
+
+ private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n"
+ + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:keyInfoMap may not be empty\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=smallEventModel,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=Schemas,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=SetType,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=smallEventMap,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:duplicate key AxArtifactKey:(name=event1,version=0.0.1) found\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:duplicate key AxReferenceKey:(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar) found\n"
+ + "AxArtifactKey:(name=smallEventModel,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:key information not found for parent key of key AxReferenceKey:(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "AxArtifactKey:(name=smallEventMap,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:key on event entry key AxArtifactKey:(name=event2,version=0.0.1) does not equal event value key AxArtifactKey:(name=event1,version=0.0.1)\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
+ + "AxArtifactKey:(name=event1,version=0.0.1):org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
+ + "********************************";
+}
diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModelCreator.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModelCreator.java
new file mode 100644
index 000000000..039d2305b
--- /dev/null
+++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/TestApexEventModelCreator.java
@@ -0,0 +1,309 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.eventmodel.handling;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
+import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
+import org.onap.policy.apex.model.eventmodel.concepts.AxEventModel;
+import org.onap.policy.apex.model.eventmodel.concepts.AxEvents;
+import org.onap.policy.apex.model.eventmodel.concepts.AxField;
+
+public class TestApexEventModelCreator implements TestApexModelCreator<AxEventModel> {
+
+ @Override
+ public AxEventModel getModel() {
+ final AxContextSchema axSchema0 =
+ new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean");
+ final AxContextSchema axSchema1 =
+ new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer");
+ final AxContextSchema axSchema2 =
+ new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String");
+ final AxContextSchema axSchema3 = new AxContextSchema(new AxArtifactKey("KeyType", "0.0.1"), "Java",
+ "org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey");
+ final AxContextSchema axSchema4 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java",
+ "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation");
+ final AxContextSchema axSchema5 =
+ new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger");
+ final AxContextSchema axSchema6 = new AxContextSchema(new AxArtifactKey("ModelType", "0.0.1"), "Java",
+ "org.onap.policy.apex.model.basicmodel.concepts.AxModel");
+
+ final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
+ dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0);
+ dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1);
+ dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2);
+ dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3);
+ dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4);
+ dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5);
+ dataTypes.getSchemasMap().put(axSchema6.getKey(), axSchema6);
+
+ final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1"));
+
+ final AxEvent event0 = new AxEvent(new AxArtifactKey("event0", "0.0.1"),
+ "org.onap.policy.apex.model.eventmodel.events", "Source", "Target");
+ event0.getParameterMap().put("par0",
+ new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey()));
+ event0.getParameterMap().put("par1",
+ new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey()));
+ event0.getParameterMap().put("par2",
+ new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey()));
+ event0.getParameterMap().put("par3",
+ new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema6.getKey()));
+ event0.getParameterMap().put("par4",
+ new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey()));
+ event0.getParameterMap().put("par5",
+ new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey()));
+ event0.getParameterMap().put("par6",
+ new AxField(new AxReferenceKey(event0.getKey(), "par6"), axSchema5.getKey()));
+ eventMap.getEventMap().put(event0.getKey(), event0);
+
+ final AxEvent event1 = new AxEvent(new AxArtifactKey("event1", "0.0.1"),
+ "org.onap.policy.apex.model.eventmodel.events", "Source", "Target");
+ event1.getParameterMap().put("theOnlyPar",
+ new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey()));
+ eventMap.getEventMap().put(event1.getKey(), event1);
+
+ final AxEvent event2 = new AxEvent(new AxArtifactKey("event2", "0.0.1"),
+ "org.onap.policy.apex.model.eventmodel.events", "Source", "Target");
+ eventMap.getEventMap().put(event2.getKey(), event2);
+
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+
+ final AxEventModel eventModel =
+ new AxEventModel(new AxArtifactKey("EventModel", "0.0.1"), dataTypes, keyInformation, eventMap);
+ keyInformation.generateKeyInfo(eventModel);
+
+ eventModel.validate(new AxValidationResult());
+ return eventModel;
+ }
+
+ @Override
+ public AxEventModel getInvalidModel() {
+ final AxContextSchema axSchema0 =
+ new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Zoolean");
+ final AxContextSchema axSchema1 =
+ new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer");
+ final AxContextSchema axSchema2 =
+ new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String");
+ final AxContextSchema axSchema3 =
+ new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set");
+ final AxContextSchema axSchema4 =
+ new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map");
+ final AxContextSchema axSchema5 =
+ new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger");
+
+ final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
+ dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0);
+ dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1);
+ dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2);
+ dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3);
+ dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4);
+ dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5);
+
+ final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1"));
+
+ final AxEvent event0 =
+ new AxEvent(new AxArtifactKey("event0", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
+ event0.getParameterMap().put("par0",
+ new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey()));
+ event0.getParameterMap().put("par1",
+ new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey()));
+ event0.getParameterMap().put("par2",
+ new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey()));
+ event0.getParameterMap().put("par3",
+ new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey()));
+ event0.getParameterMap().put("par4",
+ new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey()));
+ event0.getParameterMap().put("par5",
+ new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey()));
+ event0.getParameterMap().put("par6",
+ new AxField(new AxReferenceKey(event0.getKey(), "par6"), axSchema5.getKey()));
+ eventMap.getEventMap().put(event0.getKey(), event0);
+
+ final AxEvent event1 =
+ new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
+ event1.getParameterMap().put("theOnlyPar",
+ new AxField(new AxReferenceKey(event0.getKey(), "theOnlyPar"), axSchema3.getKey()));
+ eventMap.getEventMap().put(event1.getKey(), event1);
+
+ final AxEvent event2 =
+ new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
+ eventMap.getEventMap().put(event2.getKey(), event1);
+
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+
+ final AxEventModel eventModel =
+ new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap);
+
+ return eventModel;
+ }
+
+ @Override
+ public AxEventModel getMalstructuredModel() {
+ final AxContextSchema axSchema3 =
+ new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set");
+ final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
+ dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3);
+
+ final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1"));
+
+ final AxEvent event1 =
+ new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
+ event1.getParameterMap().put("theOnlyPar",
+ new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey()));
+ eventMap.getEventMap().put(event1.getKey(), event1);
+
+ final AxEvent event2 =
+ new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
+ eventMap.getEventMap().put(event2.getKey(), event1);
+
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+
+ final AxEventModel eventModel =
+ new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap);
+
+ eventModel.validate(new AxValidationResult());
+
+ return eventModel;
+ }
+
+ @Override
+ public AxEventModel getWarningModel() {
+ final AxContextSchema axSchema0 =
+ new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean");
+ final AxContextSchema axSchema1 =
+ new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer");
+ final AxContextSchema axSchema2 =
+ new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String");
+ final AxContextSchema axSchema3 =
+ new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set");
+ final AxContextSchema axSchema4 =
+ new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map");
+ final AxContextSchema axSchema5 =
+ new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger");
+ final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
+ dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0);
+ dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1);
+ dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2);
+ dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3);
+ dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4);
+ dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5);
+
+ final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1"));
+
+ final AxEvent event0 = new AxEvent(new AxArtifactKey("event0", "0.0.1"), "");
+ event0.getParameterMap().put("par0",
+ new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey()));
+ event0.getParameterMap().put("par1",
+ new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey()));
+ event0.getParameterMap().put("par2",
+ new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey()));
+ event0.getParameterMap().put("par3",
+ new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey()));
+ event0.getParameterMap().put("par4",
+ new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey()));
+ event0.getParameterMap().put("par5",
+ new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey()));
+ eventMap.getEventMap().put(event0.getKey(), event0);
+
+ final AxEvent event1 = new AxEvent(new AxArtifactKey("event1", "0.0.1"), "");
+ event1.getParameterMap().put("theOnlyPar",
+ new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey()));
+ eventMap.getEventMap().put(event1.getKey(), event1);
+
+ final AxEvent event2 = new AxEvent(new AxArtifactKey("event2", "0.0.1"), "");
+ eventMap.getEventMap().put(event2.getKey(), event2);
+
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+
+ final AxEventModel eventModel =
+ new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap);
+ eventModel.getKeyInformation().generateKeyInfo(eventModel);
+ eventModel.validate(new AxValidationResult());
+
+ return eventModel;
+ }
+
+ @Override
+ public AxEventModel getObservationModel() {
+ final AxContextSchema axSchema0 =
+ new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean");
+ final AxContextSchema axSchema1 =
+ new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer");
+ final AxContextSchema axSchema2 =
+ new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String");
+ final AxContextSchema axSchema3 =
+ new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set");
+ final AxContextSchema axSchema4 =
+ new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map");
+ final AxContextSchema axSchema5 =
+ new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger");
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
+ schemas.getSchemasMap().put(axSchema0.getKey(), axSchema0);
+ schemas.getSchemasMap().put(axSchema1.getKey(), axSchema1);
+ schemas.getSchemasMap().put(axSchema2.getKey(), axSchema2);
+ schemas.getSchemasMap().put(axSchema3.getKey(), axSchema3);
+ schemas.getSchemasMap().put(axSchema4.getKey(), axSchema4);
+ schemas.getSchemasMap().put(axSchema5.getKey(), axSchema5);
+
+ final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1"));
+
+ final AxEvent event0 =
+ new AxEvent(new AxArtifactKey("event0", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
+ event0.getParameterMap().put("par0",
+ new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey()));
+ event0.getParameterMap().put("par1",
+ new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey()));
+ event0.getParameterMap().put("par2",
+ new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey()));
+ event0.getParameterMap().put("par3",
+ new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey()));
+ event0.getParameterMap().put("par4",
+ new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey()));
+ event0.getParameterMap().put("par5",
+ new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey()));
+ eventMap.getEventMap().put(event0.getKey(), event0);
+
+ final AxEvent event1 =
+ new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
+ event1.getParameterMap().put("theOnlyPar",
+ new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey()));
+ eventMap.getEventMap().put(event1.getKey(), event1);
+
+ final AxEvent event2 =
+ new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
+ eventMap.getEventMap().put(event2.getKey(), event2);
+
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+
+ final AxEventModel eventModel =
+ new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), schemas, keyInformation, eventMap);
+ eventModel.getKeyInformation().generateKeyInfo(eventModel);
+ eventModel.validate(new AxValidationResult());
+
+ return eventModel;
+ }
+}
diff --git a/model/event-model/src/test/resources/META-INF/persistence.xml b/model/event-model/src/test/resources/META-INF/persistence.xml
new file mode 100644
index 000000000..db32612ab
--- /dev/null
+++ b/model/event-model/src/test/resources/META-INF/persistence.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
+ <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+
+ <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class>
+ <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.AxModel</class>
+ <class>org.onap.policy.apex.model.basicmodel.concepts.TestEntity</class>
+ <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema</class>
+ <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas</class>
+ <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum</class>
+ <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums</class>
+ <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextModel</class>
+ <class>org.onap.policy.apex.model.eventmodel.concepts.AxField</class>
+ <class>org.onap.policy.apex.model.eventmodel.concepts.AxInputField</class>
+ <class>org.onap.policy.apex.model.eventmodel.concepts.AxOutputField</class>
+ <class>org.onap.policy.apex.model.eventmodel.concepts.AxEvent</class>
+ <class>org.onap.policy.apex.model.eventmodel.concepts.AxEvents</class>
+ <class>org.onap.policy.apex.model.eventmodel.concepts.AxEventModel</class>
+
+ <properties>
+ <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
+ <property name="javax.persistence.target-database" value="Derby" />
+ <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
+
+ <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
+ <property name="eclipselink.ddl-generation.output-mode" value="database" />
+ <property name="eclipselink.logging.level" value="INFO" />
+ </properties>
+ </persistence-unit>
+</persistence>
diff --git a/model/event-model/src/test/resources/logback-test.xml b/model/event-model/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..dfafb04d9
--- /dev/null
+++ b/model/event-model/src/test/resources/logback-test.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+
+<configuration>
+
+ <contextName>Apex</contextName>
+ <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
+ <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" />
+
+ <!-- USE FOR STD OUT ONLY -->
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
+ </encoder>
+ </appender>
+
+ <root level="INFO">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <logger name="org.infinispan" level="INFO" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org.onap.policy.apex.core" level="TRACE" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>${LOG_DIR}/apex.log</file>
+ <encoder>
+ <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
+ %logger{26} - %msg %n %ex{full}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
+ <file>${LOG_DIR}/apex_ctxt.log</file>
+ <encoder>
+ <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
+ %logger{26} - %msg %n %ex{full}</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <appender-ref ref="CTXT_FILE" />
+ </logger>
+
+ <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+</configuration>
diff --git a/model/pom.xml b/model/pom.xml
index 722a44276..5e6a52ad5 100644
--- a/model/pom.xml
+++ b/model/pom.xml
@@ -25,7 +25,7 @@
<artifactId>apex-pdp</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>
-
+
<groupId>org.onap.policy.apex-pdp.model</groupId>
<artifactId>model</artifactId>
<packaging>pom</packaging>
@@ -33,9 +33,19 @@
<name>${project.artifactId}</name>
<description>The model for Apex, it comtains definitions of all Apex concepts and also has handling for Apex models.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${version.derby}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
<modules>
<module>utilities</module>
<module>basic-model</module>
<module>context-model</module>
+ <module>event-model</module>
</modules>
</project> \ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 24ac99feb..fecf5e8af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,12 +33,13 @@
<version>2.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
- <name>Apex PDP engine</name>
+ <name>policy-apex-pdp</name>
<description>Packaging for all the Apex components, the engine, the WAR service, and the editor.</description>
<properties>
<encoding>UTF-8</encoding>
<file.encoding>UTF-8</file.encoding>
+ <version.derby>10.13.1.1</version.derby>
</properties>
<distributionManagement>