2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.openecomp.sdc.be.auditing.impl.resourceadmin;
22 import org.openecomp.sdc.be.auditing.api.AuditEventFactory;
23 import org.openecomp.sdc.be.auditing.impl.AuditBaseEventFactory;
24 import org.openecomp.sdc.be.model.User;
25 import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
26 import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
27 import org.openecomp.sdc.be.resources.data.auditing.model.ResourceCommonInfo;
28 import org.openecomp.sdc.be.resources.data.auditing.model.ResourceVersionInfo;
30 public class AuditResourceEventFactoryManager {
33 * Utility classes, which are collections of static members, are not meant to be instantiated
35 private AuditResourceEventFactoryManager() {
38 public static AuditEventFactory createResourceEventFactory(AuditingActionEnum action, CommonAuditData commonFields,
39 ResourceCommonInfo resourceCommonInfo, ResourceVersionInfo prevParams,
40 ResourceVersionInfo currParams, String invariantUuid, User modifier,
41 String artifactData, String comment, String did, String toscaNodeType) {
42 AuditBaseEventFactory factory = null;
45 factory = new AuditImportResourceAdminEventFactory(commonFields, resourceCommonInfo, prevParams, currParams, invariantUuid, modifier,
46 artifactData, comment, did, toscaNodeType);
50 case UPDATE_RESOURCE_METADATA:
51 case ARCHIVE_COMPONENT:
52 case RESTORE_COMPONENT:
53 case UPDATE_SERVICE_METADATA:
54 factory = new AuditCreateUpdateResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams,
55 invariantUuid, modifier, artifactData, comment, did, org.openecomp.sdc.common.api.Constants.EMPTY_STRING);
57 case CHECKIN_RESOURCE:
58 case CHECKOUT_RESOURCE:
59 case UNDO_CHECKOUT_RESOURCE:
60 case CERTIFICATION_REQUEST_RESOURCE:
61 case START_CERTIFICATION_RESOURCE:
62 case CERTIFICATION_SUCCESS_RESOURCE:
63 case FAIL_CERTIFICATION_RESOURCE:
64 case CANCEL_CERTIFICATION_RESOURCE:
65 case UPDATE_SERVICE_REFERENCE:
66 case VF_UPGRADE_SERVICES:
67 factory = new AuditCertificationResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams,
68 invariantUuid, modifier, artifactData, comment, did);
72 case ARTIFACT_METADATA_UPDATE:
73 case ARTIFACT_PAYLOAD_UPDATE:
74 case ARTIFACT_DOWNLOAD:
75 factory = new AuditArtifactResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams, invariantUuid,
76 modifier, artifactData, comment, did);
78 case DISTRIBUTION_STATE_CHANGE_REQUEST:
79 factory = new AuditDistStateChangeRequestResourceAdminEventFactory(commonFields, resourceCommonInfo, prevParams, currParams,
80 invariantUuid, modifier, artifactData, comment, did);
82 case DISTRIBUTION_STATE_CHANGE_APPROV:
83 case DISTRIBUTION_STATE_CHANGE_REJECT:
84 factory = new AuditDistStateChangeResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams,
85 invariantUuid, modifier, artifactData, comment, did);
88 throw new UnsupportedOperationException();