Repository: incubator-ranger
Updated Branches:
  refs/heads/master 9c2f0d1fb -> c11c7f2f8


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8df90d46/security-admin/src/main/java/org/apache/ranger/entity/XXContextEnricherDef.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/org/apache/ranger/entity/XXContextEnricherDef.java
 
b/security-admin/src/main/java/org/apache/ranger/entity/XXContextEnricherDef.java
new file mode 100644
index 0000000..27992e4
--- /dev/null
+++ 
b/security-admin/src/main/java/org/apache/ranger/entity/XXContextEnricherDef.java
@@ -0,0 +1,286 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.ranger.entity;
+
+import javax.persistence.*;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@Entity
+@Cacheable
+@XmlRootElement
+@Table(name = "x_context_enricher_def")
+public class XXContextEnricherDef extends XXDBBase implements
+               java.io.Serializable {
+       private static final long serialVersionUID = 1L;
+       /**
+        * id of the XXContextEnricherDef
+        * <ul>
+        * </ul>
+        *
+        */
+       @Id
+       @SequenceGenerator(name = "x_context_enricher_def_SEQ", sequenceName = 
"x_context_enricher_def_SEQ", allocationSize = 1)
+       @GeneratedValue(strategy = GenerationType.AUTO, generator = 
"x_context_enricher_def_SEQ")
+       @Column(name = "id")
+       protected Long id;
+
+       /**
+        * defId of the XXContextEnricherDef
+        * <ul>
+        * </ul>
+        *
+        */
+       @Column(name = "def_id")
+       protected Long defId;
+
+       /**
+        * name of the XXContextEnricherDef
+        * <ul>
+        * </ul>
+        *
+        */
+       @Column(name = "name")
+       protected String name;
+
+       /**
+        * enricher of the XXContextEnricherDef
+        * <ul>
+        * </ul>
+        *
+        */
+       @Column(name = "enricher")
+       protected String enricher;
+
+       /**
+        * enricherOptions of the XXContextEnricherDef
+        * <ul>
+        * </ul>
+        *
+        */
+       @Column(name = "enricher_options")
+       protected String enricherOptions;
+
+       /**
+        * order of the XXContextEnricherDef
+        * <ul>
+        * </ul>
+        *
+        */
+       @Column(name = "sort_order")
+       protected Integer order;
+
+       /**
+        * This method sets the value to the member attribute <b> id</b> . You
+        * cannot set null to the attribute.
+        * 
+        * @param id
+        *            Value to set member attribute <b> id</b>
+        */
+       public void setId(Long id) {
+               this.id = id;
+       }
+
+       /**
+        * Returns the value for the member attribute <b>id</b>
+        * 
+        * @return Date - value of member attribute <b>id</b> .
+        */
+       public Long getId() {
+               return this.id;
+       }
+
+       /**
+        * This method sets the value to the member attribute <b> defId</b> . 
You
+        * cannot set null to the attribute.
+        * 
+        * @param defId
+        *            Value to set member attribute <b> defId</b>
+        */
+       public void setDefid(Long defId) {
+               this.defId = defId;
+       }
+
+       /**
+        * Returns the value for the member attribute <b>defId</b>
+        * 
+        * @return Date - value of member attribute <b>defId</b> .
+        */
+       public Long getDefid() {
+               return this.defId;
+       }
+
+       /**
+        * This method sets the value to the member attribute <b> name</b> . You
+        * cannot set null to the attribute.
+        * 
+        * @param name
+        *            Value to set member attribute <b> name</b>
+        */
+       public void setName(String name) {
+               this.name = name;
+       }
+
+       /**
+        * Returns the value for the member attribute <b>name</b>
+        * 
+        * @return Date - value of member attribute <b>name</b> .
+        */
+       public String getName() {
+               return this.name;
+       }
+
+       /**
+        * This method sets the value to the member attribute <b> enricher</b> .
+        * You cannot set null to the attribute.
+        * 
+        * @param enricher
+        *            Value to set member attribute <b> enricher</b>
+        */
+       public void setEnricher(String enricher) {
+               this.enricher = enricher;
+       }
+
+       /**
+        * Returns the value for the member attribute <b>enricher</b>
+        * 
+        * @return String - value of member attribute <b>enricher</b> .
+        */
+       public String getEnricher() {
+               return this.enricher;
+       }
+
+       /**
+        * This method sets the value to the member attribute <b>
+        * enricherOptions</b> . You cannot set null to the attribute.
+        * 
+        * @param enricherOptions
+        *            Value to set member attribute <b> enricherOptions</b>
+        */
+       public void setEnricherOptions(String enricherOptions) {
+               this.enricherOptions = enricherOptions;
+       }
+
+       /**
+        * Returns the value for the member attribute <b>evaluatorOptions</b>
+        * 
+        * @return Date - value of member attribute <b>evaluatorOptions</b> .
+        */
+       public String getEnricherOptions() {
+               return this.enricherOptions;
+       }
+
+       /**
+        * This method sets the value to the member attribute <b> order</b> . 
You
+        * cannot set null to the attribute.
+        * 
+        * @param order
+        *            Value to set member attribute <b> order</b>
+        */
+       public void setOrder(Integer order) {
+               this.order = order;
+       }
+
+       /**
+        * Returns the value for the member attribute <b>order</b>
+        * 
+        * @return Integer - value of member attribute <b>order</b> .
+        */
+       public Integer getOrder() {
+               return this.order;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see java.lang.Object#equals(java.lang.Object)
+        */
+       @Override
+       public boolean equals(Object obj) {
+               if (!super.equals(obj)) {
+                       return false;
+               }
+               if (this == obj) {
+                       return true;
+               }
+               if (!super.equals(obj)) {
+                       return false;
+               }
+               if (getClass() != obj.getClass()) {
+                       return false;
+               }
+               XXContextEnricherDef other = (XXContextEnricherDef) obj;
+               if (defId == null) {
+                       if (other.defId != null) {
+                               return false;
+                       }
+               } else if (!defId.equals(other.defId)) {
+                       return false;
+               }
+               if (enricher == null) {
+                       if (other.enricher != null) {
+                               return false;
+                       }
+               } else if (!enricher.equals(other.enricher)) {
+                       return false;
+               }
+               if (enricherOptions == null) {
+                       if (other.enricherOptions != null) {
+                               return false;
+                       }
+               } else if (!enricherOptions.equals(other.enricherOptions)) {
+                       return false;
+               }
+               if (id == null) {
+                       if (other.id != null) {
+                               return false;
+                       }
+               } else if (!id.equals(other.id)) {
+                       return false;
+               }
+               if (name == null) {
+                       if (other.name != null) {
+                               return false;
+                       }
+               } else if (!name.equals(other.name)) {
+                       return false;
+               }
+               if (order == null) {
+                       if (other.order != null) {
+                               return false;
+                       }
+               } else if (!order.equals(other.order)) {
+                       return false;
+               }
+               return true;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see java.lang.Object#toString()
+        */
+       @Override
+       public String toString() {
+               return "XXContextEnricherDef [id=" + id + ", defId=" + defId
+                               + ", name=" + name + ", enricher=" + 
enricherOptions
+                               + ", enricherOptions=" + enricherOptions + ", 
order=" + order
+                               + "]";
+       }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8df90d46/security-admin/src/main/java/org/apache/ranger/entity/XXResourceDef.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/org/apache/ranger/entity/XXResourceDef.java 
b/security-admin/src/main/java/org/apache/ranger/entity/XXResourceDef.java
index 9b8a71e..e2694bf 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXResourceDef.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXResourceDef.java
@@ -665,4 +665,4 @@ public class XXResourceDef extends XXDBBase implements 
java.io.Serializable {
                                + ", order=" + order + "]";
        }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8df90d46/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefServiceBase.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefServiceBase.java
 
b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefServiceBase.java
index c96370b..9bfb3f8 100644
--- 
a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefServiceBase.java
+++ 
b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefServiceBase.java
@@ -10,6 +10,7 @@ import org.apache.ranger.common.AppConstants;
 import org.apache.ranger.common.GUIDUtil;
 import org.apache.ranger.common.MessageEnums;
 import org.apache.ranger.entity.XXAccessTypeDef;
+import org.apache.ranger.entity.XXContextEnricherDef;
 import org.apache.ranger.entity.XXDBBase;
 import org.apache.ranger.entity.XXEnumDef;
 import org.apache.ranger.entity.XXEnumElementDef;
@@ -19,6 +20,7 @@ import org.apache.ranger.entity.XXServiceConfigDef;
 import org.apache.ranger.entity.XXServiceDef;
 import org.apache.ranger.plugin.model.RangerServiceDef;
 import org.apache.ranger.plugin.model.RangerServiceDef.RangerAccessTypeDef;
+import 
org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef;
 import org.apache.ranger.plugin.model.RangerServiceDef.RangerEnumDef;
 import org.apache.ranger.plugin.model.RangerServiceDef.RangerEnumElementDef;
 import 
org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef;
@@ -203,6 +205,28 @@ public abstract class RangerServiceDefServiceBase<T 
extends XXServiceDef, V exte
                return vObj;
        }
        
+       public XXContextEnricherDef 
populateRangerContextEnricherDefToXX(RangerContextEnricherDef vObj, 
XXContextEnricherDef xObj, XXServiceDef serviceDef) {
+               if(serviceDef == null) {
+                       
LOG.error("RangerServiceDefServiceBase.populateRangerContextEnricherDefToXX, 
serviceDef can not be null");
+                       throw 
restErrorUtil.createRESTException("RangerServiceDef cannot be null.", 
MessageEnums.DATA_NOT_FOUND);
+               }
+               xObj = (XXContextEnricherDef) 
rangerAuditFields.populateAuditFields(xObj, serviceDef);
+               xObj.setDefid(serviceDef.getId());
+               xObj.setName(vObj.getName());
+               xObj.setEnricher(vObj.getEnricher());
+               xObj.setEnricherOptions(vObj.getEnricherOptions());
+               xObj.setOrder(AppConstants.DEFAULT_SORT_ORDER);
+               return xObj;
+       }
+       
+       public RangerContextEnricherDef 
populateXXToRangerContextEnricherDef(XXContextEnricherDef xObj) {
+               RangerContextEnricherDef vObj = new RangerContextEnricherDef();
+               vObj.setName(xObj.getName());
+               vObj.setEnricher(xObj.getEnricher());
+               vObj.setEnricherOptions(xObj.getEnricherOptions());
+               return vObj;
+       }
+       
        public XXEnumDef populateRangerEnumDefToXX(RangerEnumDef vObj, 
XXEnumDef xObj, XXServiceDef serviceDef) {
                if(serviceDef == null) {
                        
LOG.error("RangerServiceDefServiceBase.populateRangerEnumDefToXX, serviceDef 
can not be null");

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/8df90d46/security-admin/src/main/resources/META-INF/jpa_named_queries.xml
----------------------------------------------------------------------
diff --git a/security-admin/src/main/resources/META-INF/jpa_named_queries.xml 
b/security-admin/src/main/resources/META-INF/jpa_named_queries.xml
index 755d924..a25a1bc 100644
--- a/security-admin/src/main/resources/META-INF/jpa_named_queries.xml
+++ b/security-admin/src/main/resources/META-INF/jpa_named_queries.xml
@@ -270,6 +270,10 @@
                <query>select obj from XXPolicyConditionDef obj where obj.defId 
= :serviceDefId</query>
        </named-query>
        
+       <named-query name="XXPolicyConditionDef.findByServiceDefIdAndName">
+               <query>select obj from XXPolicyConditionDef obj where obj.defId 
= :serviceDefId and obj.name = :name</query>
+       </named-query>
+       
        <named-query name="XXPolicyConditionDef.findByPolicyItemId">
                <query>select obj from XXPolicyConditionDef obj, 
XXPolicyItemCondition xPolItemCond 
                where xPolItemCond.policyItemId = :polItemId and obj.id = 
xPolItemCond.type</query>
@@ -281,6 +285,15 @@
                                and obj.id = xPolItemCond.type 
                </query>
        </named-query>
+
+       <!-- XXContextEnricherDef -->
+       <named-query name="XXContextEnricherDef.findByServiceDefId">
+               <query>select obj from XXContextEnricherDef obj where obj.defId 
= :serviceDefId</query>
+       </named-query>
+       
+       <named-query name="XXContextEnricherDef.findByServiceDefIdAndName">
+               <query>select obj from XXContextEnricherDef obj where obj.defId 
= :serviceDefId and obj.name = :name</query>
+       </named-query>
        
 
        <!-- XXEnumDef -->

Reply via email to