You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ab...@apache.org on 2018/10/18 22:23:24 UTC
[4/9] ranger git commit: RANGER-2203,
RANGER-2219: Review and update database schema for ranger policies
and tag objects to minimize database queries/updates
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefConditionDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefConditionDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefConditionDao.java
new file mode 100644
index 0000000..2c04ab4
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefConditionDao.java
@@ -0,0 +1,111 @@
+/*
+ * 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.db;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import org.apache.ranger.biz.RangerPolicyRetriever;
+import org.apache.ranger.common.db.BaseDao;
+import org.apache.ranger.entity.XXPolicyRefCondition;
+import org.springframework.stereotype.Service;
+
+@Service
+public class XXPolicyRefConditionDao extends BaseDao<XXPolicyRefCondition> {
+
+ public XXPolicyRefConditionDao(RangerDaoManagerBase daoManager) {
+ super(daoManager);
+ }
+
+ public List<XXPolicyRefCondition> findByPolicyId(Long polId) {
+ if(polId == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager()
+ .createNamedQuery("XXPolicyRefCondition.findByPolicyId", tClass)
+ .setParameter("policyId", polId).getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+ public List<XXPolicyRefCondition> findByConditionName(String conditionName) {
+ if (conditionName == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager().createNamedQuery("XXPolicyRefCondition.findByConditionName", tClass)
+ .setParameter("conditionName", conditionName).getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ public List<XXPolicyRefCondition> findByConditionDefId(Long conditionDefId) {
+ if (conditionDefId == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager().createNamedQuery("XXPolicyRefCondition.findByConditionDefId", tClass)
+ .setParameter("conditionDefId", conditionDefId)
+ .getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RangerPolicyRetriever.PolicyTextNameMap> findUpdatedConditionNamesByPolicy(Long policyId) {
+ List<RangerPolicyRetriever.PolicyTextNameMap> ret = new ArrayList<>();
+ if (policyId != null) {
+ List<Object[]> rows = (List<Object[]>) getEntityManager()
+ .createNamedQuery("XXPolicyRefCondition.findUpdatedConditionNamesByPolicy")
+ .setParameter("policy", policyId)
+ .getResultList();
+ if (rows != null) {
+ for (Object[] row : rows) {
+ ret.add(new RangerPolicyRetriever.PolicyTextNameMap((Long)row[0], (String)row[1], (String)row[2]));
+ }
+ }
+ }
+ return ret;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RangerPolicyRetriever.PolicyTextNameMap> findUpdatedConditionNamesByService(Long serviceId) {
+ List<RangerPolicyRetriever.PolicyTextNameMap> ret = new ArrayList<>();
+ if (serviceId != null) {
+ List<Object[]> rows = (List<Object[]>) getEntityManager()
+ .createNamedQuery("XXPolicyRefCondition.findUpdatedConditionNamesByService")
+ .setParameter("service", serviceId)
+ .getResultList();
+ if (rows != null) {
+ for (Object[] row : rows) {
+ ret.add(new RangerPolicyRetriever.PolicyTextNameMap((Long)row[0], (String)row[1], (String)row[2]));
+ }
+ }
+ }
+ return ret;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefDataMaskTypeDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefDataMaskTypeDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefDataMaskTypeDao.java
new file mode 100644
index 0000000..258e3b0
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefDataMaskTypeDao.java
@@ -0,0 +1,86 @@
+/*
+ * 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.db;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import org.apache.ranger.biz.RangerPolicyRetriever;
+import org.apache.ranger.common.db.BaseDao;
+import org.apache.ranger.entity.XXPolicyRefDataMaskType;
+import org.springframework.stereotype.Service;
+
+@Service
+public class XXPolicyRefDataMaskTypeDao extends BaseDao<XXPolicyRefDataMaskType>{
+
+ public XXPolicyRefDataMaskTypeDao(RangerDaoManagerBase daoManager) {
+ super(daoManager);
+ }
+
+ public List<XXPolicyRefDataMaskType> findByPolicyId(Long policyId) {
+ if(policyId == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager()
+ .createNamedQuery("XXPolicyRefDataMaskType.findByPolicyId", tClass)
+ .setParameter("policyId", policyId).getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RangerPolicyRetriever.PolicyTextNameMap> findUpdatedDataMaskNamesByPolicy(Long policyId) {
+ List<RangerPolicyRetriever.PolicyTextNameMap> ret = new ArrayList<>();
+ if (policyId != null) {
+ List<Object[]> rows = (List<Object[]>) getEntityManager()
+ .createNamedQuery("XXPolicyRefDataMaskType.findUpdatedDataMaskNamesByPolicy")
+ .setParameter("policy", policyId)
+ .getResultList();
+ if (rows != null) {
+ for (Object[] row : rows) {
+ ret.add(new RangerPolicyRetriever.PolicyTextNameMap((Long)row[0], (String)row[1], (String)row[2]));
+ }
+ }
+ }
+ return ret;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RangerPolicyRetriever.PolicyTextNameMap> findUpdatedDataMaskNamesByService(Long serviceId) {
+ List<RangerPolicyRetriever.PolicyTextNameMap> ret = new ArrayList<>();
+ if (serviceId != null) {
+ List<Object[]> rows = (List<Object[]>) getEntityManager()
+ .createNamedQuery("XXPolicyRefDataMaskType.findUpdatedDataMaskNamesByService")
+ .setParameter("service", serviceId)
+ .getResultList();
+ if (rows != null) {
+ for (Object[] row : rows) {
+ ret.add(new RangerPolicyRetriever.PolicyTextNameMap((Long)row[0], (String)row[1], (String)row[2]));
+ }
+ }
+ }
+ return ret;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefGroupDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefGroupDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefGroupDao.java
new file mode 100644
index 0000000..08829d4
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefGroupDao.java
@@ -0,0 +1,99 @@
+/*
+ * 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.db;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import org.apache.ranger.biz.RangerPolicyRetriever;
+import org.apache.ranger.common.db.BaseDao;
+import org.apache.ranger.entity.XXPolicyRefGroup;
+import org.springframework.stereotype.Service;
+
+@Service
+public class XXPolicyRefGroupDao extends BaseDao<XXPolicyRefGroup>{
+
+
+ public XXPolicyRefGroupDao(RangerDaoManagerBase daoManager) {
+ super(daoManager);
+ }
+
+ public List<XXPolicyRefGroup> findByPolicyId(Long policyId) {
+ if(policyId == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager()
+ .createNamedQuery("XXPolicyRefGroup.findByPolicyId", tClass)
+ .setParameter("policyId", policyId).getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+ public List<XXPolicyRefGroup> findByGroupName(String groupName) {
+ if (groupName == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager().createNamedQuery("XXPolicyRefGroup.findByGroupName", tClass)
+ .setParameter("groupName", groupName).getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RangerPolicyRetriever.PolicyTextNameMap> findUpdatedGroupNamesByPolicy(Long policyId) {
+ List<RangerPolicyRetriever.PolicyTextNameMap> ret = new ArrayList<>();
+ if (policyId != null) {
+ List<Object[]> rows = (List<Object[]>) getEntityManager()
+ .createNamedQuery("XXPolicyRefGroup.findUpdatedGroupNamesByPolicy")
+ .setParameter("policy", policyId)
+ .getResultList();
+ if (rows != null) {
+ for (Object[] row : rows) {
+ ret.add(new RangerPolicyRetriever.PolicyTextNameMap((Long)row[0], (String)row[1], (String)row[2]));
+ }
+ }
+ }
+ return ret;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RangerPolicyRetriever.PolicyTextNameMap> findUpdatedGroupNamesByService(Long serviceId) {
+ List<RangerPolicyRetriever.PolicyTextNameMap> ret = new ArrayList<>();
+ if (serviceId != null) {
+ List<Object[]> rows = (List<Object[]>) getEntityManager()
+ .createNamedQuery("XXPolicyRefGroup.findUpdatedGroupNamesByService")
+ .setParameter("service", serviceId)
+ .getResultList();
+ if (rows != null) {
+ for (Object[] row : rows) {
+ ret.add(new RangerPolicyRetriever.PolicyTextNameMap((Long)row[0], (String)row[1], (String)row[2]));
+ }
+ }
+ }
+ return ret;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefResourceDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefResourceDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefResourceDao.java
new file mode 100644
index 0000000..e259ee8
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefResourceDao.java
@@ -0,0 +1,98 @@
+/*
+ * 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.db;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import org.apache.ranger.biz.RangerPolicyRetriever;
+import org.apache.ranger.common.db.BaseDao;
+import org.apache.ranger.entity.XXPolicyRefResource;
+import org.springframework.stereotype.Service;
+
+@Service
+public class XXPolicyRefResourceDao extends BaseDao<XXPolicyRefResource>{
+
+ public XXPolicyRefResourceDao(RangerDaoManagerBase daoManager) {
+ super(daoManager);
+ }
+
+ public List<XXPolicyRefResource> findByPolicyId(Long policyId) {
+ if(policyId == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager()
+ .createNamedQuery("XXPolicyRefResource.findByPolicyId", tClass)
+ .setParameter("policyId", policyId).getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ public List<XXPolicyRefResource> findByResourceDefID(Long resourceDefId) {
+ if (resourceDefId == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager().createNamedQuery("XXPolicyRefResource.findByResourceDefId", tClass)
+ .setParameter("resourceDefId", resourceDefId).getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RangerPolicyRetriever.PolicyTextNameMap> findUpdatedResourceNamesByPolicy(Long policyId) {
+ List<RangerPolicyRetriever.PolicyTextNameMap> ret = new ArrayList<>();
+ if (policyId != null) {
+ List<Object[]> rows = (List<Object[]>) getEntityManager()
+ .createNamedQuery("XXPolicyRefResource.findUpdatedResourceNamesByPolicy")
+ .setParameter("policy", policyId)
+ .getResultList();
+ if (rows != null) {
+ for (Object[] row : rows) {
+ ret.add(new RangerPolicyRetriever.PolicyTextNameMap((Long)row[0], (String)row[1], (String)row[2]));
+ }
+ }
+ }
+ return ret;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RangerPolicyRetriever.PolicyTextNameMap> findUpdatedResourceNamesByService(Long serviceId) {
+ List<RangerPolicyRetriever.PolicyTextNameMap> ret = new ArrayList<>();
+ if (serviceId != null) {
+ List<Object[]> rows = (List<Object[]>) getEntityManager()
+ .createNamedQuery("XXPolicyRefResource.findUpdatedResourceNamesByService")
+ .setParameter("service", serviceId)
+ .getResultList();
+ if (rows != null) {
+ for (Object[] row : rows) {
+ ret.add(new RangerPolicyRetriever.PolicyTextNameMap((Long)row[0], (String)row[1], (String)row[2]));
+ }
+ }
+ }
+ return ret;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefUserDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefUserDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefUserDao.java
new file mode 100644
index 0000000..f7b6131
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyRefUserDao.java
@@ -0,0 +1,111 @@
+/*
+ * 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.db;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import org.apache.ranger.biz.RangerPolicyRetriever;
+import org.apache.ranger.common.db.BaseDao;
+import org.apache.ranger.entity.XXPolicyRefUser;
+import org.springframework.stereotype.Service;
+
+@Service
+public class XXPolicyRefUserDao extends BaseDao<XXPolicyRefUser>{
+
+
+ public XXPolicyRefUserDao(RangerDaoManagerBase daoManager) {
+ super(daoManager);
+ }
+
+ public List<XXPolicyRefUser> findByPolicyId(Long policyId) {
+ if(policyId == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager()
+ .createNamedQuery("XXPolicyRefUser.findByPolicyId", tClass)
+ .setParameter("policyId", policyId).getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+ public List<XXPolicyRefUser> findByUserName(String userName) {
+ if (userName == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager().createNamedQuery("XXPolicyRefUser.findByUserName", tClass)
+ .setParameter("userName", userName).getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ public List<XXPolicyRefUser> findByUserId(String userID) {
+ if (userID == null) {
+ return Collections.EMPTY_LIST;
+ }
+ try {
+ return getEntityManager().createNamedQuery("XXPolicyRefUser.findByUserId", tClass)
+ .setParameter("userID", userID).getResultList();
+ } catch (NoResultException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RangerPolicyRetriever.PolicyTextNameMap> findUpdatedUserNamesByPolicy(Long policyId) {
+ List<RangerPolicyRetriever.PolicyTextNameMap> ret = new ArrayList<>();
+ if (policyId != null) {
+ List<Object[]> rows = (List<Object[]>) getEntityManager()
+ .createNamedQuery("XXPolicyRefUser.findUpdatedUserNamesByPolicy")
+ .setParameter("policy", policyId)
+ .getResultList();
+ if (rows != null) {
+ for (Object[] row : rows) {
+ ret.add(new RangerPolicyRetriever.PolicyTextNameMap((Long)row[0], (String)row[1], (String)row[2]));
+ }
+ }
+ }
+ return ret;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<RangerPolicyRetriever.PolicyTextNameMap> findUpdatedUserNamesByService(Long serviceId) {
+ List<RangerPolicyRetriever.PolicyTextNameMap> ret = new ArrayList<>();
+ if (serviceId != null) {
+ List<Object[]> rows = (List<Object[]>) getEntityManager()
+ .createNamedQuery("XXPolicyRefUser.findUpdatedUserNamesByService")
+ .setParameter("service", serviceId)
+ .getResultList();
+ if (rows != null) {
+ for (Object[] row : rows) {
+ ret.add(new RangerPolicyRetriever.PolicyTextNameMap((Long)row[0], (String)row[1], (String)row[2]));
+ }
+ }
+ }
+ return ret;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXPolicyResourceDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXPolicyResourceDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyResourceDao.java
index a7157de..6670a4e 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXPolicyResourceDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyResourceDao.java
@@ -32,20 +32,6 @@ public class XXPolicyResourceDao extends BaseDao<XXPolicyResource> {
public XXPolicyResourceDao(RangerDaoManagerBase daoManager) {
super(daoManager);
}
-
- public XXPolicyResource findByResDefIdAndPolicyId(Long resDefId, Long polId) {
- if(resDefId == null || polId == null) {
- return null;
- }
- try {
- return getEntityManager()
- .createNamedQuery("XXPolicyResource.findByResDefIdAndPolicyId", tClass)
- .setParameter("resDefId", resDefId).setParameter("polId", polId)
- .getSingleResult();
- } catch (NoResultException e) {
- return null;
- }
- }
public List<XXPolicyResource> findByPolicyId(Long policyId) {
if(policyId == null) {
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXPolicyResourceMapDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXPolicyResourceMapDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyResourceMapDao.java
index 55d8c50..90123f5 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXPolicyResourceMapDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXPolicyResourceMapDao.java
@@ -32,19 +32,6 @@ public class XXPolicyResourceMapDao extends BaseDao<XXPolicyResourceMap> {
public XXPolicyResourceMapDao(RangerDaoManagerBase daoManager) {
super(daoManager);
}
-
- public List<XXPolicyResourceMap> findByPolicyResId(Long polResId) {
- if(polResId == null) {
- return new ArrayList<XXPolicyResourceMap>();
- }
- try {
- return getEntityManager()
- .createNamedQuery("XXPolicyResourceMap.findByPolicyResId", tClass)
- .setParameter("polResId", polResId).getResultList();
- } catch (NoResultException e) {
- return new ArrayList<XXPolicyResourceMap>();
- }
- }
public List<XXPolicyResourceMap> findByPolicyId(Long policyId) {
if(policyId == null) {
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXResourceDefDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXResourceDefDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXResourceDefDao.java
index b2e311f..5613902 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXResourceDefDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXResourceDefDao.java
@@ -99,5 +99,4 @@ public class XXResourceDefDao extends BaseDao<XXResourceDef> {
return new ArrayList<XXResourceDef>();
}
}
-
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceDao.java
index ee0e400..5c0878c 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceDao.java
@@ -24,6 +24,7 @@ import java.util.List;
import javax.persistence.NoResultException;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.ranger.authorization.utils.StringUtil;
import org.apache.ranger.common.db.BaseDao;
@@ -75,15 +76,32 @@ public class XXServiceResourceDao extends BaseDao<XXServiceResource> {
}
public List<XXServiceResource> findTaggedResourcesInServiceId(Long serviceId) {
- if (serviceId == null) {
- return new ArrayList<XXServiceResource>();
- }
- try {
- return getEntityManager().createNamedQuery("XXServiceResource.findTaggedResourcesInServiceId", tClass)
- .setParameter("serviceId", serviceId).getResultList();
- } catch (NoResultException e) {
- return new ArrayList<XXServiceResource>();
- }
+ List<XXServiceResource> ret = new ArrayList<>();
+ if (serviceId != null) {
+ List<Object[]> rows = null;
+ try {
+ rows = getEntityManager().createNamedQuery("XXServiceResource.findTaggedResourcesInServiceId", Object[].class)
+ .setParameter("serviceId", serviceId).getResultList();
+ } catch (NoResultException e) {
+ // Nothing
+ }
+ if (CollectionUtils.isNotEmpty(rows)) {
+ for (Object[] row : rows) {
+ XXServiceResource xxServiceResource = new XXServiceResource();
+ xxServiceResource.setId((Long) row[0]);
+ xxServiceResource.setGuid((String) row[1]);
+ xxServiceResource.setVersion((Long) row[2]);
+ xxServiceResource.setIsEnabled((Boolean) row[3]);
+ xxServiceResource.setResourceSignature((String) row[4]);
+ xxServiceResource.setServiceId((Long) row[5]);
+ xxServiceResource.setServiceResourceElements((String) row[6]);
+ xxServiceResource.setTags((String) row[7]);
+
+ ret.add(xxServiceResource);
+ }
+ }
+ }
+ return ret;
}
public long countTaggedResourcesInServiceId(Long serviceId) {
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceElementDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceElementDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceElementDao.java
index c9a1c21..ece8c2e 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceElementDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceElementDao.java
@@ -74,16 +74,4 @@ public class XXServiceResourceElementDao extends BaseDao<XXServiceResourceElemen
}
}
- public List<XXServiceResourceElement> findForServicePlugin(Long serviceId) {
- if (serviceId == null) {
- return new ArrayList<XXServiceResourceElement>();
- }
- try {
- return getEntityManager().createNamedQuery("XXServiceResourceElement.findForServicePlugin", tClass)
- .setParameter("serviceId", serviceId)
- .getResultList();
- } catch (NoResultException e) {
- return new ArrayList<XXServiceResourceElement>();
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceElementValueDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceElementValueDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceElementValueDao.java
index 364af6d..1d6a1ea 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceElementValueDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXServiceResourceElementValueDao.java
@@ -87,19 +87,6 @@ public class XXServiceResourceElementValueDao extends BaseDao<XXServiceResourceE
}
@SuppressWarnings("unchecked")
- public List<XXServiceResourceElementValue> findForServicePlugin(Long serviceId) {
- if (serviceId == null) {
- return new ArrayList<XXServiceResourceElementValue>();
- }
- try {
- return getEntityManager().createNamedQuery("XXServiceResourceElementValue.findForServicePlugin")
- .setParameter("serviceId", serviceId).getResultList();
- } catch (NoResultException e) {
- return new ArrayList<XXServiceResourceElementValue>();
- }
- }
-
- @SuppressWarnings("unchecked")
public List<XXServiceResourceElementValue> findByResourceId(Long resourceId) {
if (resourceId == null) {
return new ArrayList<XXServiceResourceElementValue>();
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXTagAttributeDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXTagAttributeDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXTagAttributeDao.java
index 40c3a88..474ef28 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXTagAttributeDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXTagAttributeDao.java
@@ -59,18 +59,6 @@ public class XXTagAttributeDao extends BaseDao<XXTagAttribute> {
}
}
- public List<XXTagAttribute> findForServicePlugin(Long serviceId) {
- if (serviceId == null) {
- return new ArrayList<XXTagAttribute>();
- }
- try {
- return getEntityManager().createNamedQuery("XXTagAttribute.findForServicePlugin", tClass)
- .setParameter("serviceId", serviceId).getResultList();
- } catch (NoResultException e) {
- return new ArrayList<XXTagAttribute>();
- }
- }
-
public List<XXTagAttribute> findByServiceIdAndOwner(Long serviceId, Short owner) {
if (serviceId == null) {
return new ArrayList<XXTagAttribute>();
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXTagAttributeDefDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXTagAttributeDefDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXTagAttributeDefDao.java
index 129f3c1..3a9cf2c 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXTagAttributeDefDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXTagAttributeDefDao.java
@@ -59,18 +59,6 @@ public class XXTagAttributeDefDao extends BaseDao<XXTagAttributeDef> {
}
}
- public List<XXTagAttributeDef> findForServicePlugin(Long serviceId) {
- if (serviceId == null) {
- return new ArrayList<XXTagAttributeDef>();
- }
- try {
- return getEntityManager().createNamedQuery("XXTagAttributeDef.findForServicePlugin", tClass)
- .setParameter("serviceId", serviceId).getResultList();
- } catch (NoResultException e) {
- return new ArrayList<XXTagAttributeDef>();
- }
- }
-
public List<XXTagAttributeDef> findByResourceId(Long resourceId) {
if (resourceId == null) {
return new ArrayList<XXTagAttributeDef>();
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXTagDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXTagDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXTagDao.java
index e14f836..c3aed9d 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXTagDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXTagDao.java
@@ -126,19 +126,6 @@ public class XXTagDao extends BaseDao<XXTag> {
}
}
- public List<XXTag> findForServicePlugin(Long serviceId) {
- if (serviceId == null) {
- return new ArrayList<XXTag>();
- }
-
- try {
- return getEntityManager().createNamedQuery("XXTag.findForServicePlugin", tClass)
- .setParameter("serviceId", serviceId).getResultList();
- } catch (NoResultException e) {
- return new ArrayList<XXTag>();
- }
- }
-
public List<XXTag> findByServiceIdAndOwner(Long serviceId, Short owner) {
if (serviceId == null) {
return new ArrayList<XXTag>();
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXTagDefDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXTagDefDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXTagDefDao.java
index c0dd883..f6c0bbf 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXTagDefDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXTagDefDao.java
@@ -24,6 +24,7 @@ import java.util.List;
import javax.persistence.NoResultException;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.ranger.common.db.BaseDao;
import org.apache.ranger.entity.XXTagDef;
@@ -62,31 +63,33 @@ public class XXTagDefDao extends BaseDao<XXTagDef> {
}
}
- public List<XXTagDef> findByServiceId(Long serviceId) {
- if (serviceId == null) {
- return new ArrayList<XXTagDef>();
- }
-
- try {
- return getEntityManager().createNamedQuery("XXTagDef.findByServiceId", tClass)
- .setParameter("serviceId", serviceId).getResultList();
- } catch (NoResultException e) {
- return new ArrayList<XXTagDef>();
- }
- }
-
- public List<XXTagDef> findForServicePlugin(Long serviceId) {
- if (serviceId == null) {
- return new ArrayList<XXTagDef>();
- }
-
- try {
- return getEntityManager().createNamedQuery("XXTagDef.findForServicePlugin", tClass)
- .setParameter("serviceId", serviceId).getResultList();
- } catch (NoResultException e) {
- return new ArrayList<XXTagDef>();
- }
- }
+ public List<XXTagDef> findByServiceId(Long serviceId) {
+ List<XXTagDef> ret = new ArrayList<>();
+ if (serviceId != null) {
+ List<Object[]> rows = null;
+ try {
+ rows = getEntityManager().createNamedQuery("XXTagDef.findByServiceId", Object[].class)
+ .setParameter("serviceId", serviceId).getResultList();
+ } catch (NoResultException e) {
+ // Nothing
+ }
+ if (CollectionUtils.isNotEmpty(rows)) {
+ for (Object[] row : rows) {
+ XXTagDef xxTagDef = new XXTagDef();
+ xxTagDef.setId((Long) row[0]);
+ xxTagDef.setGuid((String) row[1]);
+ xxTagDef.setVersion((Long) row[2]);
+ xxTagDef.setIsEnabled((Boolean) row[3]);
+ xxTagDef.setName((String) row[4]);
+ xxTagDef.setSource((String) row[5]);
+ xxTagDef.setTagAttrDefs((String) row[6]);
+
+ ret.add(xxTagDef);
+ }
+ }
+ }
+ return ret;
+ }
public List<String> getAllNames() {
try {
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXTagResourceMapDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXTagResourceMapDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXTagResourceMapDao.java
index f9e041a..3f8b5b7 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXTagResourceMapDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXTagResourceMapDao.java
@@ -143,15 +143,4 @@ public class XXTagResourceMapDao extends BaseDao<XXTagResourceMap> {
}
}
- public List<XXTagResourceMap> findForServicePlugin(Long serviceId) {
- if (serviceId == null) {
- return new ArrayList<XXTagResourceMap>();
- }
- try {
- return getEntityManager().createNamedQuery("XXTagResourceMap.findForServicePlugin", tClass)
- .setParameter("serviceId", serviceId).getResultList();
- } catch (NoResultException e) {
- return new ArrayList<XXTagResourceMap>();
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/db/XXUserDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/db/XXUserDao.java b/security-admin/src/main/java/org/apache/ranger/db/XXUserDao.java
index 58bf4d8..cea90c1 100644
--- a/security-admin/src/main/java/org/apache/ranger/db/XXUserDao.java
+++ b/security-admin/src/main/java/org/apache/ranger/db/XXUserDao.java
@@ -17,10 +17,7 @@
* under the License.
*/
- package org.apache.ranger.db;
-
-
-import java.util.List;
+package org.apache.ranger.db;
import javax.persistence.NoResultException;
@@ -53,20 +50,6 @@ public class XXUserDao extends BaseDao<XXUser> {
return null;
}
- @SuppressWarnings("unchecked")
- public List<String> findByPolicyItemId(Long polItemId) {
- if (polItemId == null) {
- return null;
- }
- try {
- return getEntityManager()
- .createNamedQuery("XXUser.findByPolicyItemId")
- .setParameter("polItemId", polItemId).getResultList();
- } catch (NoResultException e) {
- return null;
- }
- }
-
public XXUser findByPortalUserId(Long portalUserId) {
if (portalUserId == null) {
return null;
@@ -78,4 +61,5 @@ public class XXUserDao extends BaseDao<XXUser> {
return null;
}
}
+
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXDBBase.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXDBBase.java b/security-admin/src/main/java/org/apache/ranger/entity/XXDBBase.java
index 8405eb3..4816b02 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXDBBase.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXDBBase.java
@@ -25,6 +25,7 @@
*/
import java.util.Date;
+import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
@@ -205,6 +206,11 @@ public abstract class XXDBBase implements java.io.Serializable {
return str;
}
+ @Override
+ public int hashCode() {
+ return Objects.hash(createTime, updateTime, addedByUserId, updatedByUserId);
+ }
+
/**
* Checks for all attributes except referenced db objects
* @return true if all attributes match
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyBase.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyBase.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyBase.java
index 584a103..e441ec0 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyBase.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyBase.java
@@ -126,6 +126,10 @@ public abstract class XXPolicyBase extends XXDBBase {
*/
@Column(name = "policy_options")
protected String options;
+
+ @Column(name = "policy_text")
+ protected String policyText;
+
/**
* @return the gUID
*/
@@ -310,7 +314,16 @@ public abstract class XXPolicyBase extends XXDBBase {
return this.options;
}
- /*
+
+ public void setPolicyText(String policyText) {
+ this.policyText = policyText;
+ }
+
+ public String getPolicyText() {
+ return this.policyText;
+ }
+
+ /*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
@@ -399,6 +412,13 @@ public abstract class XXPolicyBase extends XXDBBase {
} else if (!options.equals(other.options)) {
return false;
}
+ if (policyText == null) {
+ if (other.policyText != null) {
+ return false;
+ }
+ } else if (!policyText.equals(other.policyText)) {
+ return false;
+ }
return true;
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefAccessType.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefAccessType.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefAccessType.java
new file mode 100644
index 0000000..6af8f99
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefAccessType.java
@@ -0,0 +1,191 @@
+/*
+ * 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;
+import java.util.Objects;
+
+@Entity
+@Cacheable
+@XmlRootElement
+@Table(name = "x_policy_ref_access_type")
+public class XXPolicyRefAccessType extends XXDBBase implements
+ java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+ /**
+ * id of the XXPolicyRefAccessType
+ * <ul>
+ * </ul>
+ *
+ */
+ @Id
+ @SequenceGenerator(name = "x_policy_ref_access_type_SEQ", sequenceName = "x_policy_ref_access_type_SEQ", allocationSize = 1)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "x_policy_ref_access_type_SEQ")
+ @Column(name = "id")
+ protected Long id;
+
+ /**
+ * policyId of the XXPolicyRefAccessType
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "policy_id")
+ protected Long policyId;
+
+ /**
+ * accessDefId of the XXPolicyRefAccessType
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "access_def_id")
+ protected Long accessDefId;
+
+ /**
+ * accessTypeName of the XXPolicyRefAccessType
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "access_type_name")
+ protected String accessTypeName;
+
+ /**
+ * 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> policyId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param policyId
+ * Value to set member attribute <b> policyId</b>
+ */
+ public void setPolicyId(Long policyId) {
+ this.policyId = policyId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>policyId</b>
+ *
+ * @return Date - value of member attribute <b>policyId</b> .
+ */
+ public Long getPolicyId() {
+ return this.policyId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> accessDefId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param accessDefId
+ * Value to set member attribute <b> accessDefId</b>
+ */
+ public void setAccessDefId(Long accessDefId) {
+ this.accessDefId = accessDefId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>accessDefId</b>
+ *
+ * @return Date - value of member attribute <b>accessDefId</b> .
+ */
+ public Long getAccessDefId() {
+ return accessDefId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> accessTypeName</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param accessTypeName
+ * Value to set member attribute <b> accessTypeName</b>
+ */
+ public void setAccessTypeName(String accessTypeName) {
+ this.accessTypeName = accessTypeName;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>accessTypeName</b>
+ *
+ * @return Date - value of member attribute <b>accessTypeName</b> .
+ */
+ public String getAccessTypeName() {
+ return accessTypeName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), id, policyId, accessDefId, accessTypeName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ XXPolicyRefAccessType other = (XXPolicyRefAccessType) obj;
+
+ return super.equals(obj) &&
+ Objects.equals(id, other.id) &&
+ Objects.equals(policyId, other.policyId) &&
+ Objects.equals(accessDefId, other.accessDefId) &&
+ Objects.equals(accessTypeName, other.accessTypeName);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "XXPolicyRefAccessType [" + super.toString() + " id=" + id + ", policyId=" + policyId + ", accessDefId="
+ + accessDefId + ", accessTypeName=" + accessTypeName + "]";
+ }
+
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefCondition.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefCondition.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefCondition.java
new file mode 100644
index 0000000..4f4409d
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefCondition.java
@@ -0,0 +1,191 @@
+/*
+ * 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;
+import java.util.Objects;
+
+@Entity
+@Cacheable
+@XmlRootElement
+@Table(name = "x_policy_ref_condition")
+public class XXPolicyRefCondition extends XXDBBase implements
+ java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+ /**
+ * id of the XXPolicyRefCondition
+ * <ul>
+ * </ul>
+ *
+ */
+ @Id
+ @SequenceGenerator(name = "x_policy_ref_condition_SEQ", sequenceName = "x_policy_ref_condition_SEQ", allocationSize = 1)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "x_policy_ref_condition_SEQ")
+ @Column(name = "id")
+ protected Long id;
+
+ /**
+ * policyId of the XXPolicyRefCondition
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "policy_id")
+ protected Long policyId;
+
+ /**
+ * conditionDefId of the XXPolicyRefCondition
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "condition_def_id")
+ protected Long conditionDefId;
+
+ /**
+ * conditionName of the XXPolicyRefCondition
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "condition_name")
+ protected String conditionName;
+
+ /**
+ * 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> policyId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param policyId
+ * Value to set member attribute <b> policyId</b>
+ */
+ public void setPolicyId(Long policyId) {
+ this.policyId = policyId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>policyId</b>
+ *
+ * @return Date - value of member attribute <b>policyId</b> .
+ */
+ public Long getPolicyId() {
+ return this.policyId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> conditionDefId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param conditionDefId
+ * Value to set member attribute <b> conditionDefId</b>
+ */
+ public void setConditionDefId(Long conditionDefId) {
+ this.conditionDefId = conditionDefId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>conditionDefId</b>
+ *
+ * @return Date - value of member attribute <b>conditionDefId</b> .
+ */
+ public Long getConditionDefId() {
+ return conditionDefId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> conditionName</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param conditionName
+ * Value to set member attribute <b> conditionName</b>
+ */
+ public void setConditionName(String conditionName) {
+ this.conditionName = conditionName;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>conditionName</b>
+ *
+ * @return Date - value of member attribute <b>conditionName</b> .
+ */
+ public String getConditionName() {
+ return conditionName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), id, policyId, conditionDefId, conditionName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ XXPolicyRefCondition other = (XXPolicyRefCondition) obj;
+
+ return super.equals(obj) &&
+ Objects.equals(id, other.id) &&
+ Objects.equals(policyId, other.policyId) &&
+ Objects.equals(conditionDefId, other.conditionDefId) &&
+ Objects.equals(conditionName, other.conditionName);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "XXPolicyRefCondition [" + super.toString() + " id=" + id + ", policyId=" + policyId + ", conditionDefId="
+ + conditionDefId + ", conditionName=" + conditionName + "]";
+ }
+
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefDataMaskType.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefDataMaskType.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefDataMaskType.java
new file mode 100644
index 0000000..cb92674
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefDataMaskType.java
@@ -0,0 +1,192 @@
+/*
+ * 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;
+import java.util.Objects;
+
+@Entity
+@Cacheable
+@XmlRootElement
+@Table(name = "x_policy_ref_datamask_type")
+public class XXPolicyRefDataMaskType extends XXDBBase implements
+ java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+ /**
+ * id of the XXPolicyRefDataMaskType
+ * <ul>
+ * </ul>
+ *
+ */
+ @Id
+ @SequenceGenerator(name = "x_policy_ref_datamask_type_SEQ", sequenceName = "x_policy_ref_datamask_type_SEQ", allocationSize = 1)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "x_policy_ref_datamask_type_SEQ")
+ @Column(name = "id")
+ protected Long id;
+
+ /**
+ * policyId of the XXPolicyRefDataMaskType
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "policy_id")
+ protected Long policyId;
+
+ /**
+ * DatamaskDefId of the XXPolicyRefDataMaskType
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "datamask_def_id")
+ protected Long dataMaskDefId;
+
+ /**
+ * dataMaskTypeName of the XXPolicyRefDataMaskType
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "datamask_type_name")
+ protected String dataMaskTypeName;
+
+ /**
+ * 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> policyId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param policyId
+ * Value to set member attribute <b> policyId</b>
+ */
+ public void setPolicyId(Long policyId) {
+ this.policyId = policyId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>policyId</b>
+ *
+ * @return Date - value of member attribute <b>policyId</b> .
+ */
+ public Long getPolicyId() {
+ return this.policyId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> dataMaskDefId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param dataMaskDefId
+ * Value to set member attribute <b> dataMaskDefId</b>
+ */
+ public void setDataMaskDefId(Long dataMaskDefId) {
+ this.dataMaskDefId = dataMaskDefId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>dataMaskDefId</b>
+ *
+ * @return Date - value of member attribute <b>dataMaskDefId</b> .
+ */
+ public Long getDataMaskDefId() {
+ return dataMaskDefId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> dataMaskTypeName</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param dataMaskTypeName
+ * Value to set member attribute <b> dataMaskTypeName</b>
+ */
+ public void setDataMaskTypeName(String dataMaskTypeName) {
+ this.dataMaskTypeName = dataMaskTypeName;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>dataMaskTypeName</b>
+ *
+ * @return Date - value of member attribute <b>dataMaskTypeName</b> .
+ */
+ public String getDataMaskTypeName() {
+ return dataMaskTypeName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), id, policyId, dataMaskDefId, dataMaskTypeName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ XXPolicyRefDataMaskType other = (XXPolicyRefDataMaskType) obj;
+
+ return super.equals(obj) &&
+ Objects.equals(id, other.id) &&
+ Objects.equals(policyId, other.policyId) &&
+ Objects.equals(dataMaskDefId, other.dataMaskDefId) &&
+ Objects.equals(dataMaskTypeName, other.dataMaskTypeName);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "XXPolicyRefDataMaskType [" + super.toString() + " id=" + id + ", policyId=" + policyId + ", dataMaskDefId="
+ + dataMaskDefId + ", dataMaskTypeName=" + dataMaskTypeName + "]";
+ }
+
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefGroup.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefGroup.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefGroup.java
new file mode 100644
index 0000000..32a1b9f
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefGroup.java
@@ -0,0 +1,206 @@
+/*
+ * 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 java.io.Serializable;
+import java.util.Objects;
+
+import javax.persistence.Cacheable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+import javax.xml.bind.annotation.XmlRootElement;
+
+
+/**
+ * The persistent class for the x_policy_ref_group database table.
+ *
+ */
+@Entity
+@Cacheable
+@XmlRootElement
+@Table(name="x_policy_ref_group")
+public class XXPolicyRefGroup extends XXDBBase implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ /**
+ * id of the XXPolicyRefGroup
+ * <ul>
+ * </ul>
+ *
+ */
+ @Id
+ @SequenceGenerator(name = "x_policy_ref_group_SEQ", sequenceName = "x_policy_ref_group_SEQ", allocationSize = 1)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "x_policy_ref_group_SEQ")
+ @Column(name = "id")
+ protected Long id;
+
+ /**
+ * policyId of the XXPolicyRefGroup
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "policy_id")
+ protected Long policyId;
+
+ /**
+ * groupId of the XXPolicyRefGroup
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "group_id")
+ protected Long groupId;
+
+ /**
+ * groupName of the XXPolicyRefGroup
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "group_name")
+ protected String groupName;
+
+ /**
+ * 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> policyId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param policyId
+ * Value to set member attribute <b> policyId</b>
+ */
+ public void setPolicyId(Long policyId) {
+ this.policyId = policyId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>policyId</b>
+ *
+ * @return Date - value of member attribute <b>policyId</b> .
+ */
+ public Long getPolicyId() {
+ return this.policyId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> groupId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param groupId
+ * Value to set member attribute <b> groupId</b>
+ */
+ public void setGroupId(Long groupId) {
+ this.groupId = groupId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>groupId</b>
+ *
+ * @return Date - value of member attribute <b>groupId</b> .
+ */
+ public Long getGroupId() {
+ return groupId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> groupName</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param groupName
+ * Value to set member attribute <b> groupName</b>
+ */
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>groupName</b>
+ *
+ * @return Date - value of member attribute <b>groupName</b> .
+ */
+ public String getGroupName() {
+ return groupName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), id, policyId, groupId, groupName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ XXPolicyRefGroup other = (XXPolicyRefGroup) obj;
+
+ return super.equals(obj) &&
+ Objects.equals(id, other.id) &&
+ Objects.equals(policyId, other.policyId) &&
+ Objects.equals(groupId, other.groupId) &&
+ Objects.equals(groupName, other.groupName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "XXPolicyRefGroup [" + super.toString() + " id=" + id + ", policyId=" + policyId + ", groupId=" + groupId
+ + ", groupName=" + groupName + "]";
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefResource.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefResource.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefResource.java
new file mode 100644
index 0000000..1150646
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefResource.java
@@ -0,0 +1,191 @@
+/*
+ * 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;
+import java.util.Objects;
+
+@Entity
+@Cacheable
+@XmlRootElement
+@Table(name = "x_policy_ref_resource")
+public class XXPolicyRefResource extends XXDBBase implements
+ java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+ /**
+ * id of the XXPolicyRefResource
+ * <ul>
+ * </ul>
+ *
+ */
+ @Id
+ @SequenceGenerator(name = "x_policy_ref_resource_SEQ", sequenceName = "x_policy_ref_resource_SEQ", allocationSize = 1)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "x_policy_ref_resource_SEQ")
+ @Column(name = "id")
+ protected Long id;
+
+ /**
+ * policyId of the XXPolicyRefResource
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "policy_id")
+ protected Long policyId;
+
+ /**
+ * resourceDefId of the XXPolicyRefResource
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "resource_def_id")
+ protected Long resourceDefId;
+
+ /**
+ * resource_name of the XXPolicyRefResource
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "resource_name")
+ protected String resourceName;
+
+ /**
+ * 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> policyId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param policyId
+ * Value to set member attribute <b> policyId</b>
+ */
+ public void setPolicyId(Long policyId) {
+ this.policyId = policyId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>policyId</b>
+ *
+ * @return Date - value of member attribute <b>policyId</b> .
+ */
+ public Long getPolicyId() {
+ return this.policyId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> resourceDefId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param resourceDefId
+ * Value to set member attribute <b> resourceDefId</b>
+ */
+ public void setResourceDefId(Long resourceDefId) {
+ this.resourceDefId = resourceDefId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>resourceDefId</b>
+ *
+ * @return Date - value of member attribute <b>resourceDefId</b> .
+ */
+ public Long getResourceDefId() {
+ return resourceDefId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> resource_name</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param resourceName
+ * Value to set member attribute <b> resource_name</b>
+ */
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>resourceName</b>
+ *
+ * @return Date - value of member attribute <b>resourceName</b> .
+ */
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), id, policyId, resourceDefId, resourceName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ XXPolicyRefResource other = (XXPolicyRefResource) obj;
+
+ return super.equals(obj) &&
+ Objects.equals(id, other.id) &&
+ Objects.equals(policyId, other.policyId) &&
+ Objects.equals(resourceDefId, other.resourceDefId) &&
+ Objects.equals(resourceName, other.resourceName);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "XXPolicyRefResource [" + super.toString() + " id=" + id + ", policyId=" + policyId + ", resourceDefId="
+ + resourceDefId + ", resource_name=" + resourceName + "]";
+ }
+
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefUser.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefUser.java b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefUser.java
new file mode 100644
index 0000000..8dfb928
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXPolicyRefUser.java
@@ -0,0 +1,191 @@
+/*
+ * 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;
+import java.util.Objects;
+
+@Entity
+@Cacheable
+@XmlRootElement
+@Table(name = "x_policy_ref_user")
+public class XXPolicyRefUser extends XXDBBase implements
+ java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+ /**
+ * id of the XXPolicyRefUser
+ * <ul>
+ * </ul>
+ *
+ */
+ @Id
+ @SequenceGenerator(name = "x_policy_ref_user_SEQ", sequenceName = "x_policy_ref_user_SEQ", allocationSize = 1)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "x_policy_ref_user_SEQ")
+ @Column(name = "id")
+ protected Long id;
+
+ /**
+ * policyId of the XXPolicyRefUser
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "policy_id")
+ protected Long policyId;
+
+ /**
+ * userId of the XXPolicyRefUser
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "user_id")
+ protected Long userId;
+
+ /**
+ * userName of the XXPolicyRefUser
+ * <ul>
+ * </ul>
+ *
+ */
+ @Column(name = "user_name")
+ protected String userName;
+
+ /**
+ * 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> policyId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param policyId
+ * Value to set member attribute <b> policyId</b>
+ */
+ public void setPolicyId(Long policyId) {
+ this.policyId = policyId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>policyId</b>
+ *
+ * @return Date - value of member attribute <b>policyId</b> .
+ */
+ public Long getPolicyId() {
+ return this.policyId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> userId</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param userId
+ * Value to set member attribute <b> userId</b>
+ */
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>userId</b>
+ *
+ * @return Date - value of member attribute <b>userId</b> .
+ */
+ public Long getUserId() {
+ return userId;
+ }
+
+ /**
+ * This method sets the value to the member attribute <b> userName</b> .
+ * You cannot set null to the attribute.
+ *
+ * @param userName
+ * Value to set member attribute <b> userName</b>
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * Returns the value for the member attribute <b>userName</b>
+ *
+ * @return Date - value of member attribute <b>userName</b> .
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), id, policyId, userId, userName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ XXPolicyRefUser other = (XXPolicyRefUser) obj;
+
+ return super.equals(obj) &&
+ Objects.equals(id, other.id) &&
+ Objects.equals(policyId, other.policyId) &&
+ Objects.equals(userId, other.userId) &&
+ Objects.equals(userName, other.userName);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "XXPolicyRefUser [" + super.toString() + " id=" + id + ", policyId=" + policyId + ", userId="
+ + userId + ", userName=" + userName + "]";
+ }
+
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXServiceResource.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXServiceResource.java b/security-admin/src/main/java/org/apache/ranger/entity/XXServiceResource.java
index 961627a..c784830 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXServiceResource.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXServiceResource.java
@@ -63,6 +63,12 @@ public class XXServiceResource extends XXDBBase implements Serializable {
@Column(name = "service_id")
protected Long serviceId;
+ @Column(name = "service_resource_elements_text")
+ protected String serviceResourceElements;
+
+ @Column(name = "tags_text")
+ protected String tags;
+
@Override
public void setId(Long id) {
this.id = id;
@@ -148,6 +154,16 @@ public class XXServiceResource extends XXDBBase implements Serializable {
this.isEnabled = isEnabled;
}
+ public String getServiceResourceElements() { return serviceResourceElements; }
+
+ public void setServiceResourceElements(String serviceResourceElements) {
+ this.serviceResourceElements = serviceResourceElements;
+ }
+
+ public String getTags() { return tags; }
+
+ public void setTags(String tags) { this.tags = tags; }
+
@Override
public int getMyClassType() {
return AppConstants.CLASS_TYPE_XA_SERVICE_RESOURCE;
@@ -168,6 +184,8 @@ public class XXServiceResource extends XXDBBase implements Serializable {
result = prime * result + ((isEnabled == null) ? 0 : isEnabled.hashCode());
result = prime * result + ((resourceSignature == null) ? 0 : resourceSignature.hashCode());
result = prime * result + ((serviceId == null) ? 0 : serviceId.hashCode());
+ result = prime * result + ((serviceResourceElements == null) ? 0 : serviceResourceElements.hashCode());
+ result = prime * result + ((tags == null) ? 0 : tags.hashCode());
return result;
}
@@ -215,6 +233,16 @@ public class XXServiceResource extends XXDBBase implements Serializable {
return false;
} else if (!version.equals(other.version))
return false;
+ if (serviceResourceElements == null) {
+ if (other.serviceResourceElements != null)
+ return false;
+ } else if (!serviceResourceElements.equals(other.serviceResourceElements))
+ return false;
+ if (tags == null) {
+ if (other.tags != null)
+ return false;
+ } else if (!tags.equals(other.tags))
+ return false;
return true;
}
@@ -239,6 +267,8 @@ public class XXServiceResource extends XXDBBase implements Serializable {
sb.append("isEnabled={").append(isEnabled).append("} ");
sb.append("resourceSignature={").append(resourceSignature).append("} ");
sb.append("serviceId={").append(serviceId).append("} ");
+ sb.append("serviceResourceElements={").append(serviceResourceElements).append("} ");
+ sb.append("tags={").append(tags).append("} ");
sb.append(" }");
return sb;
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXTag.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXTag.java b/security-admin/src/main/java/org/apache/ranger/entity/XXTag.java
index d26a0b0..9d5eb61 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXTag.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXTag.java
@@ -63,6 +63,9 @@ public class XXTag extends XXDBBase implements Serializable {
@Column(name = "policy_options")
protected String options;
+ @Column(name = "tag_attrs_text")
+ protected String tagAttrs;
+
@Override
public void setId(Long id) {
this.id = id;
@@ -129,6 +132,10 @@ public class XXTag extends XXDBBase implements Serializable {
return this.options;
}
+ public String getTagAttrs() { return tagAttrs; }
+
+ public void setTagAttrs(String tagAttrs) { this.tagAttrs = tagAttrs; }
+
@Override
public int getMyClassType() {
return AppConstants.CLASS_TYPE_XA_TAG;
@@ -149,6 +156,7 @@ public class XXTag extends XXDBBase implements Serializable {
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((owner == null) ? 0 : owner.hashCode());
result = prime * result + ((options == null) ? 0 : options.hashCode());
+ result = prime * result + ((tagAttrs == null) ? 0 : tagAttrs.hashCode());
return result;
}
@@ -195,6 +203,11 @@ public class XXTag extends XXDBBase implements Serializable {
if (other.options != null)
return false;
} else if (!options.equals(other.options))
+
+ if (tagAttrs == null) {
+ if (other.tagAttrs != null)
+ return false;
+ } else if (!tagAttrs.equals(other.tagAttrs))
return false;
return true;
}
@@ -219,6 +232,7 @@ public class XXTag extends XXDBBase implements Serializable {
sb.append("type={").append(type).append("} ");
sb.append("owned_by={").append(owner).append("} ");
sb.append("options={").append(options).append("} ");
+ sb.append("tagAttrs={").append(tagAttrs).append("} ");
sb.append(" }");
return sb;
http://git-wip-us.apache.org/repos/asf/ranger/blob/d424b1a8/security-admin/src/main/java/org/apache/ranger/entity/XXTagDef.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/entity/XXTagDef.java b/security-admin/src/main/java/org/apache/ranger/entity/XXTagDef.java
index 818908b..88a7633 100644
--- a/security-admin/src/main/java/org/apache/ranger/entity/XXTagDef.java
+++ b/security-admin/src/main/java/org/apache/ranger/entity/XXTagDef.java
@@ -63,6 +63,9 @@ public class XXTagDef extends XXDBBase implements Serializable {
@Column(name = "source")
protected String source;
+ @Column(name = "tag_attrs_def_text")
+ protected String tagAttrDefs;
+
/**
* @return the guid
*/
@@ -138,6 +141,10 @@ public class XXTagDef extends XXDBBase implements Serializable {
this.source = source;
}
+ public String getTagAttrDefs() { return tagAttrDefs; }
+
+ public void setTagAttrDefs(String tagAttrDefs) { this.tagAttrDefs = tagAttrDefs; }
+
@Override
public void setId(Long id) {
this.id = id;
@@ -168,6 +175,7 @@ public class XXTagDef extends XXDBBase implements Serializable {
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((source == null) ? 0 : source.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
+ result = prime * result + ((tagAttrDefs == null) ? 0 : tagAttrDefs.hashCode());
return result;
}
@@ -215,6 +223,11 @@ public class XXTagDef extends XXDBBase implements Serializable {
return false;
} else if (!version.equals(other.version))
return false;
+ if (tagAttrDefs == null) {
+ if (other.tagAttrDefs != null)
+ return false;
+ } else if (!tagAttrDefs.equals(other.tagAttrDefs))
+ return false;
return true;
}
@@ -239,6 +252,7 @@ public class XXTagDef extends XXDBBase implements Serializable {
sb.append("isEnabled={").append(isEnabled).append("} ");
sb.append("source={").append(source).append("} ");
sb.append("name={").append(name).append("} ");
+ sb.append("tagAttrDefs={").append(tagAttrDefs).append("} ");
sb.append(" }");
return sb;