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=========================================================
21 package org.openecomp.sdc.be.auditing.impl.resourceadmin;
23 import org.openecomp.sdc.be.auditing.api.AuditEventFactory;
24 import org.openecomp.sdc.be.auditing.impl.AuditBaseEventFactory;
25 import org.openecomp.sdc.be.model.User;
26 import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
27 import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
28 import org.openecomp.sdc.be.resources.data.auditing.model.ResourceCommonInfo;
29 import org.openecomp.sdc.be.resources.data.auditing.model.ResourceVersionInfo;
31 public class AuditResourceEventFactoryManager {
34 public static AuditEventFactory createResourceEventFactory(AuditingActionEnum action, CommonAuditData commonFields, ResourceCommonInfo resourceCommonInfo,
35 ResourceVersionInfo prevParams, ResourceVersionInfo currParams, String invariantUuid,
36 User modifier, String artifactData, String comment, String did, String toscaNodeType) {
37 AuditBaseEventFactory factory = null;
41 factory = new AuditImportResourceAdminEventFactory(commonFields, resourceCommonInfo, prevParams, currParams,
42 invariantUuid, modifier, artifactData, comment, did, toscaNodeType);
46 case UPDATE_RESOURCE_METADATA:
47 case ARCHIVE_COMPONENT:
48 case RESTORE_COMPONENT:
49 case UPDATE_SERVICE_METADATA:
50 factory = new AuditCreateUpdateResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams,
51 invariantUuid, modifier, artifactData, comment, did, org.openecomp.sdc.common.api.Constants.EMPTY_STRING);
53 case CHECKIN_RESOURCE:
54 case CHECKOUT_RESOURCE:
55 case UNDO_CHECKOUT_RESOURCE:
56 case CERTIFICATION_REQUEST_RESOURCE:
57 case START_CERTIFICATION_RESOURCE:
58 case CERTIFICATION_SUCCESS_RESOURCE:
59 case FAIL_CERTIFICATION_RESOURCE:
60 case CANCEL_CERTIFICATION_RESOURCE:
61 case UPDATE_SERVICE_REFERENCE:
62 case VF_UPGRADE_SERVICES:
63 factory = new AuditCertificationResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams,
64 invariantUuid, modifier, artifactData, comment, did);
68 case ARTIFACT_METADATA_UPDATE:
69 case ARTIFACT_PAYLOAD_UPDATE:
70 case ARTIFACT_DOWNLOAD:
71 factory = new AuditArtifactResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams,
72 invariantUuid, modifier, artifactData, comment, did);
74 case DISTRIBUTION_STATE_CHANGE_REQUEST:
75 factory = new AuditDistStateChangeRequestResourceAdminEventFactory(commonFields, resourceCommonInfo, prevParams, currParams,
76 invariantUuid, modifier, artifactData, comment, did);
78 case DISTRIBUTION_STATE_CHANGE_APPROV:
79 case DISTRIBUTION_STATE_CHANGE_REJECT:
80 factory = new AuditDistStateChangeResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams,
81 invariantUuid, modifier, artifactData, comment, did);
84 throw new UnsupportedOperationException();