diff options
Diffstat (limited to 'ONAP-REST/src/main/java')
21 files changed, 21 insertions, 619 deletions
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java b/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java index c29e17637..8a59ec603 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,77 +20,8 @@ package org.onap.policy.rest; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; -import org.onap.policy.rest.jpa.UserInfo; -import org.onap.policy.xacml.api.XACMLErrorConstants; - -import com.att.research.xacml.api.DataTypeException; -import com.att.research.xacml.api.Decision; -import com.att.research.xacml.api.Request; -import com.att.research.xacml.api.Response; -import com.att.research.xacml.api.Result; -import com.att.research.xacml.api.pdp.PDPEngine; -import com.att.research.xacml.api.pdp.PDPEngineFactory; -import com.att.research.xacml.api.pdp.PDPException; -import com.att.research.xacml.std.annotations.RequestParser; -import com.att.research.xacml.std.annotations.XACMLAction; -import com.att.research.xacml.std.annotations.XACMLRequest; -import com.att.research.xacml.std.annotations.XACMLResource; -import com.att.research.xacml.std.annotations.XACMLSubject; -import com.att.research.xacml.util.FactoryException; - - - public class XacmlAdminAuthorization { - private static Log logger = LogFactory.getLog(XacmlAdminAuthorization.class); - - private static UserInfo userId; - public static UserInfo getUserId() { - return userId; - } - - public static void setUserId(UserInfo userId) { - XacmlAdminAuthorization.userId = userId; - } - public enum AdminAction { - ACTION_ACCESS("access"), - ACTION_READ("read"), - ACTION_WRITE("write"), - ACTION_ADMIN("admin"); - - String action; - AdminAction(String a) { - this.action = a; - } - @Override - public String toString() { - return this.action; - } - } - - public enum AdminResource { - RESOURCE_APPLICATION("application"), - RESOURCE_POLICY_WORKSPACE("workspace"), - RESOURCE_POLICY_EDITOR("editor"), - RESOURCE_DICTIONARIES("dictionaries"), - RESOURCE_PDP_ADMIN("pdp_admin"), - RESOURCE_PIP_ADMIN("pip_admin"), - RESOURCE_SCOPES_SUPERADMIN("manage_scopes"); - - String resource; - AdminResource(String r) { - this.resource = r; - } - @Override - public String toString() { - return this.resource; - } - } - public enum Role { ROLE_GUEST("guest"), ROLE_ADMIN("admin"), @@ -109,115 +40,4 @@ public class XacmlAdminAuthorization { return this.userRole; } } - - @XACMLRequest(ReturnPolicyIdList=true) - public class AuthorizationRequest { - - @XACMLSubject(includeInResults=true) - String userID; - - @XACMLAction() - String action; - - @XACMLResource() - String resource; - - public AuthorizationRequest(String userId, String action, String resource) { - this.userID = userId; - this.action = action; - this.resource = resource; - } - - public String getUserID() { - return userID; - } - - public void setUserID(String userID) { - this.userID = userID; - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - } - - // - // The PDP Engine - // - protected PDPEngine pdpEngine; - - public XacmlAdminAuthorization() { - PDPEngineFactory pdpEngineFactory = null; - try { - pdpEngineFactory = PDPEngineFactory.newInstance(); - if (pdpEngineFactory == null) { - logger.error("Failed to create PDP Engine Factory"); - PolicyLogger.error("Failed to create PDP Engine Factory"); - } - this.pdpEngine = pdpEngineFactory.newEngine(); - } catch (FactoryException e) { - logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Exception create PDP Engine: " + e.getLocalizedMessage()); - PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XacmlAdminAuthorization", "Exception create PDP Engine"); - } - } - - public boolean isAuthorized(String userid, AdminAction action, AdminResource resource) { - logger.info("authorize: " + userid + " to " + action + " with " + resource); - if (this.pdpEngine == null) { - logger.warn("no pdp engine available to authorize"); - return false; - } - Request request; - try { - request = RequestParser.parseRequest(new AuthorizationRequest(userid, action.toString(), resource.toString())); - } catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) { - logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create request: " + e.getLocalizedMessage()); - PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XacmlAdminAuthorization", "Failed to create request"); - return false; - } - if (request == null) { - logger.error("Failed to parse request."); - PolicyLogger.error("Failed to parse request"); - return false; - } - logger.info("Request: " + request); - // - // Ask the engine - // - try { - Response response = this.pdpEngine.decide(request); - if (response == null) { - logger.error("Null response from PDP decide"); - PolicyLogger.error("Null response from PDP decide"); - } - // - // Should only be one result - // - if(response != null){ - for (Result result : response.getResults()) { - Decision decision = result.getDecision(); - logger.info("Decision: " + decision); - if (decision.equals(Decision.PERMIT)) { - return true; - } - } - } - } catch (PDPException e) { - logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "PDP Decide failed: " + e.getLocalizedMessage()); - PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XacmlAdminAuthorization", "PDP Decide failed"); - } - return false; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java index fff1bf804..7abd9a043 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,10 +40,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.rest.XacmlAdminAuthorization; - @Entity @Table(name="ActionPolicyDict") @@ -115,19 +111,7 @@ public class ActionPolicyDict implements Serializable { public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - private static Log logger = LogFactory.getLog(ActionPolicyDict.class); - public ActionPolicyDict() { - //An empty constructor - } - - public ActionPolicyDict(String string, String userid) { - this(string); - } - public ActionPolicyDict(String domain) { - this.type = domain; - } @PrePersist public void prePersist() { Date date = new Date(); @@ -137,11 +121,6 @@ public class ActionPolicyDict implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId(); - } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - } } public int getId() { return this.id; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java index ea89eeac9..3a4624ae1 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,10 +43,6 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.rest.XacmlAdminAuthorization; - import com.fasterxml.jackson.annotation.JsonIgnore; /** @@ -58,7 +54,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore; @NamedQuery(name="Attribute.findAll", query="SELECT a FROM Attribute a order by a.priority asc, a.xacmlId asc") public class Attribute implements Serializable { private static final long serialVersionUID = 1L; - private static final Log logger = LogFactory.getLog(Attribute.class); @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -181,11 +176,6 @@ public class Attribute implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy = XacmlAdminAuthorization.getUserId(); - } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java index 576889504..5fc3067f4 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,12 +40,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; -import org.onap.policy.rest.XacmlAdminAuthorization; - @Entity @Table(name = "ClosedLoopD2Services") @@ -96,8 +90,6 @@ public class ClosedLoopD2Services implements Serializable{ public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - private static Log LOGGER = LogFactory.getLog(ClosedLoopD2Services.class); public ClosedLoopD2Services(){ //An empty constructor @@ -113,12 +105,6 @@ public class ClosedLoopD2Services implements Serializable{ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy = XacmlAdminAuthorization.getUserId();; - } catch (Exception e) { - LOGGER.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "ClosedLoopD2Services", "Exception caused While adding Modified by Role"); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java index c3acf9a21..6db176b12 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,21 +41,12 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.rest.XacmlAdminAuthorization; - -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; - @Entity @Table(name = "ClosedLoopSite") @NamedQuery(name="ClosedLoopSite.findAll", query="SELECT c FROM ClosedLoopSite c ") public class ClosedLoopSite implements Serializable{ private static final long serialVersionUID = 1L; - - private static String domain; @Id @@ -102,20 +93,6 @@ public class ClosedLoopSite implements Serializable{ this.userModifiedBy = userModifiedBy; } - private static Log LOGGER = LogFactory.getLog(ClosedLoopSite.class); - - public ClosedLoopSite(){ - //An empty constructor - } - - public ClosedLoopSite(String string, String userid) { - this(domain); - } - - public ClosedLoopSite(String domain) { - this.siteName = domain; - } - @PrePersist public void prePersist() { Date date = new Date(); @@ -126,12 +103,6 @@ public class ClosedLoopSite implements Serializable{ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy = XacmlAdminAuthorization.getUserId();; - } catch (Exception e) { - LOGGER.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "ClosedLoopSite", "Exception caused While adding Modified by Role"); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java index ae3620294..ccd1052f0 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java @@ -39,10 +39,6 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; -import org.onap.policy.rest.XacmlAdminAuthorization; - @Entity @Table(name="DecisionSettings") @@ -108,25 +104,7 @@ public class DecisionSettings implements Serializable { public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - public DecisionSettings() { - //An empty constructor - } - - public DecisionSettings(String domain) { - this.xacmlId = domain; - } - - public DecisionSettings(String domain, String user) { - this(domain); - } - public DecisionSettings(DecisionSettings copy, String user) { - this(copy.getXacmlId() + ":(0)", user); - this.datatypeBean = copy.getDatatypeBean(); - this.description = copy.getDescription(); - - } - + @PrePersist public void prePersist() { Date date = new Date(); @@ -137,11 +115,6 @@ public class DecisionSettings implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy = XacmlAdminAuthorization.getUserId(); - } catch (Exception e) { - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "DecisionSettings", "Exception caused While adding Modified by Role"); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java index 68a00db98..d67a5849b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,13 +38,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.rest.XacmlAdminAuthorization; - -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; - @Entity @Table(name = "DescriptiveScope") @@ -98,20 +91,6 @@ public class DescriptiveScope implements Serializable { public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - private static Log LOGGER = LogFactory.getLog(DescriptiveScope.class); - - public DescriptiveScope(){ - //An empty constructor - } - - public DescriptiveScope(String string, String userid) { - this(string); - } - - public DescriptiveScope(String domain) { - this.descriptiveScopeName = domain; - } @PrePersist public void prePersist() { @@ -123,12 +102,6 @@ public class DescriptiveScope implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId();; - } catch (Exception e) { - LOGGER.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "DescriptiveScope", "Exception caused While adding Modified by Role"); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java index 31ec31d21..c606dd996 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java @@ -38,12 +38,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; -import org.onap.policy.rest.XacmlAdminAuthorization; - @Entity @Table(name = "FWTag") @NamedQuery(name = "FWTag.findAll", query= "Select p from FWTag p") @@ -96,8 +90,6 @@ public class FWTag implements Serializable { public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - private static Log LOGGER = LogFactory.getLog(FWTag.class); @PrePersist public void prePersist() { @@ -109,12 +101,6 @@ public class FWTag implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId();; - } catch (Exception e) { - LOGGER.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "FWTag", "Exception caused While adding Modified by Role"); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java index 708ebf591..314a4ee9b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java @@ -37,12 +37,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; -import org.onap.policy.rest.XacmlAdminAuthorization; - @Entity @Table(name = "FWTagPicker") @NamedQuery(name = "FWTagPicker.findAll", query= "Select p from FWTagPicker p") @@ -81,9 +75,7 @@ public class FWTagPicker implements Serializable { @ManyToOne(optional = false) @JoinColumn(name="modified_by") - private UserInfo userModifiedBy; - - private static Log logger = LogFactory.getLog(FWTagPicker.class); + private UserInfo userModifiedBy; @PrePersist public void prePersist() { @@ -95,12 +87,6 @@ public class FWTagPicker implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId(); - } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "DescriptiveScope", "Exception caused While adding Modified by Role"); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java index 66ee346e1..d817f2078 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,10 +39,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; -import org.onap.policy.rest.XacmlAdminAuthorization; - @Entity @Table(name="OnapName") @@ -50,8 +46,6 @@ import org.onap.policy.rest.XacmlAdminAuthorization; public class OnapName implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -95,18 +89,6 @@ public class OnapName implements Serializable { public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - public OnapName() { - //An empty constructor - } - - public OnapName(String string, String userid) { - this(domain); - } - - public OnapName(String domain) { - this.onapName = domain; - } @PrePersist public void prePersist() { @@ -118,11 +100,6 @@ public class OnapName implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId(); - } catch (Exception e) { - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "OnapName", "Exception caused While adding Modified by Role"); - } } public String getOnapName() { return this.onapName; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java index 869386f69..ae01999a3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,13 +40,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.rest.XacmlAdminAuthorization; - -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; - @Entity @Table(name = "PEPOptions") @@ -100,20 +93,7 @@ public class PEPOptions implements Serializable { public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - private static Log LOGGER = LogFactory.getLog(PEPOptions.class); - - public PEPOptions(){ - //An empty constructor - } - - public PEPOptions(String string, String userid) { - this(string); - } - - public PEPOptions(String domain) { - this.pepName = domain; - } + @PrePersist public void prePersist() { @@ -125,12 +105,6 @@ public class PEPOptions implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId();; - } catch (Exception e) { - LOGGER.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PEPOptions", "Exception caused While adding Modified by Role"); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java index 698ec36da..923f5ec6f 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,21 +38,11 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.rest.XacmlAdminAuthorization; - -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; - @Entity @Table(name="PolicyEditorScopes") @NamedQuery(name="PolicyEditorScopes.findAll", query="SELECT p FROM PolicyEditorScopes p ") public class PolicyEditorScopes implements Serializable{ private static final long serialVersionUID = 1L; - private static Log logger = LogFactory.getLog(PolicyEditorScopes.class); - - private static String domain; @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -78,18 +68,6 @@ public class PolicyEditorScopes implements Serializable{ @ManyToOne(optional = false) @JoinColumn(name="modified_by") private UserInfo userModifiedBy; - - public PolicyEditorScopes() { - // Empty constructor - } - - public PolicyEditorScopes(String string, String userid) { - this(domain); - } - - public PolicyEditorScopes(String domain) { - this.scopeName = domain; - } @PrePersist public void prePersist() { @@ -101,12 +79,6 @@ public class PolicyEditorScopes implements Serializable{ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId(); - } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyEditorScopes", "Exception caused While adding Modified by Role"); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java index a9e776580..dba7299bb 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,8 +42,6 @@ import javax.persistence.Table; public class PolicyScore implements Serializable { private static final long serialVersionUID = 1L; - - private static String domain; @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -61,18 +59,6 @@ public class PolicyScore implements Serializable { @Column(name="POLICY_SCORE", nullable=true) private String PolicyScore; - public PolicyScore() { - // Empty constructor - } - - public PolicyScore(String pName, String pScore) { - this(domain); - - } - public PolicyScore(String domain) { - // Empty constructor - } - public int getId() { return id; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java index 663d34a17..6af607f0c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java @@ -21,7 +21,6 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; -import java.sql.Timestamp; import java.util.Date; import java.util.Objects; @@ -143,7 +142,7 @@ public class PolicyVersion implements Serializable { return createdDate; } - public void setCreatedDate(Timestamp createdDate) { + public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java index 7d347951c..b338b186c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class RemoteCatalogValues implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -55,27 +51,6 @@ public class RemoteCatalogValues implements Serializable { @Column(name="value") private String value; - - public RemoteCatalogValues() { - // Empty constructor - } - public RemoteCatalogValues(String string, String userid) { - this(domain); - - } - public RemoteCatalogValues(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - public String getValue() { return value; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java index a533a70c1..5e6981590 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java @@ -39,12 +39,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; -import org.onap.policy.rest.XacmlAdminAuthorization; - @Entity @Table(name="RiskType") @@ -96,8 +90,6 @@ public class RiskType implements Serializable { this.userModifiedBy = userModifiedBy; } - private static Log LOGGER = LogFactory.getLog(RiskType.class); - @PrePersist public void prePersist() { Date date = new Date(); @@ -108,12 +100,6 @@ public class RiskType implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId(); - } catch (Exception e) { - LOGGER.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "RiskType", "Exception caused While adding Modified by Role"); - } } public String getRiskName() { return this.name; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java index 324e92f76..45e20d632 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,17 +80,6 @@ public class SystemLogDB implements Serializable { this.type = type; this.logtype = logtype; } - - public void SystemLogB (int id, String system, String description, String remote, String type, Date date, String logtype){ - this.id = id; - this.system = system; - this.description = description; - this.remote = remote; - this.type = type; - this.date = date; - this.logtype = logtype; - - } public int getId() { return this.id; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java index 9c18343bf..1b7186105 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,13 +38,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.rest.XacmlAdminAuthorization; - -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; - @Entity @Table(name="TERM") @@ -52,8 +45,6 @@ import org.onap.policy.common.logging.eelf.PolicyLogger; public class TermList implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -139,40 +130,16 @@ public class TermList implements Serializable { this.userModifiedBy = userModifiedBy; } - private static Log LOGGER = LogFactory.getLog(TermList.class); - - public TermList() { - // Empty constructor - } - - private static final Log auditLogger = LogFactory - .getLog("auditLogger"); - - public TermList(String string, String userid) { - this(domain); - } - public TermList(String domain) { - this.termName = domain; - } - @PrePersist public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; - auditLogger.debug("Added New Term Name: "+this.termName+" by "+this.userCreatedBy); - } + @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId();; - } catch (Exception e) { - LOGGER.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "TermList", "Exception caused While adding Modified by Role"); - } - auditLogger.debug("Updated Term Name: "+this.termName+" by "+this.userModifiedBy); } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java index d44e4b5b7..bffdce094 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,13 +38,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.rest.XacmlAdminAuthorization; - -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; - @Entity @@ -53,8 +46,6 @@ import org.onap.policy.common.logging.eelf.PolicyLogger; public class VNFType implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -98,12 +89,6 @@ public class VNFType implements Serializable { public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - private static Log LOGGER = LogFactory.getLog(VNFType.class); - - public VNFType() { - // Empty constructor - } public String getVnftype() { return vnftype; @@ -111,14 +96,6 @@ public class VNFType implements Serializable { public void setVnftype(String vnftype) { this.vnftype = vnftype; - } - - public VNFType(String string, String userid) { - this(domain); - } - - public VNFType(String domain) { - this.vnftype = domain; } @PrePersist @@ -131,12 +108,6 @@ public class VNFType implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId();; - } catch (Exception e) { - LOGGER.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "VNFType", "Exception caused While adding Modified by Role"); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java index df605ee7d..62c36e572 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,13 +38,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.rest.XacmlAdminAuthorization; - -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; - @Entity @Table(name="VSCLAction") @@ -52,8 +45,6 @@ import org.onap.policy.common.logging.eelf.PolicyLogger; public class VSCLAction implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -97,21 +88,7 @@ public class VSCLAction implements Serializable { public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - private static Log LOGGER = LogFactory.getLog(VSCLAction.class); - public VSCLAction() { - // Empty constructor - } - - public VSCLAction(String string, String userid) { - this(domain); - } - - public VSCLAction(String domain) { - this.vsclaction = domain; - } - @PrePersist public void prePersist() { Date date = new Date(); @@ -122,12 +99,6 @@ public class VSCLAction implements Serializable { @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId();; - } catch (Exception e) { - LOGGER.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "VSCLAction", "Exception caused While adding Modified by Role"); - } } public int getId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java index 376689ee7..fba4b611a 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,21 +38,12 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.onap.policy.rest.XacmlAdminAuthorization; - -import org.onap.policy.common.logging.eelf.MessageCodes; -import org.onap.policy.common.logging.eelf.PolicyLogger; - @Entity @Table(name="VarbindDictionary") @NamedQuery(name = "VarbindDictionary.findAll", query = "Select v FROM VarbindDictionary v") public class VarbindDictionary implements Serializable{ private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "Id") @@ -99,21 +90,7 @@ public class VarbindDictionary implements Serializable{ public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - private static Log LOGGER = LogFactory.getLog(VarbindDictionary.class); - public VarbindDictionary() { - // Empty constructor - } - - public VarbindDictionary(String string, String userid) { - this(domain); - } - - public VarbindDictionary(String domain) { - this.varbindName = domain; - } - @PrePersist public void prePersist() { Date date = new Date(); @@ -124,12 +101,6 @@ public class VarbindDictionary implements Serializable{ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); - try { - this.userModifiedBy =XacmlAdminAuthorization.getUserId();; - } catch (Exception e) { - LOGGER.error("Exception caused While adding Modified by Role"+e); - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "VarbindDictionary", "Exception caused While adding Modified by Role"); - } } public int getId() { |