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 {
32 public static AuditEventFactory createResourceEventFactory(AuditingActionEnum action, CommonAuditData commonFields,
33 ResourceCommonInfo resourceCommonInfo, ResourceVersionInfo prevParams,
34 ResourceVersionInfo currParams, String invariantUuid, User modifier,
35 String artifactData, String comment, String did, String toscaNodeType) {
36 AuditBaseEventFactory factory = null;
39 factory = new AuditImportResourceAdminEventFactory(commonFields, resourceCommonInfo, prevParams, currParams, invariantUuid, modifier,
40 artifactData, comment, did, toscaNodeType);
44 case UPDATE_RESOURCE_METADATA:
45 case ARCHIVE_COMPONENT:
46 case RESTORE_COMPONENT:
47 case UPDATE_SERVICE_METADATA:
48 factory = new AuditCreateUpdateResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams,
49 invariantUuid, modifier, artifactData, comment, did, org.openecomp.sdc.common.api.Constants.EMPTY_STRING);
51 case CHECKIN_RESOURCE:
52 case CHECKOUT_RESOURCE:
53 case UNDO_CHECKOUT_RESOURCE:
54 case CERTIFICATION_REQUEST_RESOURCE:
55 case START_CERTIFICATION_RESOURCE:
56 case CERTIFICATION_SUCCESS_RESOURCE:
57 case FAIL_CERTIFICATION_RESOURCE:
58 case CANCEL_CERTIFICATION_RESOURCE:
59 case UPDATE_SERVICE_REFERENCE:
60 case VF_UPGRADE_SERVICES:
61 factory = new AuditCertificationResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams,
62 invariantUuid, modifier, artifactData, comment, did);
66 case ARTIFACT_METADATA_UPDATE:
67 case ARTIFACT_PAYLOAD_UPDATE:
68 case ARTIFACT_DOWNLOAD:
69 factory = new AuditArtifactResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams, invariantUuid,
70 modifier, artifactData, comment, did);
72 case DISTRIBUTION_STATE_CHANGE_REQUEST:
73 factory = new AuditDistStateChangeRequestResourceAdminEventFactory(commonFields, resourceCommonInfo, prevParams, currParams,
74 invariantUuid, modifier, artifactData, comment, did);
76 case DISTRIBUTION_STATE_CHANGE_APPROV:
77 case DISTRIBUTION_STATE_CHANGE_REJECT:
78 factory = new AuditDistStateChangeResourceAdminEventFactory(action, commonFields, resourceCommonInfo, prevParams, currParams,
79 invariantUuid, modifier, artifactData, comment, did);
82 throw new UnsupportedOperationException();