re base code
[sdc.git] / catalog-dao / src / main / java / org / openecomp / sdc / be / resources / data / UserFunctionalMenuData.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.be.resources.data;
22
23 import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
24 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
25 import org.openecomp.sdc.be.dao.utils.DaoUtils;
26 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
27
28 import java.util.HashMap;
29 import java.util.Map;
30
31 public class UserFunctionalMenuData extends GraphNode {
32
33         private String uniqueId;
34
35         private String functionalMenu;
36
37         public UserFunctionalMenuData(String functionalMenu, String uniqueId) {
38                 super(NodeTypeEnum.UserFunctionalMenu);
39                 this.functionalMenu = functionalMenu;
40                 this.uniqueId = uniqueId;
41         }
42
43         public UserFunctionalMenuData() {
44                 super(NodeTypeEnum.UserFunctionalMenu);
45         }
46
47         public UserFunctionalMenuData(Map<String, Object> properties) {
48                 super(NodeTypeEnum.UserFunctionalMenu);
49
50                 setFunctionalMenu((String) properties.get(GraphPropertiesDictionary.FUNCTIONAL_MENU.getProperty()));
51                 setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty()));
52         }
53
54         public String getFunctionalMenu() {
55                 return functionalMenu;
56         }
57
58         public void setFunctionalMenu(String functionalMenu) {
59                 this.functionalMenu = functionalMenu;
60         }
61
62         public void setUniqueId(String uniqueId) {
63                 this.uniqueId = uniqueId;
64         }
65
66         @Override
67         public String toString() {
68                 return "UserFunctionalMenuData [uniqueId=" + uniqueId + ", functionalMenu=" + functionalMenu + "]";
69         }
70
71         public String toJson() {
72                 return DaoUtils.convertToJson(toGraphMap());
73         }
74
75         @Override
76         public Map<String, Object> toGraphMap() {
77                 Map<String, Object> map = new HashMap<>();
78
79                 addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId);
80                 addIfExists(map, GraphPropertiesDictionary.FUNCTIONAL_MENU, functionalMenu);
81
82                 return map;
83         }
84
85         @Override
86         public String getUniqueIdKey() {
87                 return GraphPropertiesDictionary.UNIQUE_ID.getProperty();
88         }
89
90         @Override
91         public String getUniqueId() {
92                 return uniqueId;
93         }
94
95 }