3 * Copyright © 2017-2018 European Support Limited
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package org.openecomp.sdc.versioning.types;
20 import java.util.Date;
21 import java.util.EnumMap;
22 import java.util.HashMap;
26 import org.openecomp.sdc.versioning.dao.types.VersionStatus;
36 private ItemStatus status;
37 private String description;
38 private Map<String, Object> properties = new HashMap<>();
39 private Map<VersionStatus, Integer> versionStatusCounters = new EnumMap<>(VersionStatus.class);
40 private Date creationTime;
41 private Date modificationTime;
43 public void addProperty(String key, Object value) {
44 properties.put(key, value);
47 public void addVersionStatus(VersionStatus versionStatus) {
48 Integer counter = versionStatusCounters.get(versionStatus);
49 versionStatusCounters.put(versionStatus, counter == null ? 1 : counter + 1);
52 public void removeVersionStatus(VersionStatus versionStatus) {
53 Integer counter = versionStatusCounters.get(versionStatus);
54 if (counter != null) {
56 versionStatusCounters.remove(versionStatus);
58 versionStatusCounters.put(versionStatus, counter - 1);