http://git-wip-us.apache.org/repos/asf/ranger/blob/c84b98fb/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 dfd2fcb..877344b 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; @@ -60,31 +61,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/c84b98fb/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 bbcd546..c16cad0 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 @@ -141,15 +141,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/c84b98fb/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 7af1bf9..4d0d8e4 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; @@ -51,20 +48,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; @@ -76,4 +59,5 @@ public class XXUserDao extends BaseDao<XXUser> { return null; } } + } http://git-wip-us.apache.org/repos/asf/ranger/blob/c84b98fb/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/c84b98fb/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 69d28bb..6c25032 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 @@ -110,6 +110,10 @@ public abstract class XXPolicyBase extends XXDBBase { @Column(name = "is_audit_enabled") protected boolean isAuditEnabled; + + @Column(name = "policy_text") + protected String policyText; + /** * @return the gUID */ @@ -267,7 +271,15 @@ public abstract class XXPolicyBase extends XXDBBase { this.policyType = policyType; } - /* + public void setPolicyText(String policyText) { + this.policyText = policyText; + } + + public String getPolicyText() { + return this.policyText; + } + + /* * (non-Javadoc) * * @see java.lang.Object#equals(java.lang.Object) http://git-wip-us.apache.org/repos/asf/ranger/blob/c84b98fb/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/c84b98fb/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/c84b98fb/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/c84b98fb/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/c84b98fb/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/c84b98fb/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/c84b98fb/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/c84b98fb/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 9155385..432119c 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 @@ -60,6 +60,9 @@ public class XXTag extends XXDBBase implements Serializable { @Column(name = "owned_by") protected Short owner; + @Column(name = "tag_attrs_text") + protected String tagAttrs; + @Override public void setId(Long id) { this.id = id; @@ -118,7 +121,11 @@ public class XXTag extends XXDBBase implements Serializable { public Short getOwner() { return owner; } public void setOwner(Short owner) { this.owner = owner; } - @Override + public String getTagAttrs() { return tagAttrs; } + + public void setTagAttrs(String tagAttrs) { this.tagAttrs = tagAttrs; } + + @Override public int getMyClassType() { return AppConstants.CLASS_TYPE_XA_TAG; } @@ -137,6 +144,7 @@ public class XXTag extends XXDBBase implements Serializable { result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((owner == null) ? 0 : owner.hashCode()); + result = prime * result + ((tagAttrs == null) ? 0 : tagAttrs.hashCode()); return result; } @@ -179,6 +187,11 @@ public class XXTag extends XXDBBase implements Serializable { return false; } else if (!owner.equals(other.owner)) return false; + if (tagAttrs == null) { + if (other.tagAttrs != null) + return false; + } else if (!tagAttrs.equals(other.tagAttrs)) + return false; return true; } @@ -201,6 +214,7 @@ public class XXTag extends XXDBBase implements Serializable { sb.append("guid={").append(guid).append("} "); sb.append("type={").append(type).append("} "); sb.append("owned_by={").append(owner).append("} "); + sb.append("tagAttrs={").append(tagAttrs).append("} "); sb.append(" }"); return sb; http://git-wip-us.apache.org/repos/asf/ranger/blob/c84b98fb/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;
