import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.dao.CommonClassDao;
-import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.BrmsParamTemplate;
import org.onap.policy.rest.jpa.UserInfo;
import org.onap.policy.utils.PolicyUtils;
import org.springframework.beans.factory.annotation.Autowired;
Map<String, String> responseMap = new HashMap<>();
if (rule != null && !PolicyUtils.brmsRawValidate(rule).contains("[ERR")) {
List<Object> duplicateData =
- commonClassDao.checkDuplicateEntry(ruleName, "ruleName", BRMSParamTemplate.class);
+ commonClassDao.checkDuplicateEntry(ruleName, "ruleName", BrmsParamTemplate.class);
if (duplicateData != null && !duplicateData.isEmpty()) {
LOGGER.error("Import new service failed. Service already exists");
responseMap.put("DBError", "EXISTS");
return responseMap;
} else {
- BRMSParamTemplate brmsParamTemplate = new BRMSParamTemplate();
+ BrmsParamTemplate brmsParamTemplate = new BrmsParamTemplate();
brmsParamTemplate.setDescription(description);
brmsParamTemplate.setRuleName(ruleName);
brmsParamTemplate.setRule(rule);
import org.onap.policy.pap.xacml.rest.controller.BRMSDictionaryController;
import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
-import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.BrmsParamTemplate;
public class CreateBrmsParamPolicy extends Policy {
params.put("templateName", templateName);
List<Object> result = dbConnection.getDataByQuery(queryString, params);
if (!result.isEmpty()) {
- BRMSParamTemplate template = (BRMSParamTemplate) result.get(0);
+ BrmsParamTemplate template = (BrmsParamTemplate) result.get(0);
ruleTemplate = template.getRule();
}
return ruleTemplate;
import org.onap.policy.pap.xacml.rest.components.CreateBRMSRuleTemplate;
import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
import org.onap.policy.rest.dao.CommonClassDao;
-import org.onap.policy.rest.jpa.BRMSController;
-import org.onap.policy.rest.jpa.BRMSDependency;
-import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.BrmsController;
+import org.onap.policy.rest.jpa.BrmsDependency;
+import org.onap.policy.rest.jpa.BrmsParamTemplate;
import org.onap.policy.rest.jpa.OnapName;
import org.onap.policy.rest.jpa.UserInfo;
import org.onap.policy.utils.PolicyUtils;
produces = MediaType.APPLICATION_JSON_VALUE)
public void getBRMSParamDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getDataByEntity(response, brmsParamDatas, ruleName, BRMSParamTemplate.class);
+ utils.getDataByEntity(response, brmsParamDatas, ruleName, BrmsParamTemplate.class);
}
@RequestMapping(
produces = MediaType.APPLICATION_JSON_VALUE)
public void getBRMSParamDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getData(response, brmsParamDatas, BRMSParamTemplate.class);
+ utils.getData(response, brmsParamDatas, BrmsParamTemplate.class);
}
@RequestMapping(value = {"/brms_dictionary/set_BRMSParamData"}, method = {RequestMethod.POST})
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
- BRMSParamTemplate bRMSParamTemplateData;
+ BrmsParamTemplate bRMSParamTemplateData;
String userId = null;
if (fromAPI) {
bRMSParamTemplateData =
- mapper.readValue(root.get(dictionaryFields).toString(), BRMSParamTemplate.class);
+ mapper.readValue(root.get(dictionaryFields).toString(), BrmsParamTemplate.class);
userId = "API";
} else {
bRMSParamTemplateData =
- mapper.readValue(root.get("brmsParamDictionaryData").toString(), BRMSParamTemplate.class);
+ mapper.readValue(root.get("brmsParamDictionaryData").toString(), BrmsParamTemplate.class);
userId = root.get(userid).textValue();
}
UserInfo userInfo = utils.getUserInfo(userId);
List<Object> duplicateData = commonClassDao.checkDuplicateEntry(bRMSParamTemplateData.getRuleName(),
- ruleName, BRMSParamTemplate.class);
+ ruleName, BrmsParamTemplate.class);
boolean duplicateflag = false;
if (!duplicateData.isEmpty()) {
- BRMSParamTemplate data = (BRMSParamTemplate) duplicateData.get(0);
+ BrmsParamTemplate data = (BrmsParamTemplate) duplicateData.get(0);
if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
bRMSParamTemplateData.setId(data.getId());
} else if ((request.getParameter(operation) != null
} else {
commonClassDao.update(bRMSParamTemplateData);
}
- responseString = mapper.writeValueAsString(commonClassDao.getData(BRMSParamTemplate.class));
+ responseString = mapper.writeValueAsString(commonClassDao.getData(BrmsParamTemplate.class));
} else {
responseString = duplicateResponseString;
}
@RequestMapping(value = {"/brms_dictionary/remove_brmsParam"}, method = {RequestMethod.POST})
public void removeBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.removeData(request, response, brmsParamDatas, BRMSParamTemplate.class);
+ utils.removeData(request, response, brmsParamDatas, BrmsParamTemplate.class);
}
@RequestMapping(
produces = MediaType.APPLICATION_JSON_VALUE)
public void getBRMSDependencyDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getDataByEntity(response, brmsDependencyDatas, dependencyName, BRMSDependency.class);
+ utils.getDataByEntity(response, brmsDependencyDatas, dependencyName, BrmsDependency.class);
}
@RequestMapping(
produces = MediaType.APPLICATION_JSON_VALUE)
public void getBRMSDependencyDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getData(response, brmsDependencyDatas, BRMSDependency.class);
+ utils.getData(response, brmsDependencyDatas, BrmsDependency.class);
}
@RequestMapping(value = {"/brms_dictionary/save_BRMSDependencyData"}, method = {RequestMethod.POST})
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
- BRMSDependency brmsDependency;
+ BrmsDependency brmsDependency;
String userId = null;
if (fromAPI) {
- brmsDependency = mapper.readValue(root.get(dictionaryFields).toString(), BRMSDependency.class);
+ brmsDependency = mapper.readValue(root.get(dictionaryFields).toString(), BrmsDependency.class);
userId = "API";
} else {
brmsDependency =
- mapper.readValue(root.get("brmsDependencyDictionaryData").toString(), BRMSDependency.class);
+ mapper.readValue(root.get("brmsDependencyDictionaryData").toString(), BrmsDependency.class);
userId = root.get(userid).textValue();
}
UserInfo userInfo = utils.getUserInfo(userId);
List<Object> duplicateData = commonClassDao.checkDuplicateEntry(brmsDependency.getDependencyName(),
- dependencyName, BRMSDependency.class);
+ dependencyName, BrmsDependency.class);
boolean duplicateflag = false;
if (!duplicateData.isEmpty()) {
- BRMSDependency data = (BRMSDependency) duplicateData.get(0);
+ BrmsDependency data = (BrmsDependency) duplicateData.get(0);
if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
brmsDependency.setId(data.getId());
} else if ((request.getParameter(operation) != null
brmsDependency.setModifiedDate(new Date());
commonClassDao.update(brmsDependency);
}
- responseString = mapper.writeValueAsString(commonClassDao.getData(BRMSDependency.class));
+ responseString = mapper.writeValueAsString(commonClassDao.getData(BrmsDependency.class));
} else {
responseString = duplicateResponseString;
}
public void removeBRMSDependencyDictionary(HttpServletRequest request, HttpServletResponse response)
throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.removeData(request, response, brmsDependencyDatas, BRMSDependency.class);
+ utils.removeData(request, response, brmsDependencyDatas, BrmsDependency.class);
}
@RequestMapping(
produces = MediaType.APPLICATION_JSON_VALUE)
public void getBRMSControllerDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getDataByEntity(response, brmsControllerDatas, controllerName, BRMSController.class);
+ utils.getDataByEntity(response, brmsControllerDatas, controllerName, BrmsController.class);
}
@RequestMapping(
produces = MediaType.APPLICATION_JSON_VALUE)
public void getBRMSControllerDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getData(response, brmsControllerDatas, BRMSController.class);
+ utils.getData(response, brmsControllerDatas, BrmsController.class);
}
@RequestMapping(value = {"/brms_dictionary/save_BRMSControllerData"}, method = {RequestMethod.POST})
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
- BRMSController brmsController;
+ BrmsController brmsController;
String userId = null;
if (fromAPI) {
- brmsController = mapper.readValue(root.get(dictionaryFields).toString(), BRMSController.class);
+ brmsController = mapper.readValue(root.get(dictionaryFields).toString(), BrmsController.class);
userId = "API";
} else {
brmsController =
- mapper.readValue(root.get("brmsControllerDictionaryData").toString(), BRMSController.class);
+ mapper.readValue(root.get("brmsControllerDictionaryData").toString(), BrmsController.class);
userId = root.get(userid).textValue();
}
UserInfo userInfo = utils.getUserInfo(userId);
List<Object> duplicateData = commonClassDao.checkDuplicateEntry(brmsController.getControllerName(),
- controllerName, BRMSController.class);
+ controllerName, BrmsController.class);
boolean duplicateflag = false;
if (!duplicateData.isEmpty()) {
- BRMSController data = (BRMSController) duplicateData.get(0);
+ BrmsController data = (BrmsController) duplicateData.get(0);
if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
brmsController.setId(data.getId());
} else if ((request.getParameter(operation) != null
public void removeBRMSControllerDictionary(HttpServletRequest request, HttpServletResponse response)
throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.removeData(request, response, brmsControllerDatas, BRMSController.class);
+ utils.removeData(request, response, brmsControllerDatas, BrmsController.class);
}
- public BRMSDependency getDependencyDataByID(String dependencyName) {
- return (BRMSDependency) commonClassDao.getEntityItem(BRMSDependency.class,
+ public BrmsDependency getDependencyDataByID(String dependencyName) {
+ return (BrmsDependency) commonClassDao.getEntityItem(BrmsDependency.class,
BRMSDictionaryController.dependencyName, dependencyName);
}
- public BRMSController getControllerDataByID(String controllerName) {
- return (BRMSController) commonClassDao.getEntityItem(BRMSController.class,
+ public BrmsController getControllerDataByID(String controllerName) {
+ return (BrmsController) commonClassDao.getEntityItem(BrmsController.class,
BRMSDictionaryController.controllerName, controllerName);
}
}
import org.onap.policy.rest.jpa.ActionPolicyDict;
import org.onap.policy.rest.jpa.AddressGroup;
import org.onap.policy.rest.jpa.Attribute;
-import org.onap.policy.rest.jpa.BRMSController;
-import org.onap.policy.rest.jpa.BRMSDependency;
-import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.BrmsController;
+import org.onap.policy.rest.jpa.BrmsDependency;
+import org.onap.policy.rest.jpa.BrmsParamTemplate;
import org.onap.policy.rest.jpa.Category;
import org.onap.policy.rest.jpa.ClosedLoopD2Services;
import org.onap.policy.rest.jpa.ClosedLoopSite;
}
if (dictionaryName.startsWith("BRMSParamDictionary")) {
for (int i = 1; i < dictSheet.size(); i++) {
- BRMSParamTemplate attribute = new BRMSParamTemplate();
+ BrmsParamTemplate attribute = new BrmsParamTemplate();
UserInfo userinfo = new UserInfo();
userinfo.setUserLoginId(userId);
attribute.setUserCreatedBy(userinfo);
}
if (dictionaryName.startsWith("BRMSControllerDictionary")) {
for (int i = 1; i < dictSheet.size(); i++) {
- BRMSController attribute = new BRMSController();
+ BrmsController attribute = new BrmsController();
UserInfo userinfo = new UserInfo();
userinfo.setUserLoginId(userId);
attribute.setUserCreatedBy(userinfo);
}
if (dictionaryName.startsWith("BRMSDependencyDictionary")) {
for (int i = 1; i < dictSheet.size(); i++) {
- BRMSDependency attribute = new BRMSDependency();
+ BrmsDependency attribute = new BrmsDependency();
UserInfo userinfo = new UserInfo();
userinfo.setUserLoginId(userId);
attribute.setUserCreatedBy(userinfo);
import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
import org.onap.policy.pap.xacml.rest.util.JsonMessage;
import org.onap.policy.rest.dao.CommonClassDao;
-import org.onap.policy.rest.jpa.DCAEuuid;
+import org.onap.policy.rest.jpa.DcaeUuid;
import org.onap.policy.rest.jpa.DictionaryData;
import org.onap.policy.rest.jpa.MicroServiceAttribute;
import org.onap.policy.rest.jpa.MicroServiceConfigName;
produces = MediaType.APPLICATION_JSON_VALUE)
public void getDCAEUUIDDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getDataByEntity(response, dcaeUUIDDatas, "name", DCAEuuid.class);
+ utils.getDataByEntity(response, dcaeUUIDDatas, "name", DcaeUuid.class);
}
@RequestMapping(
produces = MediaType.APPLICATION_JSON_VALUE)
public void getDCAEUUIDDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.getData(response, dcaeUUIDDatas, DCAEuuid.class);
+ utils.getData(response, dcaeUUIDDatas, DcaeUuid.class);
}
@RequestMapping(value = {"/ms_dictionary/save_dcaeUUID"}, method = {RequestMethod.POST})
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
- DCAEuuid dCAEuuid;
+ DcaeUuid dCAEuuid;
if (fromAPI) {
- dCAEuuid = mapper.readValue(root.get(dictionaryFields).toString(), DCAEuuid.class);
+ dCAEuuid = mapper.readValue(root.get(dictionaryFields).toString(), DcaeUuid.class);
} else {
- dCAEuuid = mapper.readValue(root.get("dcaeUUIDDictionaryData").toString(), DCAEuuid.class);
+ dCAEuuid = mapper.readValue(root.get("dcaeUUIDDictionaryData").toString(), DcaeUuid.class);
}
- List<Object> duplicateData = commonClassDao.checkDuplicateEntry(dCAEuuid.getName(), "name", DCAEuuid.class);
+ List<Object> duplicateData = commonClassDao.checkDuplicateEntry(dCAEuuid.getName(), "name", DcaeUuid.class);
boolean duplicateflag = false;
if (duplicateData != null && !duplicateData.isEmpty()) {
- DCAEuuid data = (DCAEuuid) duplicateData.get(0);
+ DcaeUuid data = (DcaeUuid) duplicateData.get(0);
if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
dCAEuuid.setId(data.getId());
} else if ((request.getParameter(operation) != null
} else {
commonClassDao.update(dCAEuuid);
}
- responseString = mapper.writeValueAsString(commonClassDao.getData(DCAEuuid.class));
+ responseString = mapper.writeValueAsString(commonClassDao.getData(DcaeUuid.class));
} else {
responseString = duplicateResponseString;
}
@RequestMapping(value = {"/ms_dictionary/remove_dcaeuuid"}, method = {RequestMethod.POST})
public void removeDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException {
DictionaryUtils utils = getDictionaryUtilsInstance();
- utils.removeData(request, response, dcaeUUIDDatas, DCAEuuid.class);
+ utils.removeData(request, response, dcaeUUIDDatas, DcaeUuid.class);
}
@RequestMapping(
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.ActionPolicyDict;
import org.onap.policy.rest.jpa.Attribute;
-import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.BrmsParamTemplate;
import org.onap.policy.rest.jpa.ClosedLoopD2Services;
import org.onap.policy.rest.jpa.ClosedLoopSite;
-import org.onap.policy.rest.jpa.DCAEuuid;
+import org.onap.policy.rest.jpa.DcaeUuid;
import org.onap.policy.rest.jpa.DecisionSettings;
import org.onap.policy.rest.jpa.DescriptiveScope;
import org.onap.policy.rest.jpa.GroupPolicyScopeList;
policyList = searchElkDatabase(action, "actionAttributeValue", value);
break;
case brmsParam:
- BRMSParamTemplate bRMSParamTemplate =
- mapper.readValue(root.get("data").toString(), BRMSParamTemplate.class);
+ BrmsParamTemplate bRMSParamTemplate =
+ mapper.readValue(root.get("data").toString(), BrmsParamTemplate.class);
value = bRMSParamTemplate.getRuleName();
policyList = searchElkDatabase(config, "ruleName", value);
break;
policyList = searchElkDatabase(config, pholder, value);
break;
case msDCAEUUID:
- DCAEuuid dcaeUUID = mapper.readValue(root.get("data").toString(), DCAEuuid.class);
+ DcaeUuid dcaeUUID = mapper.readValue(root.get("data").toString(), DcaeUuid.class);
value = dcaeUUID.getName();
policyList = searchElkDatabase(config, "uuid", value);
break;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.ActionPolicyDict;
-import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.BrmsParamTemplate;
import org.onap.policy.rest.jpa.PolicyEditorScopes;
import org.onap.policy.rest.jpa.PolicyVersion;
import org.onap.policy.rest.jpa.UserInfo;
String modelName = drlRuleAndUiParams.get("templateName");
PolicyLogger.info("Template name from API is: " + modelName);
- BRMSParamTemplate template = (BRMSParamTemplate) commonClassDao
- .getEntityItem(BRMSParamTemplate.class, "ruleName", modelName);
+ BrmsParamTemplate template = (BrmsParamTemplate) commonClassDao
+ .getEntityItem(BrmsParamTemplate.class, "ruleName", modelName);
if (template == null) {
String message =
XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Template. The template name, "
import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.ActionPolicyDict;
-import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.BrmsParamTemplate;
import org.onap.policy.rest.jpa.Category;
import org.onap.policy.rest.jpa.FunctionDefinition;
import org.onap.policy.rest.jpa.PolicyEditorScopes;
editorScope.setUserModifiedBy(userInfo);
Mockito.when(commonClassDao.getEntityItem(PolicyEditorScopes.class, "scopeName", "test"))
.thenReturn(editorScope);
- BRMSParamTemplate template = new BRMSParamTemplate();
+ BrmsParamTemplate template = new BrmsParamTemplate();
template.setRuleName("testPolicy");
template.setUserCreatedBy(userInfo);
String rule = "package com.sample;\n" + "import com.sample.DroolsTest.Message;\n" + "declare Params\n"
+ "Params($param.samPoll > 50)\n" + "then\n" + "System.out.println(\"Firing rule 1\");\n"
+ "System.out.println($param);\n" + "end\n";
template.setRule(rule);
- Mockito.when(commonClassDao.getEntityItem(BRMSParamTemplate.class, "ruleName", "testPolicy"))
+ Mockito.when(commonClassDao.getEntityItem(BrmsParamTemplate.class, "ruleName", "testPolicy"))
.thenReturn(template);
}
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
import org.onap.policy.rest.dao.CommonClassDao;
-import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.BrmsParamTemplate;
import org.onap.policy.rest.jpa.UserInfo;
import org.springframework.mock.web.MockHttpServletResponse;
when(commonClassDao.getEntityItem(UserInfo.class, "userLoginId", "testing")).thenReturn(userInfo);
List<String> brms = new ArrayList<String>();
brms.add("BRMS-Model");
- when(commonClassDao.getDataByColumn(BRMSParamTemplate.class, "name")).thenReturn(brms);
- doNothing().when(commonClassDao).delete(new BRMSParamTemplate());
- doNothing().when(commonClassDao).save(new BRMSParamTemplate());
+ when(commonClassDao.getDataByColumn(BrmsParamTemplate.class, "name")).thenReturn(brms);
+ doNothing().when(commonClassDao).delete(new BrmsParamTemplate());
+ doNothing().when(commonClassDao).save(new BrmsParamTemplate());
controller = new BRMSDictionaryController();
request = Mockito.mock(HttpServletRequest.class);
response = new MockHttpServletResponse();
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
import org.onap.policy.rest.dao.CommonClassDao;
-import org.onap.policy.rest.jpa.DCAEuuid;
+import org.onap.policy.rest.jpa.DcaeUuid;
import org.onap.policy.rest.jpa.MicroServiceLocation;
import org.onap.policy.rest.jpa.MicroServiceModels;
import org.onap.policy.rest.jpa.UserInfo;
List<String> listIds = new ArrayList<String>();
listIds.add("Jack");
- when(commonClassDao.getDataByColumn(DCAEuuid.class, "name")).thenReturn(listIds);
+ when(commonClassDao.getDataByColumn(DcaeUuid.class, "name")).thenReturn(listIds);
List<String> microList = new ArrayList<String>();
microList.add("MC-Model");
List<Object> listId = new ArrayList<Object>();
listId.add("smith");
- when(commonClassDao.getData(DCAEuuid.class)).thenReturn(listId);
+ when(commonClassDao.getData(DcaeUuid.class)).thenReturn(listId);
MicroServiceModels microServiceModels = new MicroServiceModels();
doNothing().when(commonClassDao).delete(microServiceModels);
* ONAP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+/**
+ * The Class BRMSController.
+ */
@Entity
-@Table(name="BRMSController")
-@NamedQuery(name="BRMSController.findAll", query="SELECT b from BRMSController b ")
-public class BRMSController implements Serializable{
+@Table(name = "BrmsController")
+@NamedQuery(name = "BrmsController.findAll", query = "SELECT b from BrmsController b ")
+public class BrmsController implements Serializable {
private static final long serialVersionUID = -8666947569754164177L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
-
- @Column(name="controller_name", nullable=false, length=1024, unique=true)
+
+ @Column(name = "controller_name", nullable = false, length = 1024, unique = true)
@OrderBy("asc")
private String controllerName;
-
- @Column(name="description", nullable=true, length=1024)
+
+ @Column(name = "description", nullable = true, length = 1024)
private String description;
-
+
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
+ @Column(name = "created_date", updatable = false)
private Date createdDate;
-
+
@ManyToOne(optional = false)
- @JoinColumn(name="created_by")
+ @JoinColumn(name = "created_by")
private UserInfo userCreatedBy;
-
+
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="modified_date", nullable=false)
+ @Column(name = "modified_date", nullable = false)
private Date modifiedDate;
-
+
@ManyToOne(optional = false)
- @JoinColumn(name="modified_by")
+ @JoinColumn(name = "modified_by")
private UserInfo userModifiedBy;
-
- @Column(name="controller", nullable=false)
+
+ @Column(name = "controller", nullable = false)
private String controller;
-
+
+ /**
+ * Called before persisting an instance.
+ */
@PrePersist
public void prePersist() {
Date date = new Date();
this.createdDate = date;
this.modifiedDate = date;
}
-
+
+ /**
+ * Pre update.
+ */
@PreUpdate
public void preUpdate() {
this.modifiedDate = new Date();
}
-
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
public String getDescription() {
return description;
}
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ * Gets the created date.
+ *
+ * @return the created date
+ */
public Date getCreatedDate() {
return createdDate;
}
+ /**
+ * Sets the created date.
+ *
+ * @param createdDate the new created date
+ */
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
+ /**
+ * Gets the user created by.
+ *
+ * @return the user created by
+ */
public UserInfo getUserCreatedBy() {
return userCreatedBy;
}
+ /**
+ * Sets the user created by.
+ *
+ * @param userCreatedBy the new user created by
+ */
public void setUserCreatedBy(UserInfo userCreatedBy) {
this.userCreatedBy = userCreatedBy;
}
+ /**
+ * Gets the modified date.
+ *
+ * @return the modified date
+ */
public Date getModifiedDate() {
return modifiedDate;
}
+ /**
+ * Sets the modified date.
+ *
+ * @param modifiedDate the new modified date
+ */
public void setModifiedDate(Date modifiedDate) {
this.modifiedDate = modifiedDate;
}
+ /**
+ * Gets the user modified by.
+ *
+ * @return the user modified by
+ */
public UserInfo getUserModifiedBy() {
return userModifiedBy;
}
+ /**
+ * Sets the user modified by.
+ *
+ * @param userModifiedBy the new user modified by
+ */
public void setUserModifiedBy(UserInfo userModifiedBy) {
this.userModifiedBy = userModifiedBy;
}
+ /**
+ * Gets the controller.
+ *
+ * @return the controller
+ */
public String getController() {
return controller;
}
+ /**
+ * Sets the controller.
+ *
+ * @param controller the new controller
+ */
public void setController(String controller) {
this.controller = controller;
}
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public int getId() {
return id;
}
+ /**
+ * Sets the id.
+ *
+ * @param id the new id
+ */
public void setId(int id) {
this.id = id;
}
+ /**
+ * Gets the controller name.
+ *
+ * @return the controller name
+ */
public String getControllerName() {
return controllerName;
}
+ /**
+ * Sets the controller name.
+ *
+ * @param controllerName the new controller name
+ */
public void setControllerName(String controllerName) {
this.controllerName = controllerName;
}
-
+
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+/**
+ * The Class BrmsDependency.
+ */
@Entity
-@Table(name="BRMSDependency")
-@NamedQuery(name="BRMSDependency.findAll", query="SELECT b from BRMSDependency b ")
-public class BRMSDependency implements Serializable{
+@Table(name = "BrmsDependency")
+@NamedQuery(name = "BrmsDependency.findAll", query = "SELECT b from BrmsDependency b ")
+public class BrmsDependency implements Serializable {
private static final long serialVersionUID = -7005622785653160761L;
-
+
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
-
- @Column(name="dependency_name", nullable=false, length=1024, unique=true)
+
+ @Column(name = "dependency_name", nullable = false, length = 1024, unique = true)
@OrderBy("asc")
private String dependencyName;
- @Column(name="description", nullable=true, length=1024)
+ @Column(name = "description", nullable = true, length = 1024)
private String description;
-
+
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
+ @Column(name = "created_date", updatable = false)
private Date createdDate;
-
+
@ManyToOne(optional = false)
- @JoinColumn(name="created_by")
+ @JoinColumn(name = "created_by")
private UserInfo userCreatedBy;
-
+
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="modified_date", nullable=false)
+ @Column(name = "modified_date", nullable = false)
private Date modifiedDate;
-
+
@ManyToOne(optional = false)
- @JoinColumn(name="modified_by")
+ @JoinColumn(name = "modified_by")
private UserInfo userModifiedBy;
-
- @Column(name="dependency", nullable=false)
+
+ @Column(name = "dependency", nullable = false)
private String dependency;
-
+
+ /**
+ * Pre persist.
+ */
@PrePersist
public void prePersist() {
Date date = new Date();
this.createdDate = date;
this.modifiedDate = date;
}
-
+
+ /**
+ * Pre update.
+ */
@PreUpdate
public void preUpdate() {
this.modifiedDate = new Date();
}
-
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
public String getDescription() {
return description;
}
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ * Gets the created date.
+ *
+ * @return the created date
+ */
public Date getCreatedDate() {
return createdDate;
}
+ /**
+ * Sets the created date.
+ *
+ * @param createdDate the new created date
+ */
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
+ /**
+ * Gets the user created by.
+ *
+ * @return the user created by
+ */
public UserInfo getUserCreatedBy() {
return userCreatedBy;
}
+ /**
+ * Sets the user created by.
+ *
+ * @param userCreatedBy the new user created by
+ */
public void setUserCreatedBy(UserInfo userCreatedBy) {
this.userCreatedBy = userCreatedBy;
}
+ /**
+ * Gets the modified date.
+ *
+ * @return the modified date
+ */
public Date getModifiedDate() {
return modifiedDate;
}
+ /**
+ * Sets the modified date.
+ *
+ * @param modifiedDate the new modified date
+ */
public void setModifiedDate(Date modifiedDate) {
this.modifiedDate = modifiedDate;
}
+ /**
+ * Gets the user modified by.
+ *
+ * @return the user modified by
+ */
public UserInfo getUserModifiedBy() {
return userModifiedBy;
}
+ /**
+ * Sets the user modified by.
+ *
+ * @param userModifiedBy the new user modified by
+ */
public void setUserModifiedBy(UserInfo userModifiedBy) {
this.userModifiedBy = userModifiedBy;
}
+ /**
+ * Gets the dependency.
+ *
+ * @return the dependency
+ */
public String getDependency() {
return dependency;
}
+ /**
+ * Sets the dependency.
+ *
+ * @param dependency the new dependency
+ */
public void setDependency(String dependency) {
this.dependency = dependency;
}
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public int getId() {
return id;
}
+ /**
+ * Sets the id.
+ *
+ * @param id the new id
+ */
public void setId(int id) {
this.id = id;
}
-
+
+ /**
+ * Gets the dependency name.
+ *
+ * @return the dependency name
+ */
public String getDependencyName() {
return dependencyName;
}
+ /**
+ * Sets the dependency name.
+ *
+ * @param dependencyName the new dependency name
+ */
public void setDependencyName(String dependencyName) {
this.dependencyName = dependencyName;
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import org.onap.policy.rest.jpa.UserInfo;
-
/*
- * JPA for the BRMS Param Template.
- *
+ * JPA for the BRMS Param Template.
+ *
* @version: 0.1
*/
-
@Entity
-@Table(name="BRMSParamTemplate")
-@NamedQuery(name="BRMSParamTemplate.findAll", query="SELECT b FROM BRMSParamTemplate b ")
-public class BRMSParamTemplate implements Serializable{
+@Table(name = "BrmsParamTemplate")
+@NamedQuery(name = "BrmsParamTemplate.findAll", query = "SELECT b FROM BrmsParamTemplate b ")
+public class BrmsParamTemplate implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
- @Column(name="param_template_name", nullable=false, unique=true)
+ @Column(name = "param_template_name", nullable = false, unique = true)
@OrderBy("asc")
private String ruleName;
@Lob
- @Column(name="rule",nullable=false)
+ @Column(name = "rule", nullable = false)
private String rule;
- @Column(name="description", nullable=true, length=2048)
+ @Column(name = "description", nullable = true, length = 2048)
private String description;
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
+ @Column(name = "created_date", updatable = false)
private Date createdDate;
-
@ManyToOne(optional = false)
- @JoinColumn(name="created_by")
+ @JoinColumn(name = "created_by")
private UserInfo userCreatedBy;
public UserInfo getUserCreatedBy() {
}
@PrePersist
- public void prePersist() {
+ public void prePersist() {
Date date = new Date();
this.createdDate = date;
}
this.id = id;
}
-
public Date getCreatedDate() {
return this.createdDate;
}
this.description = description;
}
- public String getRule(){
+ public String getRule() {
return this.rule;
}
- public void setRule(String rule){
+ public void setRule(String rule) {
this.rule = rule;
}
- public String getRuleName(){
+ public String getRuleName() {
return this.ruleName;
}
- public void setRuleName(String ruleName){
+ public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
}
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
package org.onap.policy.rest.jpa;
+import com.att.research.xacml.api.Identifier;
+import com.att.research.xacml.api.XACML3;
+import com.att.research.xacml.std.IdentifierImpl;
+import com.fasterxml.jackson.annotation.JsonBackReference;
+
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Table;
import javax.persistence.Transient;
-import com.att.research.xacml.api.Identifier;
-import com.att.research.xacml.api.XACML3;
-import com.att.research.xacml.std.IdentifierImpl;
-import com.fasterxml.jackson.annotation.JsonBackReference;
-
-
/**
* The persistent class for the Categories database table.
- *
+ *
*/
@Entity
-@Table(name="Category")
-@NamedQuery(name="Category.findAll", query="SELECT c FROM Category c")
+@Table(name = "Category")
+@NamedQuery(name = "Category.findAll", query = "SELECT c FROM Category c")
public class Category implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
- @Column(name="grouping", nullable=false, length=64)
+ @Column(name = "grouping", nullable = false, length = 64)
private String grouping;
- @Column(name="is_standard", nullable=false)
+ @Column(name = "is_standard", nullable = false)
private char isStandard;
- @Column(name="xacml_id", nullable=false, unique=true, length=255)
+ @Column(name = "xacml_id", nullable = false, unique = true, length = 255)
private String xacmlId;
- @Column(name="short_name", nullable=false, length=64)
+ @Column(name = "short_name", nullable = false, length = 64)
private String shortName;
- //bi-directional many-to-one association to Attribute
- @OneToMany(mappedBy="categoryBean")
+ // bi-directional many-to-one association to Attribute
+ @OneToMany(mappedBy = "categoryBean")
@JsonBackReference
private Set<Attribute> attributes = new HashSet<>();
+ /**
+ * Instantiates a new category.
+ */
public Category() {
this.xacmlId = XACML3.ID_SUBJECT_CATEGORY_ACCESS_SUBJECT.stringValue();
this.grouping = "subject";
this.shortName = "subject";
}
+ /**
+ * Instantiates a new category.
+ *
+ * @param cat the cat
+ * @param grouping the grouping
+ * @param isStandard the is standard
+ */
public Category(Identifier cat, String grouping, char isStandard) {
if (cat != null) {
this.xacmlId = cat.stringValue();
}
}
+ /**
+ * Instantiates a new category.
+ *
+ * @param cat the cat
+ * @param grouping the grouping
+ */
public Category(Identifier cat, String grouping) {
this(cat, grouping, Category.STANDARD);
}
+ /**
+ * Instantiates a new category.
+ *
+ * @param cat the cat
+ * @param standard the standard
+ */
public Category(Identifier cat, char standard) {
this(cat, null, standard);
}
+ /**
+ * Instantiates a new category.
+ *
+ * @param cat the cat
+ */
public Category(Identifier cat) {
this(cat, Category.STANDARD);
}
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public int getId() {
return this.id;
}
+ /**
+ * Sets the id.
+ *
+ * @param id the new id
+ */
public void setId(int id) {
this.id = id;
}
+ /**
+ * Gets the grouping.
+ *
+ * @return the grouping
+ */
public String getGrouping() {
return this.grouping;
}
+ /**
+ * Sets the grouping.
+ *
+ * @param grouping the new grouping
+ */
public void setGrouping(String grouping) {
this.grouping = grouping;
}
+ /**
+ * Gets the checks if is standard.
+ *
+ * @return the checks if is standard
+ */
public char getIsStandard() {
return this.isStandard;
}
+ /**
+ * Sets the checks if is standard.
+ *
+ * @param isStandard the new checks if is standard
+ */
public void setIsStandard(char isStandard) {
this.isStandard = isStandard;
}
+ /**
+ * Gets the xacml id.
+ *
+ * @return the xacml id
+ */
public String getXacmlId() {
return this.xacmlId;
}
+ /**
+ * Sets the xacml id.
+ *
+ * @param xacmlId the new xacml id
+ */
public void setXacmlId(String xacmlId) {
this.xacmlId = xacmlId;
}
+ /**
+ * Gets the short name.
+ *
+ * @return the short name
+ */
public String getShortName() {
return this.shortName;
}
+ /**
+ * Sets the short name.
+ *
+ * @param shortName the new short name
+ */
public void setShortName(String shortName) {
this.shortName = shortName;
}
+ /**
+ * Gets the attributes.
+ *
+ * @return the attributes
+ */
public Set<Attribute> getAttributes() {
return this.attributes;
}
+ /**
+ * Sets the attributes.
+ *
+ * @param attributes the new attributes
+ */
public void setAttributes(Set<Attribute> attributes) {
this.attributes = attributes;
}
+ /**
+ * Adds the attribute.
+ *
+ * @param attribute the attribute
+ * @return the attribute
+ */
public Attribute addAttribute(Attribute attribute) {
getAttributes().add(attribute);
attribute.setCategoryBean(this);
return attribute;
}
+ /**
+ * Removes the attribute.
+ *
+ * @param attribute the attribute
+ * @return the attribute
+ */
public Attribute removeAttribute(Attribute attribute) {
getAttributes().remove(attribute);
attribute.setCategoryBean(null);
return attribute;
}
+ /**
+ * Checks if is standard.
+ *
+ * @return true, if is standard
+ */
@Transient
public boolean isStandard() {
return this.isStandard == Category.STANDARD;
}
+ /**
+ * Checks if is custom.
+ *
+ * @return true, if is custom
+ */
@Transient
public boolean isCustom() {
return this.isStandard == Category.CUSTOM;
}
+ /**
+ * Extract grouping.
+ *
+ * @param xacmlId the xacml id
+ * @return the string
+ */
@Transient
- public static String extractGrouping(String xacmlId) {
+ public static String extractGrouping(String xacmlId) {
if (xacmlId == null) {
return null;
}
String[] parts = xacmlId.split("[:]");
- if (xacmlId.matches(".*:attribute\\-category:.*")) {
- if (parts.length > 0) {
- return parts[parts.length - 1];
- }
- } else if (xacmlId.matches(".*:[a-zA-Z]+[\\-]category:.*")) {
- if (parts.length <= 0) {
- return null;
- }
+ if (xacmlId.matches(".*:attribute\\-category:.*")) {
+ return parts[parts.length - 1];
+ } else if (xacmlId.matches(".*:[a-zA-Z]+[\\-]category:.*")) {
for (String part : parts) {
int index = part.indexOf("-category");
if (index > 0) {
return null;
}
+ /**
+ * Gets the identifer.
+ *
+ * @return the identifer
+ */
@Transient
public Identifier getIdentifer() {
return new IdentifierImpl(this.xacmlId);
}
+ /**
+ * To string.
+ *
+ * @return the string
+ */
@Transient
@Override
public String toString() {
- return "Category [id=" + id + ", grouping=" + grouping
- + ", isStandard=" + isStandard + ", xacmlId=" + xacmlId
- + ", attributes=" + attributes + "]";
+ return "Category [id=" + id + ", grouping=" + grouping + ", isStandard=" + isStandard + ", xacmlId=" + xacmlId
+ + ", attributes=" + attributes + "]";
}
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
package org.onap.policy.rest.jpa;
+
/*
*
*/
import java.io.Serializable;
import java.util.Date;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-
+/**
+ * The Class ClosedLoopD2Services.
+ */
@Entity
@Table(name = "ClosedLoopD2Services")
-@NamedQuery(name="ClosedLoopD2Services.findAll", query="SELECT c FROM ClosedLoopD2Services c ")
-public class ClosedLoopD2Services implements Serializable{
+@NamedQuery(name = "ClosedLoopD2Services.findAll", query = "SELECT c FROM ClosedLoopD2Services c ")
+public class ClosedLoopD2Services implements Serializable {
private static final long serialVersionUID = 1L;
@Id
- @Column(name ="id")
+ @Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
- @Column(name="service_Name", nullable=false, unique=true)
+ @Column(name = "service_Name", nullable = false, unique = true)
@OrderBy("asc")
private String serviceName;
- @Column(name="description", nullable=true, length=2048)
+ @Column(name = "description", nullable = true, length = 2048)
private String description;
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
+ @Column(name = "created_date", updatable = false)
private Date createdDate;
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="modified_date", nullable=false)
+ @Column(name = "modified_date", nullable = false)
private Date modifiedDate;
@ManyToOne(optional = false)
- @JoinColumn(name="created_by")
+ @JoinColumn(name = "created_by")
private UserInfo userCreatedBy;
@ManyToOne(optional = false)
- @JoinColumn(name="modified_by")
+ @JoinColumn(name = "modified_by")
private UserInfo userModifiedBy;
+ /**
+ * Instantiates a new closed loop D 2 services.
+ */
public ClosedLoopD2Services() {
this.setModifiedDate(new Date());
}
-
+ /**
+ * Gets the user created by.
+ *
+ * @return the user created by
+ */
public UserInfo getUserCreatedBy() {
return userCreatedBy;
}
+ /**
+ * Sets the user created by.
+ *
+ * @param userCreatedBy the new user created by
+ */
public void setUserCreatedBy(UserInfo userCreatedBy) {
this.userCreatedBy = userCreatedBy;
}
+ /**
+ * Gets the user modified by.
+ *
+ * @return the user modified by
+ */
public UserInfo getUserModifiedBy() {
return userModifiedBy;
}
+ /**
+ * Sets the user modified by.
+ *
+ * @param userModifiedBy the new user modified by
+ */
public void setUserModifiedBy(UserInfo userModifiedBy) {
this.userModifiedBy = userModifiedBy;
}
+ /**
+ * Pre persist.
+ */
@PrePersist
- public void prePersist() {
+ public void prePersist() {
Date date = new Date();
this.createdDate = date;
this.modifiedDate = date;
}
+ /**
+ * Pre update.
+ */
@PreUpdate
public void preUpdate() {
this.modifiedDate = new Date();
}
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public int getId() {
return id;
}
+ /**
+ * Sets the id.
+ *
+ * @param id the new id
+ */
public void setId(int id) {
this.id = id;
}
+ /**
+ * Gets the service name.
+ *
+ * @return the service name
+ */
public String getServiceName() {
return serviceName;
}
+ /**
+ * Sets the service name.
+ *
+ * @param serviceName the new service name
+ */
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
public String getDescription() {
return description;
}
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ * Gets the created date.
+ *
+ * @return the created date
+ */
public Date getCreatedDate() {
return createdDate;
}
+ /**
+ * Sets the created date.
+ *
+ * @param createdDate the new created date
+ */
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
+ /**
+ * Gets the modified date.
+ *
+ * @return the modified date
+ */
public Date getModifiedDate() {
return modifiedDate;
}
+ /**
+ * Sets the modified date.
+ *
+ * @param modifiedDate the new modified date
+ */
public void setModifiedDate(Date modifiedDate) {
this.modifiedDate = modifiedDate;
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
import java.io.Serializable;
import java.util.Date;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-
+/**
+ * The Class ClosedLoopSite.
+ */
@Entity
@Table(name = "ClosedLoopSite")
-@NamedQuery(name="ClosedLoopSite.findAll", query="SELECT c FROM ClosedLoopSite c ")
-public class ClosedLoopSite implements Serializable{
+@NamedQuery(name = "ClosedLoopSite.findAll", query = "SELECT c FROM ClosedLoopSite c ")
+public class ClosedLoopSite implements Serializable {
private static final long serialVersionUID = 1L;
-
@Id
- @Column(name ="id")
+ @Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
- @Column(name="site_Name", nullable=false, unique=true)
+ @Column(name = "site_Name", nullable = false, unique = true)
@OrderBy("asc")
private String siteName;
- @Column(name="description", nullable=true, length=2048)
+ @Column(name = "description", nullable = true, length = 2048)
private String description;
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
+ @Column(name = "created_date", updatable = false)
private Date createdDate;
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="modified_date", nullable=false)
+ @Column(name = "modified_date", nullable = false)
private Date modifiedDate;
@ManyToOne(optional = false)
- @JoinColumn(name="created_by")
+ @JoinColumn(name = "created_by")
private UserInfo userCreatedBy;
@ManyToOne(optional = false)
- @JoinColumn(name="modified_by")
+ @JoinColumn(name = "modified_by")
private UserInfo userModifiedBy;
+ /**
+ * Instantiates a new closed loop site.
+ */
public ClosedLoopSite() {
this.setModifiedDate(new Date());
}
-
+ /**
+ * Gets the user created by.
+ *
+ * @return the user created by
+ */
public UserInfo getUserCreatedBy() {
return userCreatedBy;
}
+ /**
+ * Sets the user created by.
+ *
+ * @param userCreatedBy the new user created by
+ */
public void setUserCreatedBy(UserInfo userCreatedBy) {
this.userCreatedBy = userCreatedBy;
}
+ /**
+ * Gets the user modified by.
+ *
+ * @return the user modified by
+ */
public UserInfo getUserModifiedBy() {
return userModifiedBy;
}
+ /**
+ * Sets the user modified by.
+ *
+ * @param userModifiedBy the new user modified by
+ */
public void setUserModifiedBy(UserInfo userModifiedBy) {
this.userModifiedBy = userModifiedBy;
}
+ /**
+ * Pre persist.
+ */
@PrePersist
- public void prePersist() {
+ public void prePersist() {
Date date = new Date();
this.createdDate = date;
this.modifiedDate = date;
}
+ /**
+ * Pre update.
+ */
@PreUpdate
public void preUpdate() {
this.modifiedDate = new Date();
}
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public int getId() {
return id;
}
+ /**
+ * Sets the id.
+ *
+ * @param id the new id
+ */
public void setId(int id) {
this.id = id;
}
+ /**
+ * Gets the site name.
+ *
+ * @return the site name
+ */
public String getSiteName() {
return siteName;
}
+ /**
+ * Sets the site name.
+ *
+ * @param siteName the new site name
+ */
public void setSiteName(String siteName) {
this.siteName = siteName;
}
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
public String getDescription() {
return description;
}
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ * Gets the created date.
+ *
+ * @return the created date
+ */
public Date getCreatedDate() {
return createdDate;
}
+ /**
+ * Sets the created date.
+ *
+ * @param createdDate the new created date
+ */
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
+ /**
+ * Gets the modified date.
+ *
+ * @return the modified date
+ */
public Date getModifiedDate() {
return modifiedDate;
}
+ /**
+ * Sets the modified date.
+ *
+ * @param modifiedDate the new modified date
+ */
public void setModifiedDate(Date modifiedDate) {
this.modifiedDate = modifiedDate;
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import javax.persistence.Table;
@Entity
-@Table(name="ClosedLoops")
-@NamedQueries({
- @NamedQuery(name="ClosedLoops.findAll", query="SELECT e FROM ClosedLoops e"),
- @NamedQuery(name="ClosedLoops.deleteAll", query="DELETE FROM ClosedLoops WHERE 1=1")
-})
+@Table(name = "ClosedLoops")
+@NamedQueries(
+ { @NamedQuery(name = "ClosedLoops.findAll", query = "SELECT e FROM ClosedLoops e"),
+ @NamedQuery(name = "ClosedLoops.deleteAll", query = "DELETE FROM ClosedLoops WHERE 1=1") })
public class ClosedLoops implements Serializable {
-
- /**
- *
- */
private static final long serialVersionUID = -7796845092457926842L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
- @Column(name="closedLoopControlName", nullable=false, length=255)
+ @Column(name = "closedLoopControlName", nullable = false, length = 255)
@OrderBy("asc")
private String closedLoopControlName;
- @Column(name="alarmConditions", nullable=true, length=255)
+ @Column(name = "alarmConditions", nullable = true, length = 255)
private String alarmConditions;
- @Column(name="yaml", nullable=true, length=1028)
+ @Column(name = "yaml", nullable = true, length = 1028)
private String yaml;
public ClosedLoops() {
- //An empty constructor
+ // An empty constructor
}
public int getId() {
* ONAP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.onap.policy.rest.jpa;
+
+import com.fasterxml.jackson.annotation.JsonBackReference;
+
/*
*/
import java.io.Serializable;
import java.util.Date;
-import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
* The Entity class to persist a policy object configuration data
*/
+import lombok.EqualsAndHashCode;
-import com.fasterxml.jackson.annotation.JsonBackReference;
-
+/**
+ * The Class ConfigurationDataEntity.
+ */
+// @formatter:off
@Entity
-@Table(name="ConfigurationDataEntity")
-@NamedQueries({
- @NamedQuery(name="ConfigurationDataEntity.findAll", query="SELECT e FROM ConfigurationDataEntity e "),
- @NamedQuery(name="ConfigurationDataEntity.deleteAll", query="DELETE FROM ConfigurationDataEntity WHERE 1=1")
-})
+@Table(name = "ConfigurationDataEntity")
+@NamedQueries(
+ {
+ @NamedQuery(name = "ConfigurationDataEntity.findAll", query = "SELECT e FROM ConfigurationDataEntity e "),
+ @NamedQuery(name = "ConfigurationDataEntity.deleteAll", query = "DELETE FROM ConfigurationDataEntity WHERE 1=1")
+ }
+)
+@EqualsAndHashCode
+//@formatter:on
public class ConfigurationDataEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="configurationDataId")
+ @Column(name = "configurationDataId")
@JsonBackReference
private long configurationDataId;
- @Column(name="configurationName", nullable=false, length=255)
+ @Column(name = "configurationName", nullable = false, length = 255)
private String configurationName = "";
@Version
- @Column(name="version")
+ @Column(name = "version")
private int version;
- @Column(name="configType", nullable=false, length=255)
+ @Column(name = "configType", nullable = false, length = 255)
private String configType = "NoType";
@Lob
- @Column(name="configBody", nullable=false, columnDefinition="TEXT")
+ @Column(name = "configBody", nullable = false, columnDefinition = "TEXT")
private String configBody = "NoBody";
- @Column(name="created_by", nullable=false, length=255)
+ @Column(name = "created_by", nullable = false, length = 255)
private String createdBy = "guest";
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
+ @Column(name = "created_date", updatable = false)
private Date createdDate;
- @Column(name="description", nullable=false, length=2048)
+ @Column(name = "description", nullable = false, length = 2048)
private String description = "NoDescription";
- @Column(name="modified_by", nullable=false, length=255)
+ @Column(name = "modified_by", nullable = false, length = 255)
private String modifiedBy = "guest";
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="modified_date", nullable=false)
+ @Column(name = "modified_date", nullable = false)
private Date modifiedDate;
- @Column(name="deleted", nullable=false)
+ @Column(name = "deleted", nullable = false)
private boolean deleted = false;
+ /**
+ * Instantiates a new configuration data entity.
+ */
public ConfigurationDataEntity() {
- //An empty constructor
+ // An empty constructor
}
+ /**
+ * Pre persist.
+ */
@PrePersist
- public void prePersist() {
+ public void prePersist() {
Date date = new Date();
this.createdDate = date;
this.modifiedDate = date;
}
+ /**
+ * Pre update.
+ */
@PreUpdate
public void preUpdate() {
this.modifiedDate = new Date();
}
+
/**
+ * Gets the configuration data id.
+ *
* @return the configurationDataId
*/
public long getConfigurationDataId() {
return configurationDataId;
}
+
/**
- * @param configurationDataId the configurationDataId to set
+ * Sets the configuration name.
+ *
+ * @param configurationName the new configuration name
*/
public void setConfigurationName(String configurationName) {
this.configurationName = configurationName;
}
- public String getConfigurationName(){
+
+ /**
+ * Gets the configuration name.
+ *
+ * @return the configuration name
+ */
+ public String getConfigurationName() {
return this.configurationName;
}
+
/**
+ * Gets the config type.
+ *
* @return the configType
*/
public String getConfigType() {
return configType;
}
+
/**
+ * Sets the config type.
+ *
* @param configType the configType to set
*/
public void setConfigType(String configType) {
this.configType = configType;
}
+
/**
+ * Gets the config body.
+ *
* @return the configBody
*/
public String getConfigBody() {
return configBody;
}
+
/**
+ * Sets the config body.
+ *
* @param configBody the configBody to set
*/
public void setConfigBody(String configBody) {
this.configBody = configBody;
}
+
/**
+ * Gets the created by.
+ *
* @return the createdBy
*/
public String getCreatedBy() {
return createdBy;
}
+
/**
+ * Sets the created by.
+ *
* @param createdBy the createdBy to set
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
+
/**
+ * Gets the description.
+ *
* @return the description
*/
public String getDescription() {
return description;
}
+
/**
+ * Sets the description.
+ *
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
+
/**
+ * Gets the modified by.
+ *
* @return the modifiedBy
*/
public String getModifiedBy() {
return modifiedBy;
}
+
/**
+ * Sets the modified by.
+ *
* @param modifiedBy the modifiedBy to set
*/
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
+
/**
+ * Gets the modified date.
+ *
* @return the modifiedDate
*/
public Date getModifiedDate() {
return modifiedDate;
}
+
/**
+ * Sets the modified date.
+ *
* @param modifiedDate the modifiedDate to set
*/
public void setModifiedDate(Date modifiedDate) {
this.modifiedDate = modifiedDate;
}
+
/**
+ * Gets the version.
+ *
* @return the version
*/
public int getVersion() {
return version;
}
+
/**
+ * Gets the created date.
+ *
* @return the createdDate
*/
public Date getCreatedDate() {
}
/**
+ * Checks if is deleted.
+ *
* @return the deleted
*/
public boolean isDeleted() {
}
/**
+ * Sets the deleted.
+ *
* @param deleted the deleted to set
*/
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
-
- @Override
- public int hashCode() {
- return Objects.hash(configurationDataId, configurationName, version, configType,
- configBody, createdBy, createdDate, description, modifiedBy, modifiedDate, deleted);
- }
-
- @Override
- public boolean equals(Object obj) {
- if(obj == null){
- return false;
- }
- if(obj == this){
- return true;
- }
- if(!(obj instanceof ConfigurationDataEntity)){
- return false;
- }
-
- return configurationDataId == ((ConfigurationDataEntity) obj).configurationDataId &&
- configurationName.equals(((ConfigurationDataEntity) obj).configurationName) &&
- version == ((ConfigurationDataEntity) obj).version &&
- configType.equals(((ConfigurationDataEntity) obj).configType) &&
- configBody.equals(((ConfigurationDataEntity) obj).configBody) &&
- createdBy.equals(((ConfigurationDataEntity) obj).createdBy) &&
- createdDate.equals(((ConfigurationDataEntity) obj).createdDate) &&
- description.equals(((ConfigurationDataEntity) obj).description) &&
- modifiedBy.equals(((ConfigurationDataEntity) obj).modifiedBy) &&
- modifiedDate.equals(((ConfigurationDataEntity) obj).modifiedDate) &&
- deleted == ((ConfigurationDataEntity) obj).deleted;
- }
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import javax.persistence.Table;
@Entity
-@Table(name="ConstraintType")
-@NamedQuery(name="ConstraintType.findAll", query="SELECT a FROM ConstraintType a")
+@Table(name = "ConstraintType")
+@NamedQuery(name = "ConstraintType.findAll", query = "SELECT a FROM ConstraintType a")
public class ConstraintType implements Serializable {
private static final long serialVersionUID = 1L;
public static final String REGEXP_TYPE = "Regular Expression";
protected static final Map<String, String> defaults = new HashMap<>();
+
static {
- defaults.put(ENUMERATION_TYPE, "Enumerate a set of values that the attribute may be set to during policy creation.");
- defaults.put(RANGE_TYPE, "Set a range of min and/or max integer/double values the attribute can be set to during policy creation.");
- defaults.put(REGEXP_TYPE, "Define a regular expression the attribute must match against during policy creation.");
+ defaults.put(ENUMERATION_TYPE,
+ "Enumerate a set of values that the attribute may be set to during policy creation.");
+ defaults.put(RANGE_TYPE, "Set a range of min and/or max integer/double values "
+ + "the attribute can be set to during policy creation.");
+ defaults.put(REGEXP_TYPE,
+ "Define a regular expression the attribute must match against during policy creation.");
}
- private static final String[] RANGE_TYPES = {"minExclusive", "minInclusive", "maxExclusive", "maxInclusive"};
+
+ private static final String[] RANGE_TYPES =
+ { "minExclusive", "minInclusive", "maxExclusive", "maxInclusive" };
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
- @Column(name="constraint_type", nullable=false, length=64)
+ @Column(name = "constraint_type", nullable = false, length = 64)
private String constraintType;
- @Column(name="description", nullable=false, length=255)
+ @Column(name = "description", nullable = false, length = 255)
private String description;
- //bi-directional many-to-one association to Attribute
- @OneToMany(mappedBy="constraintType")
+ // bi-directional many-to-one association to Attribute
+ @OneToMany(mappedBy = "constraintType")
private Set<Attribute> attributes = new HashSet<>();
public ConstraintType() {
- //An empty constructor
+ // An empty constructor
}
public ConstraintType(String constraintType) {
* ONAP-REST
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import javax.persistence.NamedQuery;
import javax.persistence.Table;
-
/**
* The persistent class for the ConstraintValues database table.
- *
+ *
*/
@Entity
-@Table(name="ConstraintValues")
-@NamedQuery(name="ConstraintValue.findAll", query="SELECT c FROM ConstraintValue c")
+@Table(name = "ConstraintValues")
+@NamedQuery(name = "ConstraintValue.findAll", query = "SELECT c FROM ConstraintValue c")
public class ConstraintValue implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
- @Column(name="property")
+ @Column(name = "property")
private String property;
- @Column(name="value")
+ @Column(name = "value")
private String value;
- //bi-directional many-to-one association to Attribute
+ // bi-directional many-to-one association to Attribute
@ManyToOne
- @JoinColumn(name="attribute_id")
+ @JoinColumn(name = "attribute_id")
private Attribute attribute;
public ConstraintValue() {
- //An empty constructor
+ // An empty constructor
}
public ConstraintValue(String property, String value) {
* ONAP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import javax.persistence.Table;
@Entity
-@Table(name="DatabaseLockEntity")
+@Table(name = "DatabaseLockEntity")
public class DatabaseLockEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
- @Column(name="lock_key")
- private int lock_key = 1;
- public DatabaseLockEntity(){
- //An empty constructor
+ @Column(name = "lock_key")
+ private int lockKey = 1;
+
+ public DatabaseLockEntity() {
+ // An empty constructor
}
- public int getKey(){
- return lock_key;
+
+ public int getKey() {
+ return lockKey;
}
- public void setKey(int key){
- this.lock_key = key;
+
+ public void setKey(int key) {
+ this.lockKey = key;
}
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
package org.onap.policy.rest.jpa;
+import com.att.research.xacml.api.Identifier;
+import com.att.research.xacml.api.XACML3;
+import com.att.research.xacml.std.IdentifierImpl;
+import com.fasterxml.jackson.annotation.JsonBackReference;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Table;
import javax.persistence.Transient;
-import com.att.research.xacml.api.Identifier;
-import com.att.research.xacml.api.XACML3;
-import com.att.research.xacml.std.IdentifierImpl;
-import com.fasterxml.jackson.annotation.JsonBackReference;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-
/**
* The persistent class for the Datatype database table.
- *
+ *
*/
@Entity
-@Table(name="Datatype")
-@NamedQuery(name="Datatype.findAll", query="SELECT d FROM Datatype d")
+@Table(name = "Datatype")
+@NamedQuery(name = "Datatype.findAll", query = "SELECT d FROM Datatype d")
public class Datatype implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
- @Column(name="is_standard", nullable=false)
+ @Column(name = "is_standard", nullable = false)
private char isStandard;
- @Column(name="xacml_id", nullable=false, unique=true, length=255)
+ @Column(name = "xacml_id", nullable = false, unique = true, length = 255)
private String xacmlId;
- @Column(name="short_name", nullable=false, length=64)
+ @Column(name = "short_name", nullable = false, length = 64)
private String shortName;
- //bi-directional many-to-one association to Attribute
- @OneToMany(mappedBy="datatypeBean")
+ // bi-directional many-to-one association to Attribute
+ @OneToMany(mappedBy = "datatypeBean")
@JsonBackReference
private Set<Attribute> attributes = new HashSet<>();
- //bi-directional many-to-one association to Attribute
- @OneToMany(mappedBy="datatypeBean")
+ // bi-directional many-to-one association to Attribute
+ @OneToMany(mappedBy = "datatypeBean")
@JsonIgnore
private Set<FunctionDefinition> functions = new HashSet<>();
- //bi-directional many-to-one association to Attribute
- @OneToMany(mappedBy="datatypeBean")
+ // bi-directional many-to-one association to Attribute
+ @OneToMany(mappedBy = "datatypeBean")
@JsonIgnore
private Set<FunctionArgument> arguments = new HashSet<>();
+ /**
+ * Instantiates a new datatype.
+ */
public Datatype() {
this.xacmlId = XACML3.ID_DATATYPE_STRING.stringValue();
this.isStandard = Datatype.STANDARD;
}
-
+ /**
+ * Instantiates a new datatype.
+ *
+ * @param id the id
+ * @param dt the dt
+ */
public Datatype(int id, Datatype dt) {
this.id = id;
this.isStandard = dt.isStandard;
this.attributes = new HashSet<>();
}
+ /**
+ * Instantiates a new datatype.
+ *
+ * @param identifier the identifier
+ * @param standard the standard
+ */
public Datatype(Identifier identifier, char standard) {
if (identifier != null) {
this.xacmlId = identifier.stringValue();
this.isStandard = standard;
}
+ /**
+ * Instantiates a new datatype.
+ *
+ * @param identifier the identifier
+ */
public Datatype(Identifier identifier) {
this(identifier, Datatype.STANDARD);
}
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public int getId() {
return this.id;
}
+ /**
+ * Sets the id.
+ *
+ * @param id the new id
+ */
public void setId(int id) {
this.id = id;
}
+ /**
+ * Gets the checks if is standard.
+ *
+ * @return the checks if is standard
+ */
public char getIsStandard() {
return this.isStandard;
}
+ /**
+ * Sets the checks if is standard.
+ *
+ * @param isStandard the new checks if is standard
+ */
public void setIsStandard(char isStandard) {
this.isStandard = isStandard;
}
+ /**
+ * Gets the xacml id.
+ *
+ * @return the xacml id
+ */
public String getXacmlId() {
return this.xacmlId;
}
+ /**
+ * Sets the xacml id.
+ *
+ * @param xacmlId the new xacml id
+ */
public void setXacmlId(String xacmlId) {
this.xacmlId = xacmlId;
}
+ /**
+ * Gets the short name.
+ *
+ * @return the short name
+ */
public String getShortName() {
return shortName;
}
+ /**
+ * Sets the short name.
+ *
+ * @param shortName the new short name
+ */
public void setShortName(String shortName) {
this.shortName = shortName;
}
+ /**
+ * Gets the attributes.
+ *
+ * @return the attributes
+ */
public Set<Attribute> getAttributes() {
return this.attributes;
}
+ /**
+ * Sets the attributes.
+ *
+ * @param attributes the new attributes
+ */
public void setAttributes(Set<Attribute> attributes) {
this.attributes = attributes;
}
+ /**
+ * Adds the attribute.
+ *
+ * @param attribute the attribute
+ * @return the attribute
+ */
public Attribute addAttribute(Attribute attribute) {
getAttributes().add(attribute);
attribute.setDatatypeBean(this);
return attribute;
}
+ /**
+ * Removes the attribute.
+ *
+ * @param attribute the attribute
+ * @return the attribute
+ */
public Attribute removeAttribute(Attribute attribute) {
getAttributes().remove(attribute);
attribute.setDatatypeBean(null);
return attribute;
}
+ /**
+ * Removes the attribute.
+ *
+ * @param function the function
+ * @return the function definition
+ */
+ public FunctionDefinition removeAttribute(FunctionDefinition function) {
+ getFunctions().remove(function);
+ function.setDatatypeBean(null);
+
+ return function;
+ }
+
+ /**
+ * Gets the functions.
+ *
+ * @return the functions
+ */
public Set<FunctionDefinition> getFunctions() {
return this.functions;
}
+ /**
+ * Sets the functions.
+ *
+ * @param functions the new functions
+ */
public void setFunctions(Set<FunctionDefinition> functions) {
this.functions = functions;
}
+ /**
+ * Adds the function.
+ *
+ * @param function the function
+ * @return the function definition
+ */
public FunctionDefinition addFunction(FunctionDefinition function) {
getFunctions().add(function);
function.setDatatypeBean(this);
return function;
}
- public FunctionDefinition removeAttribute(FunctionDefinition function) {
- getFunctions().remove(function);
- function.setDatatypeBean(null);
-
- return function;
- }
-
+ /**
+ * Gets the arguments.
+ *
+ * @return the arguments
+ */
public Set<FunctionArgument> getArguments() {
return this.arguments;
}
+ /**
+ * Sets the arguments.
+ *
+ * @param argument the new arguments
+ */
public void setArguments(Set<FunctionArgument> argument) {
this.arguments = argument;
}
+ /**
+ * Adds the argument.
+ *
+ * @param argument the argument
+ * @return the function argument
+ */
public FunctionArgument addArgument(FunctionArgument argument) {
getArguments().add(argument);
argument.setDatatypeBean(this);
return argument;
}
+ /**
+ * Removes the argument.
+ *
+ * @param argument the argument
+ * @return the function argument
+ */
public FunctionArgument removeArgument(FunctionArgument argument) {
getArguments().remove(argument);
argument.setDatatypeBean(null);
return argument;
}
+ /**
+ * Gets the identifer.
+ *
+ * @return the identifer
+ */
@Transient
public Identifier getIdentifer() {
return new IdentifierImpl(this.xacmlId);
}
+ /**
+ * Gets the identifer by short name.
+ *
+ * @return the identifer by short name
+ */
@Transient
public Identifier getIdentiferByShortName() {
return new IdentifierImpl(this.shortName);
}
+ /**
+ * Checks if is standard.
+ *
+ * @return true, if is standard
+ */
@Transient
public boolean isStandard() {
return this.isStandard == Datatype.STANDARD;
}
+ /**
+ * Checks if is custom.
+ *
+ * @return true, if is custom
+ */
@Transient
public boolean isCustom() {
return this.isStandard == Datatype.CUSTOM;
}
+ /**
+ * To string.
+ *
+ * @return the string
+ */
@Transient
@Override
public String toString() {
- return "Datatype [id=" + id + ", isStandard=" + isStandard
- + ", xacmlId=" + xacmlId + ", shortName=" + shortName
- + ", attributes=" + attributes + ", functions=" + functions
- + ", arguments=" + arguments + "]";
+ return "Datatype [id=" + id + ", isStandard=" + isStandard + ", xacmlId=" + xacmlId + ", shortName=" + shortName
+ + ", attributes=" + attributes + ", functions=" + functions + ", arguments=" + arguments + "]";
}
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.onap.policy.rest.jpa;
+
/*
*/
import java.io.Serializable;
import javax.persistence.OrderBy;
import javax.persistence.Table;
-
@Entity
-@Table(name="DCAEUsers")
-@NamedQuery(name="DCAEUsers.findAll", query="SELECT e FROM DCAEUsers e ")
-public class DCAEUsers implements Serializable {
+@Table(name = "DcaeUsers")
+@NamedQuery(name = "DcaeUsers.findAll", query = "SELECT e FROM DcaeUsers e ")
+public class DcaeUsers implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
- @Column(name="name", nullable=false)
+ @Column(name = "name", nullable = false)
@OrderBy("asc")
private String name;
- @Column(name="description ")
- private String description ;
+ @Column(name = "description ")
+ private String description;
public int getId() {
return this.id;
public void setId(int id) {
this.id = id;
}
+
public String getName() {
return this.name;
}
this.name = name;
}
+
public String getDescriptionValue() {
- return this.description ;
+ return this.description;
}
- public void setDescriptionValue(String description ) {
- this.description = description ;
+ public void setDescriptionValue(String description) {
+ this.description = description;
}
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.onap.policy.rest.jpa;
+
/*
*/
import java.io.Serializable;
import javax.persistence.OrderBy;
import javax.persistence.Table;
-
@Entity
-@Table(name="DCAEuuid")
-@NamedQuery(name="DCAEuuid.findAll", query="SELECT e FROM DCAEuuid e ")
-public class DCAEuuid implements Serializable {
+@Table(name = "DcaeUuid")
+@NamedQuery(name = "DcaeUuid.findAll", query = "SELECT e FROM DcaeUuid e ")
+public class DcaeUuid implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
- @Column(name="name", nullable=false)
+ @Column(name = "name", nullable = false)
@OrderBy("asc")
private String name;
- @Column(name="description")
+ @Column(name = "description")
private String description;
public String getDescription() {
public void setId(int id) {
this.id = id;
}
+
public String getName() {
return this.name;
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import javax.persistence.TemporalType;
import javax.persistence.Transient;
-
+/**
+ * The Class DecisionSettings.
+ */
+// @formatter:off
@Entity
-@Table(name="DecisionSettings")
-@NamedQuery(name="DecisionSettings.findAll", query="SELECT a FROM DecisionSettings a order by a.priority asc, a.xacmlId asc")
+@Table(name = "DecisionSettings")
+@NamedQuery(
+ name = "DecisionSettings.findAll",
+ query = "SELECT a FROM DecisionSettings a order by a.priority asc, a.xacmlId asc"
+)
+//@formatter:on
public class DecisionSettings implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
+ @Column(name = "id")
private int id;
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
+ @Column(name = "created_date", updatable = false)
private Date createdDate;
- @Column(name="description", nullable=true, length=2048)
+ @Column(name = "description", nullable = true, length = 2048)
private String description;
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="modified_date", nullable=false)
+ @Column(name = "modified_date", nullable = false)
private Date modifiedDate;
- @Column(name="PRIORITY", nullable=true)
+ @Column(name = "PRIORITY", nullable = true)
@OrderBy("asc")
private String priority;
- @Column(name="xacml_id", unique = true, nullable=false)
+ @Column(name = "xacml_id", unique = true, nullable = false)
@OrderBy("asc")
private String xacmlId = "urn";
- //bi-directional many-to-one association to Datatype
+ // bi-directional many-to-one association to Datatype
@ManyToOne
- @JoinColumn(name="datatype")
+ @JoinColumn(name = "datatype")
private Datatype datatypeBean;
@Transient
private boolean mustBePresent = false;
@ManyToOne(optional = false)
- @JoinColumn(name="created_by")
+ @JoinColumn(name = "created_by")
private UserInfo userCreatedBy;
@ManyToOne(optional = false)
- @JoinColumn(name="modified_by")
+ @JoinColumn(name = "modified_by")
private UserInfo userModifiedBy;
+ /**
+ * Gets the user created by.
+ *
+ * @return the user created by
+ */
public UserInfo getUserCreatedBy() {
return userCreatedBy;
}
+ /**
+ * Sets the user created by.
+ *
+ * @param userCreatedBy the new user created by
+ */
public void setUserCreatedBy(UserInfo userCreatedBy) {
this.userCreatedBy = userCreatedBy;
}
+ /**
+ * Gets the user modified by.
+ *
+ * @return the user modified by
+ */
public UserInfo getUserModifiedBy() {
return userModifiedBy;
}
+ /**
+ * Sets the user modified by.
+ *
+ * @param userModifiedBy the new user modified by
+ */
public void setUserModifiedBy(UserInfo userModifiedBy) {
this.userModifiedBy = userModifiedBy;
}
+ /**
+ * Pre persist.
+ */
@PrePersist
- public void prePersist() {
+ public void prePersist() {
Date date = new Date();
this.createdDate = date;
this.modifiedDate = date;
}
+ /**
+ * Pre update.
+ */
@PreUpdate
public void preUpdate() {
this.modifiedDate = new Date();
}
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public int getId() {
return this.id;
}
+ /**
+ * Sets the id.
+ *
+ * @param id the new id
+ */
public void setId(int id) {
this.id = id;
}
-
+ /**
+ * Gets the created date.
+ *
+ * @return the created date
+ */
public Date getCreatedDate() {
return this.createdDate;
}
+ /**
+ * Sets the created date.
+ *
+ * @param createdDate the new created date
+ */
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
public String getDescription() {
return this.description;
}
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ * Gets the modified date.
+ *
+ * @return the modified date
+ */
public Date getModifiedDate() {
return this.modifiedDate;
}
+ /**
+ * Sets the modified date.
+ *
+ * @param modifiedDate the new modified date
+ */
public void setModifiedDate(Date modifiedDate) {
this.modifiedDate = modifiedDate;
}
+ /**
+ * Gets the xacml id.
+ *
+ * @return the xacml id
+ */
public String getXacmlId() {
return this.xacmlId;
}
+ /**
+ * Sets the xacml id.
+ *
+ * @param xacmlId the new xacml id
+ */
public void setXacmlId(String xacmlId) {
this.xacmlId = xacmlId;
}
+ /**
+ * Gets the datatype bean.
+ *
+ * @return the datatype bean
+ */
public Datatype getDatatypeBean() {
return this.datatypeBean;
}
+ /**
+ * Sets the datatype bean.
+ *
+ * @param datatypeBean the new datatype bean
+ */
public void setDatatypeBean(Datatype datatypeBean) {
this.datatypeBean = datatypeBean;
}
+ /**
+ * Gets the issuer.
+ *
+ * @return the issuer
+ */
@Transient
public String getIssuer() {
return issuer;
}
+ /**
+ * Sets the issuer.
+ *
+ * @param issuer the new issuer
+ */
@Transient
public void setIssuer(String issuer) {
this.issuer = issuer;
}
+ /**
+ * Checks if is must be present.
+ *
+ * @return true, if is must be present
+ */
@Transient
public boolean isMustBePresent() {
return mustBePresent;
}
+ /**
+ * Sets the must be present.
+ *
+ * @param mustBePresent the new must be present
+ */
@Transient
public void setMustBePresent(boolean mustBePresent) {
this.mustBePresent = mustBePresent;
}
+ /**
+ * Gets the priority.
+ *
+ * @return the priority
+ */
public String getPriority() {
return priority;
}
+ /**
+ * Sets the priority.
+ *
+ * @param priority the new priority
+ */
public void setPriority(String priority) {
this.priority = priority;
}
}
-
* ONAP-REST
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-
+/**
+ * The Class DescriptiveScope.
+ */
@Entity
@Table(name = "DescriptiveScope")
-@NamedQuery(name = "DescriptiveScope.findAll", query= "Select p from DescriptiveScope p")
+@NamedQuery(name = "DescriptiveScope.findAll", query = "Select p from DescriptiveScope p")
public class DescriptiveScope implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "Id")
private int id;
- @Column(name="scopename", nullable=false)
+ @Column(name = "scopename", nullable = false)
@OrderBy("asc")
private String descriptiveScopeName;
- @Column(name="description", nullable=true, length=2048)
+ @Column(name = "description", nullable = true, length = 2048)
private String description;
- @Column(name="search", nullable=true)
+ @Column(name = "search", nullable = true)
@OrderBy("asc")
private String search;
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
+ @Column(name = "created_date", updatable = false)
private Date createdDate;
@Temporal(TemporalType.TIMESTAMP)
- @Column(name="modified_date", nullable=false)
+ @Column(name = "modified_date", nullable = false)
private Date modifiedDate;
@ManyToOne(optional = false)
- @JoinColumn(name="created_by")
+ @JoinColumn(name = "created_by")
private UserInfo userCreatedBy;
@ManyToOne(optional = false)
- @JoinColumn(name="modified_by")
+ @JoinColumn(name = "modified_by")
private UserInfo userModifiedBy;
+ /**
+ * Gets the user created by.
+ *
+ * @return the user created by
+ */
public UserInfo getUserCreatedBy() {
return userCreatedBy;
}
+ /**
+ * Sets the user created by.
+ *
+ * @param userCreatedBy the new user created by
+ */
public void setUserCreatedBy(UserInfo userCreatedBy) {
this.userCreatedBy = userCreatedBy;
}
+ /**
+ * Gets the user modified by.
+ *
+ * @return the user modified by
+ */
public UserInfo getUserModifiedBy() {
return userModifiedBy;
}
+ /**
+ * Sets the user modified by.
+ *
+ * @param userModifiedBy the new user modified by
+ */
public void setUserModifiedBy(UserInfo userModifiedBy) {
this.userModifiedBy = userModifiedBy;
}
+ /**
+ * Pre persist.
+ */
@PrePersist
- public void prePersist() {
+ public void prePersist() {
Date date = new Date();
this.createdDate = date;
this.modifiedDate = date;
}
+ /**
+ * Pre update.
+ */
@PreUpdate
public void preUpdate() {
this.modifiedDate = new Date();
}
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
public int getId() {
return this.id;
}
+
+ /**
+ * Sets the id.
+ *
+ * @param id the new id
+ */
public void setId(int id) {
this.id = id;
}
+ /**
+ * Gets the scope name.
+ *
+ * @return the scope name
+ */
public String getScopeName() {
return descriptiveScopeName;
}
+ /**
+ * Sets the scope name.
+ *
+ * @param descriptiveScopeName the new scope name
+ */
public void setScopeName(String descriptiveScopeName) {
this.descriptiveScopeName = descriptiveScopeName;
}
+ /**
+ * Gets the search.
+ *
+ * @return the search
+ */
public String getSearch() {
return search;
}
+ /**
+ * Sets the search.
+ *
+ * @param search the new search
+ */
public void setSearch(String search) {
this.search = search;
}
+ /**
+ * Gets the created date.
+ *
+ * @return the created date
+ */
public Date getCreatedDate() {
return this.createdDate;
}
+ /**
+ * Sets the created date.
+ *
+ * @param createdDate the new created date
+ */
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
public String getDescription() {
return this.description;
}
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ * Gets the modified date.
+ *
+ * @return the modified date
+ */
public Date getModifiedDate() {
return this.modifiedDate;
}
+ /**
+ * Sets the modified date.
+ *
+ * @param modifiedDate the new modified date
+ */
public void setModifiedDate(Date modifiedDate) {
this.modifiedDate = modifiedDate;
}
* ONAP-REST
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@Table(name = "DictionaryData")
@NamedQuery(name = "DictionaryData.findAll", query = "SELECT v FROM DictionaryData v ")
public class DictionaryData {
- private static final long serialVersionUID = 1L;
-
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
package org.onap.policy.rest.jpa;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import com.att.research.xacml.api.Identifier;
+
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
/**
* Set up the test.
- *
+ *
* @throws Exception on test errors
*/
@Before
data.removeAttribute(new Attribute());
data.isStandard();
data.isCustom();
- Category.extractGrouping("urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject");
data.getIdentifer();
data.toString();
assertTrue(data.getAttributes() != null);
assertTrue("Test".equals(data.getShortName()));
data.setXacmlId("Test");
assertTrue("Test".equals(data.getXacmlId()));
+
+ data.setIsStandard(Category.STANDARD);
+ assertEquals(Category.STANDARD, data.getIsStandard());
+ assertTrue(data.isStandard());
+ assertFalse(data.isCustom());
+
+ data.setIsStandard(Category.CUSTOM);
+ assertEquals(Category.CUSTOM, data.getIsStandard());
+ assertFalse(data.isStandard());
+ assertTrue(data.isCustom());
+
+ Identifier categoryIdentifier = new DummyIdentifier();
+ Category data2 = new Category(categoryIdentifier,
+ "urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject", Category.STANDARD);
+ assertEquals(DummyIdentifier.class.getName(), data2.getIdentifer().stringValue());
+
+ Category data3 = new Category(categoryIdentifier,
+ "urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject");
+ assertEquals(DummyIdentifier.class.getName(), data3.getIdentifer().stringValue());
+
+ assertEquals("subject",
+ Category.extractGrouping("urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject"));
+ assertNull(Category.extractGrouping(null));
+ assertNull(Category.extractGrouping("some random string"));
+ assertNull(Category.extractGrouping(""));
+ assertEquals("intermediary-attribute", Category
+ .extractGrouping("urn:oasis:names:tc:xacml:1.0:attribute-category:intermediary-attribute"));
}
@Test
assertTrue(data.isStandard());
data.setIsStandard(Datatype.CUSTOM);
assertTrue(data.isCustom());
+
+ data.setIsStandard(Category.STANDARD);
+ assertEquals(Category.STANDARD, data.getIsStandard());
+ assertTrue(data.isStandard());
+ assertFalse(data.isCustom());
+
+ data.setIsStandard(Category.CUSTOM);
+ assertEquals(Category.CUSTOM, data.getIsStandard());
+ assertFalse(data.isStandard());
+ assertTrue(data.isCustom());
+
+ Datatype data2 = new Datatype(new DummyIdentifier(), Datatype.STANDARD);
+ assertEquals(DummyIdentifier.class.getName(), data2.getIdentifer().stringValue());
}
@Test
* ONAP-REST
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.rest.jpa;
import static org.junit.Assert.assertTrue;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-public class BRMSDictionaryJPATest {
+/**
+ * The Class BrmsDictionaryJpaTest.
+ */
+public class BrmsDictionaryJpaTest {
- private static Logger logger = FlexLogger.getLogger(BRMSDictionaryJPATest.class);
+ private static Logger logger = FlexLogger.getLogger(BrmsDictionaryJpaTest.class);
private UserInfo userInfo;
+ /**
+ * Sets the up.
+ *
+ * @throws Exception the exception
+ */
@Before
public void setUp() throws Exception {
logger.info("setUp: Entering");
logger.info("setUp: exit");
}
+ /**
+ * Test BRMS param template.
+ */
@Test
- public void testBRMSParamTemplate(){
- BRMSParamTemplate data = new BRMSParamTemplate();
+ public void testBrmsParamTemplate() {
+ BrmsParamTemplate data = new BrmsParamTemplate();
data.prePersist();
data.setId(1);
assertTrue(1 == data.getId());
data.setDescription("Test");
assertTrue("Test".equals(data.getDescription()));
data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getCreatedDate() != null);
data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
+ assertTrue(data.getUserCreatedBy() != null);
}
+ /**
+ * Test BRMS controller.
+ */
@Test
- public void testBRMSController(){
- BRMSController data = new BRMSController();
+ public void testBrmsController() {
+ BrmsController data = new BrmsController();
data.preUpdate();
data.prePersist();
data.setId(1);
data.setDescription("Test");
assertTrue("Test".equals(data.getDescription()));
data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getCreatedDate() != null);
data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
+ assertTrue(data.getModifiedDate() != null);
data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
+ assertTrue(data.getUserCreatedBy() != null);
data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
+ assertTrue(data.getUserModifiedBy() != null);
}
+ /**
+ * Test BRMS dependency.
+ */
@Test
- public void testBRMSDependency(){
- BRMSDependency data = new BRMSDependency();
+ public void testrmsDependency() {
+ BrmsDependency data = new BrmsDependency();
data.preUpdate();
data.prePersist();
data.setId(1);
data.setDescription("Test");
assertTrue("Test".equals(data.getDescription()));
data.setCreatedDate(new Date());
- assertTrue(data.getCreatedDate()!=null);
+ assertTrue(data.getCreatedDate() != null);
data.setModifiedDate(new Date());
- assertTrue(data.getModifiedDate()!=null);
+ assertTrue(data.getModifiedDate() != null);
data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
+ assertTrue(data.getUserCreatedBy() != null);
data.setUserModifiedBy(userInfo);
- assertTrue(data.getUserModifiedBy()!=null);
+ assertTrue(data.getUserModifiedBy() != null);
}
}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import com.att.research.xacml.api.Identifier;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * Dummy category identifier class.
+ */
+public class DummyIdentifier implements Identifier {
+
+ @Override
+ public String stringValue() {
+ return this.getClass().getName();
+ }
+
+ @Override
+ public URI getUri() {
+ try {
+ return new URI(this.getClass().getName());
+ } catch (URISyntaxException e) {
+ return null;
+ }
+ }
+}
* ONAP-REST
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.rest.jpa;
import static org.junit.Assert.assertTrue;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-public class MicroServiceDictionaryJPATest {
+/**
+ * The Class MicroServiceDictionaryJpaTest.
+ */
+public class MicroServiceDictionaryJpaTest {
- private static Logger logger = FlexLogger.getLogger(MicroServiceDictionaryJPATest.class);
+ private static Logger logger = FlexLogger.getLogger(MicroServiceDictionaryJpaTest.class);
private UserInfo userInfo;
+ /**
+ * Sets the up.
+ *
+ * @throws Exception the exception
+ */
@Before
public void setUp() throws Exception {
logger.info("setUp: Entering");
logger.info("setUp: exit");
}
+ /**
+ * Test DCAE users.
+ */
@Test
- public void testDCAEUsers(){
- DCAEUsers data = new DCAEUsers();
+ public void testDcaeUsers() {
+ DcaeUsers data = new DcaeUsers();
data.setId(1);
assertTrue(1 == data.getId());
data.setName("Test");
assertTrue("Test".equals(data.getDescriptionValue()));
}
+ /**
+ * Test DCA euuid.
+ */
@Test
- public void testDCAEuuid(){
- DCAEuuid data = new DCAEuuid();
+ public void testDcaeUuid() {
+ DcaeUuid data = new DcaeUuid();
data.setId(1);
assertTrue(1 == data.getId());
data.setName("Test");
assertTrue("Test".equals(data.getDescription()));
}
+ /**
+ * Test MS config name.
+ */
@Test
- public void testMSConfigName(){
+ public void testMsConfigName() {
MicroServiceConfigName data = new MicroServiceConfigName();
data.setId(1);
assertTrue(1 == data.getId());
assertTrue("Test".equals(data.getDescriptionValue()));
}
+ /**
+ * Test MS config location.
+ */
@Test
- public void testMSConfigLocation(){
+ public void testMsConfigLocation() {
MicroServiceLocation data = new MicroServiceLocation();
data.setId(1);
assertTrue(1 == data.getId());
assertTrue("Test".equals(data.getDescriptionValue()));
}
+ /**
+ * Test MS models.
+ */
@Test
- public void testMSModels(){
+ public void testMsModels() {
MicroServiceModels data = new MicroServiceModels();
data.setId(1);
assertTrue(1 == data.getId());
data.setRef_attributes("Test");
assertTrue("Test".equals(data.getRef_attributes()));
data.setUserCreatedBy(userInfo);
- assertTrue(data.getUserCreatedBy()!=null);
+ assertTrue(data.getUserCreatedBy() != null);
data.setSub_attributes("Test");
assertTrue("Test".equals(data.getSub_attributes()));
data.setVersion("Test");
assertTrue("Test".equals(data.getVersion()));
}
+ /**
+ * Test MS attribute dictionary.
+ */
@Test
- public void testMSAttributeDictionary(){
+ public void testMsAttributeDictionary() {
MicroServiceAttribute data = new MicroServiceAttribute();
data.setId(1);
assertTrue(1 == data.getId());
assertTrue("Test".equals(data.getModelName()));
}
+ /**
+ * Test policy scope service.
+ */
@Test
- public void testPolicyScopeService(){
+ public void testPolicyScopeService() {
PolicyScopeService data = new PolicyScopeService();
data.setId(1);
assertTrue(1 == data.getId());
assertTrue("Test".equals(data.getDescriptionValue()));
}
+ /**
+ * Test policy scope resource.
+ */
@Test
- public void testPolicyScopeResource(){
+ public void testPolicyScopeResource() {
PolicyScopeResource data = new PolicyScopeResource();
data.setId(1);
assertTrue(1 == data.getId());
assertTrue("Test".equals(data.getDescriptionValue()));
}
+ /**
+ * Test policy scope type.
+ */
@Test
- public void testPolicyScopeType(){
+ public void testPolicyScopeType() {
PolicyScopeType data = new PolicyScopeType();
data.setId(1);
assertTrue(1 == data.getId());
assertTrue("Test".equals(data.getDescriptionValue()));
}
+ /**
+ * Test policy scope closed loop.
+ */
@Test
- public void testPolicyScopeClosedLoop(){
+ public void testPolicyScopeClosedLoop() {
PolicyScopeClosedLoop data = new PolicyScopeClosedLoop();
data.setId(1);
assertTrue(1 == data.getId());
assertTrue("Test".equals(data.getDescriptionValue()));
}
+ /**
+ * Test policy scope group policy scope list.
+ */
@Test
- public void testPolicyScopeGroupPolicyScopeList(){
+ public void testPolicyScopeGroupPolicyScopeList() {
GroupPolicyScopeList data = new GroupPolicyScopeList();
data.setId(1);
assertTrue(1 == data.getId());
assertTrue("Test".equals(data.getGroupList()));
}
+ /**
+ * Test closed loops.
+ */
@Test
- public void testClosedLoops(){
+ public void testClosedLoops() {
ClosedLoops data = new ClosedLoops();
data.setId(1);
assertTrue(1 == data.getId());
assertTrue("Test".equals(data.getYaml()));
}
+ /**
+ * Test VM type.
+ */
@Test
- public void testVMType(){
+ public void testVmType() {
VMType data = new VMType();
data.setId(1);
assertTrue(1 == data.getId());
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
import org.onap.policy.rest.dao.CommonClassDao;
-import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.BrmsParamTemplate;
import org.onap.policy.rest.jpa.PolicyEntity;
import org.onap.policy.utils.PolicyUtils;
import org.onap.policy.xacml.api.XACMLErrorConstants;
}
private String findRule(String ruleTemplate) {
- List<Object> datas = commonClassDao.getDataById(BRMSParamTemplate.class, "ruleName", ruleTemplate);
+ List<Object> datas = commonClassDao.getDataById(BrmsParamTemplate.class, "ruleName", ruleTemplate);
if (CollectionUtils.isNotEmpty(datas)) {
- return ((BRMSParamTemplate) datas.get(0)).getRule();
+ return ((BrmsParamTemplate) datas.get(0)).getRule();
}
return null;
}
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.ActionBodyEntity;
import org.onap.policy.rest.jpa.ConfigurationDataEntity;
-import org.onap.policy.rest.jpa.DCAEuuid;
+import org.onap.policy.rest.jpa.DcaeUuid;
import org.onap.policy.rest.jpa.GroupPolicyScopeList;
import org.onap.policy.rest.jpa.MicroServiceConfigName;
import org.onap.policy.rest.jpa.MicroServiceLocation;
private String validUuid(String uuid) {
String message = null;
if (uuid != null) {
- List<String> uuids = commonClassDao.getDataByColumn(DCAEuuid.class, "name");
+ List<String> uuids = commonClassDao.getDataByColumn(DcaeUuid.class, "name");
if (uuids != null && !(uuids.stream().filter(o -> o.equals(uuid)).findFirst().isPresent())) {
message = POLICY + policyName + " uuid: " + uuid + NOTVALID;
}