diff options
Diffstat (limited to 'model/model-api/src/main')
3 files changed, 28 insertions, 13 deletions
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java index fab6ba163..8974d1fa8 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2021-2022 Bell Canada. 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. @@ -205,10 +205,11 @@ public interface ApexEditorApi { * @param target of the event, set to null to use the default value * @param uuid event UUID, set to null to generate a UUID * @param description event description, set to null to generate a description + * @param toscaPolicyState specifies TOSCA policy processing status * @return result of the operation */ ApexApiResult createEvent(final String name, final String version, final String nameSpace, final String source, - final String target, final String uuid, final String description); + final String target, final String uuid, final String description, final String toscaPolicyState); /** * Update an event. @@ -220,10 +221,11 @@ public interface ApexEditorApi { * @param target of the event, set to null to not update * @param uuid event UUID, set to null to not update * @param description event description, set to null to not update + * @param toscaPolicyState specifies TOSCA policy processing status * @return result of the operation */ ApexApiResult updateEvent(final String name, final String version, final String nameSpace, final String source, - final String target, final String uuid, final String description); + final String target, final String uuid, final String description, final String toscaPolicyState); /** * List events. @@ -900,4 +902,4 @@ public interface ApexEditorApi { */ ApexApiResult deletePolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion); -} +}
\ No newline at end of file diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java index 05976c6ed..cca9d3454 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java @@ -3,7 +3,7 @@ * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. * Modifications Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2022 Bell Canada. 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. @@ -251,8 +251,9 @@ public final class ApexModelImpl implements ApexModel { */ @Override public ApexApiResult createEvent(final String name, final String version, final String nameSpace, - final String source, final String target, final String uuid, final String description) { - return eventFacade.createEvent(name, version, nameSpace, source, target, uuid, description); + final String source, final String target, final String uuid, final String description, + final String toscaPolicyState) { + return eventFacade.createEvent(name, version, nameSpace, source, target, uuid, description, toscaPolicyState); } /** @@ -260,8 +261,9 @@ public final class ApexModelImpl implements ApexModel { */ @Override public ApexApiResult updateEvent(final String name, final String version, final String nameSpace, - final String source, final String target, final String uuid, final String description) { - return eventFacade.updateEvent(name, version, nameSpace, source, target, uuid, description); + final String source, final String target, final String uuid, final String description, + final String toscaPolicyState) { + return eventFacade.updateEvent(name, version, nameSpace, source, target, uuid, description, toscaPolicyState); } /** @@ -892,4 +894,4 @@ public final class ApexModelImpl implements ApexModel { return policyModel; } -} +}
\ No newline at end of file diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java index 0a758407b..f1f939397 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2022 Bell Canada. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,10 +86,12 @@ public class EventFacade { * @param target of the event, set to null to use the default value * @param uuid event UUID, set to null to generate a UUID * @param description event description, set to null to generate a description + * @param toscaPolicyState specifies TOSCA policy processing status * @return result of the operation */ public ApexApiResult createEvent(final String name, final String version, final String nameSpace, - final String source, final String target, final String uuid, final String description) { + final String source, final String target, final String uuid, final String description, + final String toscaPolicyState) { try { final AxArtifactKey key = new AxArtifactKey(); key.setName(name); @@ -107,6 +110,9 @@ public class EventFacade { event.setNameSpace((nameSpace != null ? nameSpace : apexProperties.getProperty("DEFAULT_EVENT_NAMESPACE"))); event.setSource((source != null ? source : apexProperties.getProperty("DEFAULT_EVENT_SOURCE"))); event.setTarget((target != null ? target : apexProperties.getProperty("DEFAULT_EVENT_TARGET"))); + if (toscaPolicyState != null) { + event.setToscaPolicyState(toscaPolicyState); + } apexModel.getPolicyModel().getEvents().getEventMap().put(key, event); @@ -130,10 +136,12 @@ public class EventFacade { * @param target of the event, set to null to not update * @param uuid event UUID, set to null to not update * @param description event description, set to null to not update + * @param toscaPolicyState specifies TOSCA policy processing status * @return result of the operation */ public ApexApiResult updateEvent(final String name, final String version, final String nameSpace, - final String source, final String target, final String uuid, final String description) { + final String source, final String target, final String uuid, final String description, + final String toscaPolicyState) { try { final AxEvent event = apexModel.getPolicyModel().getEvents().get(name, version); if (event == null) { @@ -150,6 +158,9 @@ public class EventFacade { if (target != null) { event.setTarget(target); } + if (toscaPolicyState != null) { + event.setToscaPolicyState(toscaPolicyState); + } return keyInformationFacade.updateKeyInformation(name, version, uuid, description); } catch (final Exception e) { @@ -382,4 +393,4 @@ public class EventFacade { return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } -} +}
\ No newline at end of file |