http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/entity/XXPortalUser.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/com/xasecure/entity/XXPortalUser.java b/security-admin/src/main/java/com/xasecure/entity/XXPortalUser.java deleted file mode 100644 index 5b9c45e..0000000 --- a/security-admin/src/main/java/com/xasecure/entity/XXPortalUser.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * 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 com.xasecure.entity; - -/** - * User details - * - */ - -import java.util.*; -import javax.persistence.*; -import javax.xml.bind.annotation.*; -import com.xasecure.common.*; -import com.xasecure.entity.*; - - -@Entity -@Table(name="x_portal_user") -@XmlRootElement -public class XXPortalUser extends XXDBBase implements java.io.Serializable { - private static final long serialVersionUID = 1L; - - @Id - @SequenceGenerator(name="X_PORTAL_USER_SEQ",sequenceName="X_PORTAL_USER_SEQ",allocationSize=1) - @GeneratedValue(strategy=GenerationType.AUTO,generator="X_PORTAL_USER_SEQ") - @Column(name="ID") - protected Long id; - @Override - public void setId(Long id) { - // TODO Auto-generated method stub - this.id=id; - } - @Override - public Long getId() { - // TODO Auto-generated method stub - return id; - } - /** - * First name of the user - * <ul> - * <li>The maximum length for this attribute is <b>1022</b>. - * </ul> - * - */ - @Column(name="FIRST_NAME" , length=1022) - protected String firstName; - - /** - * Last name of the user - * <ul> - * <li>The maximum length for this attribute is <b>1022</b>. - * </ul> - * - */ - @Column(name="LAST_NAME" , length=1022) - protected String lastName; - - /** - * Public screen name for the user - * <ul> - * <li>The maximum length for this attribute is <b>2048</b>. - * </ul> - * - */ - @Column(name="PUB_SCR_NAME" , length=2048) - protected String publicScreenName; - - /** - * Login ID of the user - * <ul> - * <li>The maximum length for this attribute is <b>767</b>. - * </ul> - * - */ - @Column(name="LOGIN_ID" , unique=true , length=767) - protected String loginId; - - /** - * <ul> - * <li>The maximum length for this attribute is <b>512</b>. - * </ul> - * - */ - @Column(name="PASSWORD" , nullable=false , length=512) - protected String password; - - /** - * Email address of the user - * <ul> - * <li>The maximum length for this attribute is <b>512</b>. - * </ul> - * - */ - @Column(name="EMAIL" , unique=true , length=512) - protected String emailAddress; - - /** - * Status of the user - * <ul> - * <li>This attribute is of type enum CommonEnums::ActivationStatus - * </ul> - * - */ - @Column(name="STATUS" , nullable=false ) - protected int status = XAConstants.ACT_STATUS_DISABLED; - - /** - * Source of the user - * <ul> - * <li>This attribute is of type enum CommonEnums::UserSource - * </ul> - * - */ - @Column(name="USER_SRC" , nullable=false ) - protected int userSource = XAConstants.USER_APP; - - /** - * Note - * <ul> - * <li>The maximum length for this attribute is <b>4000</b>. - * </ul> - * - */ - @Column(name="NOTES" , length=4000) - protected String notes; - - /** - * Default constructor. This will set all the attributes to default value. - */ - public XXPortalUser ( ) { - status = XAConstants.ACT_STATUS_DISABLED; - userSource = XAConstants.USER_APP; - } - - @Override - public int getMyClassType( ) { - return AppConstants.CLASS_TYPE_USER_PROFILE; - } - - /** - * This method sets the value to the member attribute <b>firstName</b>. - * You cannot set null to the attribute. - * @param firstName Value to set member attribute <b>firstName</b> - */ - public void setFirstName( String firstName ) { - this.firstName = firstName; - } - - /** - * Returns the value for the member attribute <b>firstName</b> - * @return String - value of member attribute <b>firstName</b>. - */ - public String getFirstName( ) { - return this.firstName; - } - - /** - * This method sets the value to the member attribute <b>lastName</b>. - * You cannot set null to the attribute. - * @param lastName Value to set member attribute <b>lastName</b> - */ - public void setLastName( String lastName ) { - this.lastName = lastName; - } - - /** - * Returns the value for the member attribute <b>lastName</b> - * @return String - value of member attribute <b>lastName</b>. - */ - public String getLastName( ) { - return this.lastName; - } - - /** - * This method sets the value to the member attribute <b>publicScreenName</b>. - * You cannot set null to the attribute. - * @param publicScreenName Value to set member attribute <b>publicScreenName</b> - */ - public void setPublicScreenName( String publicScreenName ) { - this.publicScreenName = publicScreenName; - } - - /** - * Returns the value for the member attribute <b>publicScreenName</b> - * @return String - value of member attribute <b>publicScreenName</b>. - */ - public String getPublicScreenName( ) { - return this.publicScreenName; - } - - /** - * This method sets the value to the member attribute <b>loginId</b>. - * You cannot set null to the attribute. - * @param loginId Value to set member attribute <b>loginId</b> - */ - public void setLoginId( String loginId ) { - this.loginId = loginId; - } - - /** - * Returns the value for the member attribute <b>loginId</b> - * @return String - value of member attribute <b>loginId</b>. - */ - public String getLoginId( ) { - return this.loginId; - } - - /** - * This method sets the value to the member attribute <b>password</b>. - * You cannot set null to the attribute. - * @param password Value to set member attribute <b>password</b> - */ - public void setPassword( String password ) { - this.password = password; - } - - /** - * Returns the value for the member attribute <b>password</b> - * @return String - value of member attribute <b>password</b>. - */ - public String getPassword( ) { - return this.password; - } - - /** - * This method sets the value to the member attribute <b>emailAddress</b>. - * You cannot set null to the attribute. - * @param emailAddress Value to set member attribute <b>emailAddress</b> - */ - public void setEmailAddress( String emailAddress ) { - this.emailAddress = emailAddress; - } - - /** - * Returns the value for the member attribute <b>emailAddress</b> - * @return String - value of member attribute <b>emailAddress</b>. - */ - public String getEmailAddress( ) { - return this.emailAddress; - } - - /** - * This method sets the value to the member attribute <b>status</b>. - * You cannot set null to the attribute. - * @param status Value to set member attribute <b>status</b> - */ - public void setStatus( int status ) { - this.status = status; - } - - /** - * Returns the value for the member attribute <b>status</b> - * @return int - value of member attribute <b>status</b>. - */ - public int getStatus( ) { - return this.status; - } - - /** - * This method sets the value to the member attribute <b>userSource</b>. - * You cannot set null to the attribute. - * @param userSource Value to set member attribute <b>userSource</b> - */ - public void setUserSource( int userSource ) { - this.userSource = userSource; - } - - /** - * Returns the value for the member attribute <b>userSource</b> - * @return int - value of member attribute <b>userSource</b>. - */ - public int getUserSource( ) { - return this.userSource; - } - - /** - * This method sets the value to the member attribute <b>notes</b>. - * You cannot set null to the attribute. - * @param notes Value to set member attribute <b>notes</b> - */ - public void setNotes( String notes ) { - this.notes = notes; - } - - /** - * Returns the value for the member attribute <b>notes</b> - * @return String - value of member attribute <b>notes</b>. - */ - public String getNotes( ) { - return this.notes; - } - - /** - * This return the bean content in string format - * @return formatedStr - */ - @Override - public String toString( ) { - String str = "XXPortalUser={"; - str += super.toString(); - str += "firstName={" + firstName + "} "; - str += "lastName={" + lastName + "} "; - str += "publicScreenName={" + publicScreenName + "} "; - str += "loginId={" + loginId + "} "; - str += "password={***length=" + (password == null? 0 : password.length()) + "***} "; - str += "emailAddress={" + emailAddress + "} "; - str += "status={" + status + "} "; - str += "userSource={" + userSource + "} "; - str += "notes={" + notes + "} "; - str += "}"; - return str; - } - - /** - * Checks for all attributes except referenced db objects - * @return true if all attributes match - */ - @Override - public boolean equals( Object obj) { - if ( !super.equals(obj) ) { - return false; - } - XXPortalUser other = (XXPortalUser) obj; - if ((this.firstName == null && other.firstName != null) || (this.firstName != null && !this.firstName.equals(other.firstName))) { - return false; - } - if ((this.lastName == null && other.lastName != null) || (this.lastName != null && !this.lastName.equals(other.lastName))) { - return false; - } - if ((this.publicScreenName == null && other.publicScreenName != null) || (this.publicScreenName != null && !this.publicScreenName.equals(other.publicScreenName))) { - return false; - } - if ((this.loginId == null && other.loginId != null) || (this.loginId != null && !this.loginId.equals(other.loginId))) { - return false; - } - if ((this.password == null && other.password != null) || (this.password != null && !this.password.equals(other.password))) { - return false; - } - if ((this.emailAddress == null && other.emailAddress != null) || (this.emailAddress != null && !this.emailAddress.equals(other.emailAddress))) { - return false; - } - if( this.status != other.status ) return false; - if( this.userSource != other.userSource ) return false; - if ((this.notes == null && other.notes != null) || (this.notes != null && !this.notes.equals(other.notes))) { - return false; - } - return true; - } - public static String getEnumName(String fieldName ) { - if( fieldName.equals("status") ) { - return "CommonEnums.ActivationStatus"; - } - if( fieldName.equals("userSource") ) { - return "CommonEnums.UserSource"; - } - //Later TODO - //return super.getEnumName(fieldName); - return null; - } - -}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/entity/XXPortalUserRole.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/com/xasecure/entity/XXPortalUserRole.java b/security-admin/src/main/java/com/xasecure/entity/XXPortalUserRole.java deleted file mode 100644 index 8dbd912..0000000 --- a/security-admin/src/main/java/com/xasecure/entity/XXPortalUserRole.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * 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 com.xasecure.entity; - -/** - * Role of the user - * - */ - -import java.util.*; -import javax.persistence.*; -import javax.xml.bind.annotation.*; -import com.xasecure.common.*; -import com.xasecure.entity.*; - - -@Entity -@Table(name="x_portal_user_role") -@XmlRootElement -public class XXPortalUserRole extends XXDBBase implements java.io.Serializable { - private static final long serialVersionUID = 1L; - - - @Id - @SequenceGenerator(name="X_PORTAL_USER_ROLE_SEQ",sequenceName="X_PORTAL_USER_ROLE_SEQ",allocationSize=1) - @GeneratedValue(strategy=GenerationType.AUTO,generator="X_PORTAL_USER_ROLE_SEQ") - @Column(name="ID") - protected Long id; - @Override - public void setId(Long id) { - this.id=id; - } - @Override - public Long getId() { - return id; - } - /** - * Id of the user - * <ul> - * </ul> - * - */ - @Column(name="USER_ID" , nullable=false ) - protected Long userId; - - - /** - * Role of the user - * <ul> - * <li>The maximum length for this attribute is <b>128</b>. - * </ul> - * - */ - @Column(name="USER_ROLE" , length=128) - protected String userRole; - - /** - * Status - * <ul> - * <li>This attribute is of type enum CommonEnums::ActiveStatus - * </ul> - * - */ - @Column(name="STATUS" , nullable=false ) - protected int status = XAConstants.STATUS_DISABLED; - - /** - * Default constructor. This will set all the attributes to default value. - */ - public XXPortalUserRole ( ) { - status = XAConstants.STATUS_DISABLED; - } - - /** - * 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 Long - value of member attribute <b>userId</b>. - */ - public Long getUserId( ) { - return this.userId; - } - - - /** - * This method sets the value to the member attribute <b>userRole</b>. - * You cannot set null to the attribute. - * @param userRole Value to set member attribute <b>userRole</b> - */ - public void setUserRole( String userRole ) { - this.userRole = userRole; - } - - /** - * Returns the value for the member attribute <b>userRole</b> - * @return String - value of member attribute <b>userRole</b>. - */ - public String getUserRole( ) { - return this.userRole; - } - - /** - * This method sets the value to the member attribute <b>status</b>. - * You cannot set null to the attribute. - * @param status Value to set member attribute <b>status</b> - */ - public void setStatus( int status ) { - this.status = status; - } - - /** - * Returns the value for the member attribute <b>status</b> - * @return int - value of member attribute <b>status</b>. - */ - public int getStatus( ) { - return this.status; - } - - /** - * This return the bean content in string format - * @return formatedStr - */ - @Override - public String toString( ) { - String str = "XXPortalUserRole={"; - str += super.toString(); - str += "userId={" + userId + "} "; - str += "userRole={" + userRole + "} "; - str += "status={" + status + "} "; - str += "}"; - return str; - } - - /** - * Checks for all attributes except referenced db objects - * @return true if all attributes match - */ - @Override - public boolean equals( Object obj) { - if ( !super.equals(obj) ) { - return false; - } - XXPortalUserRole other = (XXPortalUserRole) obj; - if ((this.userId == null && other.userId != null) || (this.userId != null && !this.userId.equals(other.userId))) { - return false; - } - if ((this.userRole == null && other.userRole != null) || (this.userRole != null && !this.userRole.equals(other.userRole))) { - return false; - } - if( this.status != other.status ) return false; - return true; - } - public static String getEnumName(String fieldName ) { - if( fieldName.equals("status") ) { - return "CommonEnums.ActiveStatus"; - } - //Later TODO - //return super.getEnumName(fieldName); - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/entity/XXResource.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/com/xasecure/entity/XXResource.java b/security-admin/src/main/java/com/xasecure/entity/XXResource.java deleted file mode 100644 index 5b38d93..0000000 --- a/security-admin/src/main/java/com/xasecure/entity/XXResource.java +++ /dev/null @@ -1,717 +0,0 @@ -/* - * 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 com.xasecure.entity; - -/** - * Resource - * - */ - -import java.util.*; -import javax.persistence.*; -import javax.xml.bind.annotation.*; -import com.xasecure.common.*; -import com.xasecure.entity.*; - - -@Entity -@Table(name="x_resource") -@XmlRootElement -public class XXResource extends XXDBBase implements java.io.Serializable { - private static final long serialVersionUID = 1L; - - - @Id - @SequenceGenerator(name="X_RESOURCE_SEQ",sequenceName="X_RESOURCE_SEQ",allocationSize=1) - @GeneratedValue(strategy=GenerationType.AUTO,generator="X_RESOURCE_SEQ") - @Column(name="ID") - protected Long id; - @Override - public void setId(Long id) { - this.id=id; - } - @Override - public Long getId() { - return id; - } - /** - * Name - * <ul> - * <li>The maximum length for this attribute is <b>4000</b>. - * </ul> - * - */ - @Column(name="RES_NAME" , length=4000) - protected String name; - - @Column(name="POLICY_NAME" , length=500) - protected String policyName; - /** - * Description - * <ul> - * <li>The maximum length for this attribute is <b>4000</b>. - * </ul> - * - */ - @Column(name="DESCR" , length=4000) - protected String description; - - /** - * Status - * <ul> - * <li>This attribute is of type enum CommonEnums::ResourceType - * </ul> - * - */ - @Column(name="RES_TYPE" , nullable=false ) - protected int resourceType = AppConstants.RESOURCE_PATH; - - /** - * Id of the asset - * <ul> - * </ul> - * - */ - @Column(name="ASSET_ID" , nullable=false ) - protected Long assetId; - - - /** - * Id of the parent - * <ul> - * </ul> - * - */ - @Column(name="PARENT_ID" ) - protected Long parentId; - - - /** - * Path for the parent - * <ul> - * <li>The maximum length for this attribute is <b>4000</b>. - * </ul> - * - */ - @Column(name="PARENT_PATH" , length=4000) - protected String parentPath; - - /** - * Whether to encrypt this resource - * <ul> - * <li>This attribute is of type enum CommonEnums::BooleanValue - * </ul> - * - */ - @Column(name="IS_ENCRYPT" , nullable=false ) - protected int isEncrypt = XAConstants.BOOL_FALSE; - - /** - * Is recursive - * <ul> - * <li>This attribute is of type enum CommonEnums::BooleanValue - * </ul> - * - */ - @Column(name="IS_RECURSIVE" , nullable=false ) - protected int isRecursive = XAConstants.BOOL_NONE; - - /** - * Group to which this resource belongs to - * <ul> - * <li>The maximum length for this attribute is <b>1024</b>. - * </ul> - * - */ - @Column(name="RES_GROUP" , length=1024) - protected String resourceGroup; - - /** - * Databases - * <ul> - * <li>The maximum length for this attribute is <b>10000</b>. - * </ul> - * - */ - @Column(name="RES_DBS" , length=10000) - protected String databases; - - /** - * Tables - * <ul> - * <li>The maximum length for this attribute is <b>10000</b>. - * </ul> - * - */ - @Column(name="RES_TABLES" , length=10000) - protected String tables; - - /** - * Column families - * <ul> - * <li>The maximum length for this attribute is <b>10000</b>. - * </ul> - * - */ - @Column(name="RES_COL_FAMS" , length=10000) - protected String columnFamilies; - - /** - * Columns - * <ul> - * <li>The maximum length for this attribute is <b>10000</b>. - * </ul> - * - */ - @Column(name="RES_COLS" , length=10000) - protected String columns; - - /** - * UDFs - * <ul> - * <li>The maximum length for this attribute is <b>10000</b>. - * </ul> - * - */ - @Column(name="RES_UDFS" , length=10000) - protected String udfs; - - /** - * Resource Status - * <ul> - * <li>This attribute is of type enum CommonEnums::ActiveStatus - * </ul> - * - */ - @Column(name="RES_STATUS" , nullable=false ) - protected int resourceStatus = XAConstants.STATUS_ENABLED; - - /** - * Table Type - * <ul> - * <li>This attribute is of type enum CommonEnums::PolicyType - * </ul> - * - */ - @Column(name="TABLE_TYPE" , nullable=false ) - protected int tableType = AppConstants.POLICY_INCLUSION; - - /** - * Resource Status - * <ul> - * <li>This attribute is of type enum CommonEnums::PolicyType - * </ul> - * - */ - @Column(name="COL_TYPE" , nullable=false ) - protected int columnType = AppConstants.POLICY_INCLUSION; - /** - * Topologoies - * <ul> - * <li>The maximum length for this attribute is <b>10000</b>. - * </ul> - * - */ - @Column(name="RES_TOPOLOGIES" , length=10000) - protected String topologies; - /** - * SERVICENAMES - * <ul> - * <li>The maximum length for this attribute is <b>10000</b>. - * </ul> - * - */ - @Column(name="RES_SERVICES" , length=10000) - protected String services; - - /** - * Default constructor. This will set all the attributes to default value. - */ - public XXResource ( ) { - resourceType = AppConstants.RESOURCE_PATH; - isEncrypt = XAConstants.BOOL_FALSE; - isRecursive = XAConstants.BOOL_NONE; - resourceStatus = XAConstants.STATUS_ENABLED; - tableType = AppConstants.POLICY_INCLUSION; - columnType = AppConstants.POLICY_INCLUSION; - } - - @Override - public int getMyClassType( ) { - return AppConstants.CLASS_TYPE_XA_RESOURCE; - } - - @Override - public String getMyDisplayValue() { - return getDescription( ); - } - - /** - * This method sets the value to the member attribute <b>name</b>. - * You cannot set null to the attribute. - * @param name Value to set member attribute <b>name</b> - */ - public void setName( String name ) { - this.name = name; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - /** - * Returns the value for the member attribute <b>name</b> - * @return String - value of member attribute <b>name</b>. - */ - public String getName( ) { - return this.name; - } - - /** - * This method sets the value to the member attribute <b>description</b>. - * You cannot set null to the attribute. - * @param description Value to set member attribute <b>description</b> - */ - public void setDescription( String description ) { - this.description = description; - } - - /** - * Returns the value for the member attribute <b>description</b> - * @return String - value of member attribute <b>description</b>. - */ - public String getDescription( ) { - return this.description; - } - - /** - * This method sets the value to the member attribute <b>resourceType</b>. - * You cannot set null to the attribute. - * @param resourceType Value to set member attribute <b>resourceType</b> - */ - public void setResourceType( int resourceType ) { - this.resourceType = resourceType; - } - - /** - * Returns the value for the member attribute <b>resourceType</b> - * @return int - value of member attribute <b>resourceType</b>. - */ - public int getResourceType( ) { - return this.resourceType; - } - - /** - * This method sets the value to the member attribute <b>assetId</b>. - * You cannot set null to the attribute. - * @param assetId Value to set member attribute <b>assetId</b> - */ - public void setAssetId( Long assetId ) { - this.assetId = assetId; - } - - /** - * Returns the value for the member attribute <b>assetId</b> - * @return Long - value of member attribute <b>assetId</b>. - */ - public Long getAssetId( ) { - return this.assetId; - } - - - /** - * This method sets the value to the member attribute <b>parentId</b>. - * You cannot set null to the attribute. - * @param parentId Value to set member attribute <b>parentId</b> - */ - public void setParentId( Long parentId ) { - this.parentId = parentId; - } - - /** - * Returns the value for the member attribute <b>parentId</b> - * @return Long - value of member attribute <b>parentId</b>. - */ - public Long getParentId( ) { - return this.parentId; - } - - - /** - * This method sets the value to the member attribute <b>parentPath</b>. - * You cannot set null to the attribute. - * @param parentPath Value to set member attribute <b>parentPath</b> - */ - public void setParentPath( String parentPath ) { - this.parentPath = parentPath; - } - - /** - * Returns the value for the member attribute <b>parentPath</b> - * @return String - value of member attribute <b>parentPath</b>. - */ - public String getParentPath( ) { - return this.parentPath; - } - - /** - * This method sets the value to the member attribute <b>isEncrypt</b>. - * You cannot set null to the attribute. - * @param isEncrypt Value to set member attribute <b>isEncrypt</b> - */ - public void setIsEncrypt( int isEncrypt ) { - this.isEncrypt = isEncrypt; - } - - /** - * Returns the value for the member attribute <b>isEncrypt</b> - * @return int - value of member attribute <b>isEncrypt</b>. - */ - public int getIsEncrypt( ) { - return this.isEncrypt; - } - - /** - * This method sets the value to the member attribute <b>isRecursive</b>. - * You cannot set null to the attribute. - * @param isRecursive Value to set member attribute <b>isRecursive</b> - */ - public void setIsRecursive( int isRecursive ) { - this.isRecursive = isRecursive; - } - - /** - * Returns the value for the member attribute <b>isRecursive</b> - * @return int - value of member attribute <b>isRecursive</b>. - */ - public int getIsRecursive( ) { - return this.isRecursive; - } - - /** - * This method sets the value to the member attribute <b>resourceGroup</b>. - * You cannot set null to the attribute. - * @param resourceGroup Value to set member attribute <b>resourceGroup</b> - */ - public void setResourceGroup( String resourceGroup ) { - this.resourceGroup = resourceGroup; - } - - /** - * Returns the value for the member attribute <b>resourceGroup</b> - * @return String - value of member attribute <b>resourceGroup</b>. - */ - public String getResourceGroup( ) { - return this.resourceGroup; - } - - /** - * This method sets the value to the member attribute <b>databases</b>. - * You cannot set null to the attribute. - * @param databases Value to set member attribute <b>databases</b> - */ - public void setDatabases( String databases ) { - this.databases = databases; - } - - /** - * Returns the value for the member attribute <b>databases</b> - * @return String - value of member attribute <b>databases</b>. - */ - public String getDatabases( ) { - return this.databases; - } - - /** - * This method sets the value to the member attribute <b>tables</b>. - * You cannot set null to the attribute. - * @param tables Value to set member attribute <b>tables</b> - */ - public void setTables( String tables ) { - this.tables = tables; - } - - /** - * Returns the value for the member attribute <b>tables</b> - * @return String - value of member attribute <b>tables</b>. - */ - public String getTables( ) { - return this.tables; - } - - /** - * This method sets the value to the member attribute <b>columnFamilies</b>. - * You cannot set null to the attribute. - * @param columnFamilies Value to set member attribute <b>columnFamilies</b> - */ - public void setColumnFamilies( String columnFamilies ) { - this.columnFamilies = columnFamilies; - } - - /** - * Returns the value for the member attribute <b>columnFamilies</b> - * @return String - value of member attribute <b>columnFamilies</b>. - */ - public String getColumnFamilies( ) { - return this.columnFamilies; - } - - /** - * This method sets the value to the member attribute <b>columns</b>. - * You cannot set null to the attribute. - * @param columns Value to set member attribute <b>columns</b> - */ - public void setColumns( String columns ) { - this.columns = columns; - } - - /** - * Returns the value for the member attribute <b>columns</b> - * @return String - value of member attribute <b>columns</b>. - */ - public String getColumns( ) { - return this.columns; - } - - /** - * This method sets the value to the member attribute <b>udfs</b>. - * You cannot set null to the attribute. - * @param udfs Value to set member attribute <b>udfs</b> - */ - public void setUdfs( String udfs ) { - this.udfs = udfs; - } - - /** - * Returns the value for the member attribute <b>udfs</b> - * @return String - value of member attribute <b>udfs</b>. - */ - public String getUdfs( ) { - return this.udfs; - } - - /** - * This method sets the value to the member attribute <b>resourceStatus</b>. - * You cannot set null to the attribute. - * @param resourceStatus Value to set member attribute <b>resourceStatus</b> - */ - public void setResourceStatus( int resourceStatus ) { - this.resourceStatus = resourceStatus; - } - - /** - * Returns the value for the member attribute <b>resourceStatus</b> - * @return int - value of member attribute <b>resourceStatus</b>. - */ - public int getResourceStatus( ) { - return this.resourceStatus; - } - - /** - * This method sets the value to the member attribute <b>tableType</b>. - * You cannot set null to the attribute. - * @param tableType Value to set member attribute <b>tableType</b> - */ - public void setTableType( int tableType ) { - this.tableType = tableType; - } - - /** - * Returns the value for the member attribute <b>tableType</b> - * @return int - value of member attribute <b>tableType</b>. - */ - public int getTableType( ) { - return this.tableType; - } - - /** - * This method sets the value to the member attribute <b>columnType</b>. - * You cannot set null to the attribute. - * @param columnType Value to set member attribute <b>columnType</b> - */ - public void setColumnType( int columnType ) { - this.columnType = columnType; - } - - /** - * Returns the value for the member attribute <b>columnType</b> - * @return int - value of member attribute <b>columnType</b>. - */ - public int getColumnType( ) { - return this.columnType; - } - - /** - * Returns the value for the member attribute <b>topologies</b> - * @return String - value of member attribute <b>topologies</b>. - */ - public String getTopologies() { - return topologies; - } - - /** - * This method sets the value to the member attribute <b>topologies</b>. - * You cannot set null to the attribute. - * @param topologies Value to set member attribute <b>topologies</b> - */ - public void setTopologies(String topologies) { - this.topologies = topologies; - } - - /** - * Returns the value for the member attribute <b>services</b> - * @return String - value of member attribute <b>services</b>. - */ - public String getServices() { - return services; - } - - /** - * This method sets the value to the member attribute <b>services</b>. - * You cannot set null to the attribute. - * @param services Value to set member attribute <b>services</b> - */ - public void setServices(String services) { - this.services = services; - } - /** - * This return the bean content in string format - * @return formatedStr - */ - @Override - public String toString( ) { - String str = "XXResource={"; - str += super.toString(); - str += "name={" + name + "} "; - str += "policyName={" + policyName + "} "; - str += "description={" + description + "} "; - str += "resourceType={" + resourceType + "} "; - str += "assetId={" + assetId + "} "; - str += "parentId={" + parentId + "} "; - str += "parentPath={" + parentPath + "} "; - str += "isEncrypt={" + isEncrypt + "} "; - str += "isRecursive={" + isRecursive + "} "; - str += "resourceGroup={" + resourceGroup + "} "; - str += "databases={" + databases + "} "; - str += "tables={" + tables + "} "; - str += "columnFamilies={" + columnFamilies + "} "; - str += "columns={" + columns + "} "; - str += "udfs={" + udfs + "} "; - str += "resourceStatus={" + resourceStatus + "} "; - str += "tableType={" + tableType + "} "; - str += "columnType={" + columnType + "} "; - str += "topologies={" + topologies + "} "; - str += "services={" + services + "} "; - str += "}"; - return str; - } - - /** - * Checks for all attributes except referenced db objects - * @return true if all attributes match - */ - @Override - public boolean equals( Object obj) { - if ( !super.equals(obj) ) { - return false; - } - XXResource other = (XXResource) obj; - if ((this.name == null && other.name != null) || (this.name != null && !this.name.equals(other.name))) { - return false; - } - if ((this.description == null && other.description != null) || (this.description != null && !this.description.equals(other.description))) { - return false; - } - if( this.resourceType != other.resourceType ) return false; - if ((this.assetId == null && other.assetId != null) || (this.assetId != null && !this.assetId.equals(other.assetId))) { - return false; - } - if ((this.parentId == null && other.parentId != null) || (this.parentId != null && !this.parentId.equals(other.parentId))) { - return false; - } - if ((this.parentPath == null && other.parentPath != null) || (this.parentPath != null && !this.parentPath.equals(other.parentPath))) { - return false; - } - if( this.isEncrypt != other.isEncrypt ) return false; - if( this.isRecursive != other.isRecursive ) return false; - if ((this.resourceGroup == null && other.resourceGroup != null) || (this.resourceGroup != null && !this.resourceGroup.equals(other.resourceGroup))) { - return false; - } - if ((this.databases == null && other.databases != null) || (this.databases != null && !this.databases.equals(other.databases))) { - return false; - } - if ((this.tables == null && other.tables != null) || (this.tables != null && !this.tables.equals(other.tables))) { - return false; - } - if ((this.columnFamilies == null && other.columnFamilies != null) || (this.columnFamilies != null && !this.columnFamilies.equals(other.columnFamilies))) { - return false; - } - if ((this.columns == null && other.columns != null) || (this.columns != null && !this.columns.equals(other.columns))) { - return false; - } - if ((this.udfs == null && other.udfs != null) || (this.udfs != null && !this.udfs.equals(other.udfs))) { - return false; - } - if( this.resourceStatus != other.resourceStatus ) return false; - if( this.tableType != other.tableType ) return false; - if( this.columnType != other.columnType ) return false; - - if ((this.topologies == null && other.topologies != null) - || (this.topologies != null && !this.topologies.equals(other.topologies))) { - return false; - } - if ((this.services == null && other.services != null) - || (this.services != null && !this.services.equals(other.services))) { - return false; - } - return true; - } - public static String getEnumName(String fieldName ) { - if( fieldName.equals("resourceType") ) { - return "CommonEnums.ResourceType"; - } - if( fieldName.equals("isEncrypt") ) { - return "CommonEnums.BooleanValue"; - } - if( fieldName.equals("isRecursive") ) { - return "CommonEnums.BooleanValue"; - } - if( fieldName.equals("resourceStatus") ) { - return "CommonEnums.ActiveStatus"; - } - if( fieldName.equals("tableType") ) { - return "CommonEnums.PolicyType"; - } - if( fieldName.equals("columnType") ) { - return "CommonEnums.PolicyType"; - } - if( fieldName.equals("assetType") ) { - return "CommonEnums.AssetType"; - } - //Later TODO - //return super.getEnumName(fieldName); - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/entity/XXTrxLog.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/com/xasecure/entity/XXTrxLog.java b/security-admin/src/main/java/com/xasecure/entity/XXTrxLog.java deleted file mode 100644 index c91e803..0000000 --- a/security-admin/src/main/java/com/xasecure/entity/XXTrxLog.java +++ /dev/null @@ -1,523 +0,0 @@ -/* - * 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 com.xasecure.entity; - -/** - * Logging table for all DB create and update queries - * - */ - -import java.util.*; -import javax.persistence.*; -import javax.xml.bind.annotation.*; -import com.xasecure.common.*; -import com.xasecure.entity.*; - - -@Entity -@Table(name="x_trx_log") -@XmlRootElement -public class XXTrxLog extends XXDBBase implements java.io.Serializable { - private static final long serialVersionUID = 1L; - - @Id - @SequenceGenerator(name="X_TRX_LOG_SEQ",sequenceName="X_TRX_LOG_SEQ",allocationSize=1) - @GeneratedValue(strategy=GenerationType.AUTO,generator="X_TRX_LOG_SEQ") - @Column(name="ID") - protected Long id; - @Override - public void setId(Long id) { - this.id=id; - } - @Override - public Long getId() { - return id; - } - /** - * Name of the class to which the object id belongs to - * <ul> - * <li>This attribute is of type enum CommonEnums::ClassTypes - * </ul> - * - */ - @Column(name="CLASS_TYPE" , nullable=false ) - protected int objectClassType = XAConstants.CLASS_TYPE_NONE; - - /** - * Id of the object to which this notes refers to - * <ul> - * </ul> - * - */ - @Column(name="OBJECT_ID" ) - protected Long objectId; - - /** - * Object Id of the parent object - * <ul> - * </ul> - * - */ - @Column(name="PARENT_OBJECT_ID" ) - protected Long parentObjectId; - - /** - * Object Class Type of the parent object - * <ul> - * </ul> - * - */ - @Column(name="PARENT_OBJECT_CLASS_TYPE" , nullable=false ) - protected int parentObjectClassType; - - /** - * Name of the attribute that was changed - * <ul> - * <li>The maximum length for this attribute is <b>1024</b>. - * </ul> - * - */ - @Column(name="PARENT_OBJECT_NAME" , length=1024) - protected String parentObjectName; - - /** - * Name of the attribute that was changed - * <ul> - * <li>The maximum length for this attribute is <b>1024</b>. - * </ul> - * - */ - @Column(name="OBJECT_NAME" , length=1024) - protected String objectName; - - /** - * Name of the attribute that was changed - * <ul> - * <li>The maximum length for this attribute is <b>255</b>. - * </ul> - * - */ - @Column(name="ATTR_NAME" , length=255) - protected String attributeName; - - /** - * Previous value - * <ul> - * <li>The maximum length for this attribute is <b>1024</b>. - * </ul> - * - */ - @Column(name="PREV_VAL" , length=1024) - protected String previousValue; - - /** - * New value - * <ul> - * <li>The maximum length for this attribute is <b>1024</b>. - * </ul> - * - */ - @Column(name="NEW_VAL" , length=1024) - protected String newValue; - - /** - * Transaction id - * <ul> - * <li>The maximum length for this attribute is <b>1024</b>. - * </ul> - * - */ - @Column(name="TRX_ID" , length=1024) - protected String transactionId; - - /** - * Action of the transaction - * <ul> - * <li>The maximum length for this attribute is <b>255</b>. - * </ul> - * - */ - @Column(name="ACTION" , length=255) - protected String action; - - /** - * Session Id - * <ul> - * <li>The maximum length for this attribute is <b>512</b>. - * </ul> - * - */ - @Column(name="SESS_ID" , length=512) - protected String sessionId; - - /** - * Request Id - * <ul> - * </ul> - * - */ - @Column(name="REQ_ID" ) - protected String requestId; - - /** - * Session Type - * <ul> - * </ul> - * - */ - @Column(name="SESS_TYPE" ) - protected String sessionType; - - /** - * Default constructor. This will set all the attributes to default value. - */ - public XXTrxLog ( ) { - objectClassType = XAConstants.CLASS_TYPE_NONE; - } - - @Override - public int getMyClassType( ) { - return AppConstants.CLASS_TYPE_TRX_LOG; - } - - /** - * This method sets the value to the member attribute <b>objectClassType</b>. - * You cannot set null to the attribute. - * @param objectClassType Value to set member attribute <b>objectClassType</b> - */ - public void setObjectClassType( int objectClassType ) { - this.objectClassType = objectClassType; - } - - /** - * Returns the value for the member attribute <b>objectClassType</b> - * @return int - value of member attribute <b>objectClassType</b>. - */ - public int getObjectClassType( ) { - return this.objectClassType; - } - - /** - * This method sets the value to the member attribute <b>objectId</b>. - * You cannot set null to the attribute. - * @param objectId Value to set member attribute <b>objectId</b> - */ - public void setObjectId( Long objectId ) { - this.objectId = objectId; - } - - /** - * Returns the value for the member attribute <b>objectId</b> - * @return Long - value of member attribute <b>objectId</b>. - */ - public Long getObjectId( ) { - return this.objectId; - } - - /** - * This method sets the value to the member attribute <b>parentObjectId</b>. - * You cannot set null to the attribute. - * @param parentObjectId Value to set member attribute <b>parentObjectId</b> - */ - public void setParentObjectId( Long parentObjectId ) { - this.parentObjectId = parentObjectId; - } - - /** - * Returns the value for the member attribute <b>parentObjectId</b> - * @return Long - value of member attribute <b>parentObjectId</b>. - */ - public Long getParentObjectId( ) { - return this.parentObjectId; - } - - /** - * This method sets the value to the member attribute <b>parentObjectClassType</b>. - * You cannot set null to the attribute. - * @param parentObjectClassType Value to set member attribute <b>parentObjectClassType</b> - */ - public void setParentObjectClassType( int parentObjectClassType ) { - this.parentObjectClassType = parentObjectClassType; - } - - /** - * Returns the value for the member attribute <b>parentObjectClassType</b> - * @return int - value of member attribute <b>parentObjectClassType</b>. - */ - public int getParentObjectClassType( ) { - return this.parentObjectClassType; - } - - /** - * This method sets the value to the member attribute <b>parentObjectName</b>. - * You cannot set null to the attribute. - * @param parentObjectName Value to set member attribute <b>parentObjectName</b> - */ - public void setParentObjectName( String parentObjectName ) { - this.parentObjectName = parentObjectName; - } - - /** - * Returns the value for the member attribute <b>parentObjectName</b> - * @return String - value of member attribute <b>parentObjectName</b>. - */ - public String getParentObjectName( ) { - return this.parentObjectName; - } - - /** - * This method sets the value to the member attribute <b>objectName</b>. - * You cannot set null to the attribute. - * @param objectName Value to set member attribute <b>objectName</b> - */ - public void setObjectName( String objectName ) { - this.objectName = objectName; - } - - /** - * Returns the value for the member attribute <b>objectName</b> - * @return String - value of member attribute <b>objectName</b>. - */ - public String getObjectName( ) { - return this.objectName; - } - - /** - * This method sets the value to the member attribute <b>attributeName</b>. - * You cannot set null to the attribute. - * @param attributeName Value to set member attribute <b>attributeName</b> - */ - public void setAttributeName( String attributeName ) { - this.attributeName = attributeName; - } - - /** - * Returns the value for the member attribute <b>attributeName</b> - * @return String - value of member attribute <b>attributeName</b>. - */ - public String getAttributeName( ) { - return this.attributeName; - } - - /** - * This method sets the value to the member attribute <b>previousValue</b>. - * You cannot set null to the attribute. - * @param previousValue Value to set member attribute <b>previousValue</b> - */ - public void setPreviousValue( String previousValue ) { - this.previousValue = previousValue; - } - - /** - * Returns the value for the member attribute <b>previousValue</b> - * @return String - value of member attribute <b>previousValue</b>. - */ - public String getPreviousValue( ) { - return this.previousValue; - } - - /** - * This method sets the value to the member attribute <b>newValue</b>. - * You cannot set null to the attribute. - * @param newValue Value to set member attribute <b>newValue</b> - */ - public void setNewValue( String newValue ) { - this.newValue = newValue; - } - - /** - * Returns the value for the member attribute <b>newValue</b> - * @return String - value of member attribute <b>newValue</b>. - */ - public String getNewValue( ) { - return this.newValue; - } - - /** - * This method sets the value to the member attribute <b>transactionId</b>. - * You cannot set null to the attribute. - * @param transactionId Value to set member attribute <b>transactionId</b> - */ - public void setTransactionId( String transactionId ) { - this.transactionId = transactionId; - } - - /** - * Returns the value for the member attribute <b>transactionId</b> - * @return String - value of member attribute <b>transactionId</b>. - */ - public String getTransactionId( ) { - return this.transactionId; - } - - /** - * This method sets the value to the member attribute <b>action</b>. - * You cannot set null to the attribute. - * @param action Value to set member attribute <b>action</b> - */ - public void setAction( String action ) { - this.action = action; - } - - /** - * Returns the value for the member attribute <b>action</b> - * @return String - value of member attribute <b>action</b>. - */ - public String getAction( ) { - return this.action; - } - - /** - * This method sets the value to the member attribute <b>sessionId</b>. - * You cannot set null to the attribute. - * @param sessionId Value to set member attribute <b>sessionId</b> - */ - public void setSessionId( String sessionId ) { - this.sessionId = sessionId; - } - - /** - * Returns the value for the member attribute <b>sessionId</b> - * @return String - value of member attribute <b>sessionId</b>. - */ - public String getSessionId( ) { - return this.sessionId; - } - - /** - * This method sets the value to the member attribute <b>requestId</b>. - * You cannot set null to the attribute. - * @param requestId Value to set member attribute <b>requestId</b> - */ - public void setRequestId( String requestId ) { - this.requestId = requestId; - } - - /** - * Returns the value for the member attribute <b>requestId</b> - * @return String - value of member attribute <b>requestId</b>. - */ - public String getRequestId( ) { - return this.requestId; - } - - /** - * This method sets the value to the member attribute <b>sessionType</b>. - * You cannot set null to the attribute. - * @param sessionType Value to set member attribute <b>sessionType</b> - */ - public void setSessionType( String sessionType ) { - this.sessionType = sessionType; - } - - /** - * Returns the value for the member attribute <b>sessionType</b> - * @return String - value of member attribute <b>sessionType</b>. - */ - public String getSessionType( ) { - return this.sessionType; - } - - /** - * This return the bean content in string format - * @return formatedStr - */ - @Override - public String toString( ) { - String str = "XXTrxLog={"; - str += super.toString(); - str += "objectClassType={" + objectClassType + "} "; - str += "objectId={" + objectId + "} "; - str += "parentObjectId={" + parentObjectId + "} "; - str += "parentObjectClassType={" + parentObjectClassType + "} "; - str += "parentObjectName={" + parentObjectName + "} "; - str += "objectName={" + objectName + "} "; - str += "attributeName={" + attributeName + "} "; - str += "previousValue={" + previousValue + "} "; - str += "newValue={" + newValue + "} "; - str += "transactionId={" + transactionId + "} "; - str += "action={" + action + "} "; - str += "sessionId={" + sessionId + "} "; - str += "requestId={" + requestId + "} "; - str += "sessionType={" + sessionType + "} "; - str += "}"; - return str; - } - - /** - * Checks for all attributes except referenced db objects - * @return true if all attributes match - */ - @Override - public boolean equals( Object obj) { - if ( !super.equals(obj) ) { - return false; - } - XXTrxLog other = (XXTrxLog) obj; - if( this.objectClassType != other.objectClassType ) return false; - if ((this.objectId == null && other.objectId != null) || (this.objectId != null && !this.objectId.equals(other.objectId))) { - return false; - } - if ((this.parentObjectId == null && other.parentObjectId != null) || (this.parentObjectId != null && !this.parentObjectId.equals(other.parentObjectId))) { - return false; - } - if( this.parentObjectClassType != other.parentObjectClassType ) return false; - if ((this.parentObjectName == null && other.parentObjectName != null) || (this.parentObjectName != null && !this.parentObjectName.equals(other.parentObjectName))) { - return false; - } - if ((this.objectName == null && other.objectName != null) || (this.objectName != null && !this.objectName.equals(other.objectName))) { - return false; - } - if ((this.attributeName == null && other.attributeName != null) || (this.attributeName != null && !this.attributeName.equals(other.attributeName))) { - return false; - } - if ((this.previousValue == null && other.previousValue != null) || (this.previousValue != null && !this.previousValue.equals(other.previousValue))) { - return false; - } - if ((this.newValue == null && other.newValue != null) || (this.newValue != null && !this.newValue.equals(other.newValue))) { - return false; - } - if ((this.transactionId == null && other.transactionId != null) || (this.transactionId != null && !this.transactionId.equals(other.transactionId))) { - return false; - } - if ((this.action == null && other.action != null) || (this.action != null && !this.action.equals(other.action))) { - return false; - } - if ((this.sessionId == null && other.sessionId != null) || (this.sessionId != null && !this.sessionId.equals(other.sessionId))) { - return false; - } - if ((this.requestId == null && other.requestId != null) || (this.requestId != null && !this.requestId.equals(other.requestId))) { - return false; - } - if ((this.sessionType == null && other.sessionType != null) || (this.sessionType != null && !this.sessionType.equals(other.sessionType))) { - return false; - } - return true; - } - public static String getEnumName(String fieldName ) { - if( fieldName.equals("objectClassType") ) { - return "CommonEnums.ClassTypes"; - } - //Later TODO - //return super.getEnumName(fieldName); - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/entity/XXUser.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/com/xasecure/entity/XXUser.java b/security-admin/src/main/java/com/xasecure/entity/XXUser.java deleted file mode 100644 index bc5817a..0000000 --- a/security-admin/src/main/java/com/xasecure/entity/XXUser.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * 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 com.xasecure.entity; - -/** - * User - * - */ - -import java.util.*; -import javax.persistence.*; -import javax.xml.bind.annotation.*; -import com.xasecure.common.*; -import com.xasecure.entity.*; - - -@Entity -@Table(name="x_user") -@XmlRootElement -public class XXUser extends XXDBBase implements java.io.Serializable { - private static final long serialVersionUID = 1L; - - - @Id - @SequenceGenerator(name="X_USER_SEQ",sequenceName="X_USER_SEQ",allocationSize=1) - @GeneratedValue(strategy=GenerationType.AUTO,generator="X_USER_SEQ") - @Column(name="ID") - protected Long id; - @Override - public void setId(Long id) { - this.id=id; - } - @Override - public Long getId() { - return id; - } - /** - * Name - * <ul> - * <li>The maximum length for this attribute is <b>1024</b>. - * </ul> - * - */ - @Column(name="USER_NAME" , nullable=false , length=1024) - protected String name; - - /** - * Description - * <ul> - * <li>The maximum length for this attribute is <b>4000</b>. - * </ul> - * - */ - @Column(name="DESCR" , nullable=false , length=4000) - protected String description; - - /** - * Status - * <ul> - * <li>This attribute is of type enum CommonEnums::ActiveStatus - * </ul> - * - */ - @Column(name="STATUS" , nullable=false ) - protected int status = XAConstants.STATUS_DISABLED; - - /** - * Id of the credential store - * <ul> - * </ul> - * - */ - @Column(name="CRED_STORE_ID" ) - protected Long credStoreId; - - - /** - * Default constructor. This will set all the attributes to default value. - */ - public XXUser ( ) { - status = XAConstants.STATUS_DISABLED; - } - - @Override - public int getMyClassType( ) { - return AppConstants.CLASS_TYPE_XA_USER; - } - - @Override - public String getMyDisplayValue() { - return getDescription( ); - } - - /** - * This method sets the value to the member attribute <b>name</b>. - * You cannot set null to the attribute. - * @param name Value to set member attribute <b>name</b> - */ - public void setName( String name ) { - this.name = name; - } - - /** - * Returns the value for the member attribute <b>name</b> - * @return String - value of member attribute <b>name</b>. - */ - public String getName( ) { - return this.name; - } - - /** - * This method sets the value to the member attribute <b>description</b>. - * You cannot set null to the attribute. - * @param description Value to set member attribute <b>description</b> - */ - public void setDescription( String description ) { - this.description = description; - } - - /** - * Returns the value for the member attribute <b>description</b> - * @return String - value of member attribute <b>description</b>. - */ - public String getDescription( ) { - return this.description; - } - - /** - * This method sets the value to the member attribute <b>status</b>. - * You cannot set null to the attribute. - * @param status Value to set member attribute <b>status</b> - */ - public void setStatus( int status ) { - this.status = status; - } - - /** - * Returns the value for the member attribute <b>status</b> - * @return int - value of member attribute <b>status</b>. - */ - public int getStatus( ) { - return this.status; - } - - /** - * This method sets the value to the member attribute <b>credStoreId</b>. - * You cannot set null to the attribute. - * @param credStoreId Value to set member attribute <b>credStoreId</b> - */ - public void setCredStoreId( Long credStoreId ) { - this.credStoreId = credStoreId; - } - - /** - * Returns the value for the member attribute <b>credStoreId</b> - * @return Long - value of member attribute <b>credStoreId</b>. - */ - public Long getCredStoreId( ) { - return this.credStoreId; - } - - - /** - * This return the bean content in string format - * @return formatedStr - */ - @Override - public String toString( ) { - String str = "XXUser={"; - str += super.toString(); - str += "name={" + name + "} "; - str += "description={" + description + "} "; - str += "status={" + status + "} "; - str += "credStoreId={" + credStoreId + "} "; - str += "}"; - return str; - } - - /** - * Checks for all attributes except referenced db objects - * @return true if all attributes match - */ - @Override - public boolean equals( Object obj) { - if ( !super.equals(obj) ) { - return false; - } - XXUser other = (XXUser) obj; - if ((this.name == null && other.name != null) || (this.name != null && !this.name.equals(other.name))) { - return false; - } - if ((this.description == null && other.description != null) || (this.description != null && !this.description.equals(other.description))) { - return false; - } - if( this.status != other.status ) return false; - if ((this.credStoreId == null && other.credStoreId != null) || (this.credStoreId != null && !this.credStoreId.equals(other.credStoreId))) { - return false; - } - return true; - } - public static String getEnumName(String fieldName ) { - if( fieldName.equals("status") ) { - return "CommonEnums.ActiveStatus"; - } - //Later TODO - //return super.getEnumName(fieldName); - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/entity/view/VXXTrxLog.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/com/xasecure/entity/view/VXXTrxLog.java b/security-admin/src/main/java/com/xasecure/entity/view/VXXTrxLog.java deleted file mode 100644 index 5865f5b..0000000 --- a/security-admin/src/main/java/com/xasecure/entity/view/VXXTrxLog.java +++ /dev/null @@ -1,399 +0,0 @@ -/* - * 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 com.xasecure.entity.view; - - -import java.util.Date; - -import javax.persistence.*; -import javax.xml.bind.annotation.*; - -import com.xasecure.common.XAConstants; -import com.xasecure.common.DateUtil; - -@Entity -@Table(name="vx_trx_log") -@XmlRootElement -public class VXXTrxLog implements java.io.Serializable { - private static final long serialVersionUID = 1L; - - - public static final int SHARE_PREF_DEFAULT = 0; - - @Id - @SequenceGenerator(name="V_TRX_LOG_SEQ",sequenceName="V_TRX_LOG_SEQ",allocationSize=1) - @GeneratedValue(strategy=GenerationType.AUTO,generator="V_TRX_LOG_SEQ") - @Column(name="ID") - protected Long id; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="CREATE_TIME" , nullable=false ) - protected Date createTime = DateUtil.getUTCDate(); - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="UPDATE_TIME" , nullable=false ) - protected Date updateTime = DateUtil.getUTCDate(); - - @Column(name="ADDED_BY_ID" ) - protected Long addedByUserId; - - @Column(name="UPD_BY_ID" ) - protected Long updatedByUserId; - - @Column(name="CLASS_TYPE" , nullable=false ) - protected int objectClassType = XAConstants.CLASS_TYPE_NONE; - - @Column(name="OBJECT_ID" ) - protected Long objectId; - - @Column(name="PARENT_OBJECT_ID" , nullable=false ) - protected Long parentObjectId; - - @Column(name="PARENT_OBJECT_CLASS_TYPE" , nullable=false ) - protected int parentObjectClassType; - - @Column(name="ATTR_NAME" , nullable=false , length=255) - protected String attributeName; - - @Column(name="PARENT_OBJECT_NAME" , length=1024) - protected String parentObjectName; - - @Column(name="OBJECT_NAME" , length=1024) - protected String objectName; - - @Column(name="PREV_VAL" , length=1024) - protected String previousValue; - - @Column(name="NEW_VAL" , nullable=true , length=1024) - protected String newValue; - - @Column(name="TRX_ID" , nullable=false , length=1024) - protected String transactionId; - - @Column(name="ACTION" , length=255) - protected String action; - - @Column(name="SESS_ID" ) - protected String sessionId; - - @Column(name="REQ_ID" , nullable=false ) - protected String requestId; - - @Column(name="SESS_TYPE" , nullable=false ) - protected String sessionType; - - - /** - * This method sets the value to the member attribute <b>parentObjectId</b>. - * You cannot set null to the attribute. - * @param parentObjectId Value to set member attribute <b>parentObjectId</b> - */ - public void setParentObjectId( Long parentObjectId ) { - this.parentObjectId = parentObjectId; - } - - /** - * Returns the value for the member attribute <b>parentObjectId</b> - * @return Long - value of member attribute <b>parentObjectId</b>. - */ - public Long getParentObjectId( ) { - return this.parentObjectId; - } - - /** - * This method sets the value to the member attribute <b>parentObjectClassType</b>. - * You cannot set null to the attribute. - * @param parentObjectClassType Value to set member attribute <b>parentObjectClassType</b> - */ - public void setParentObjectClassType( int parentObjectClassType ) { - this.parentObjectClassType = parentObjectClassType; - } - - /** - * Returns the value for the member attribute <b>parentObjectClassType</b> - * @return int - value of member attribute <b>parentObjectClassType</b>. - */ - public int getParentObjectClassType( ) { - return this.parentObjectClassType; - } - - /** - * This method sets the value to the member attribute <b>attributeName</b>. - * You cannot set null to the attribute. - * @param attributeName Value to set member attribute <b>attributeName</b> - */ - public void setAttributeName( String attributeName ) { - this.attributeName = attributeName; - } - - /** - * Returns the value for the member attribute <b>attributeName</b> - * @return String - value of member attribute <b>attributeName</b>. - */ - public String getAttributeName( ) { - return this.attributeName; - } - - /** - * This method sets the value to the member attribute <b>previousValue</b>. - * You cannot set null to the attribute. - * @param previousValue Value to set member attribute <b>previousValue</b> - */ - public void setPreviousValue( String previousValue ) { - this.previousValue = previousValue; - } - - /** - * Returns the value for the member attribute <b>previousValue</b> - * @return String - value of member attribute <b>previousValue</b>. - */ - public String getPreviousValue( ) { - return this.previousValue; - } - - /** - * This method sets the value to the member attribute <b>newValue</b>. - * You cannot set null to the attribute. - * @param newValue Value to set member attribute <b>newValue</b> - */ - public void setNewValue( String newValue ) { - this.newValue = newValue; - } - - /** - * Returns the value for the member attribute <b>newValue</b> - * @return String - value of member attribute <b>newValue</b>. - */ - public String getNewValue( ) { - return this.newValue; - } - - /** - * This method sets the value to the member attribute <b>transactionId</b>. - * You cannot set null to the attribute. - * @param transactionId Value to set member attribute <b>transactionId</b> - */ - public void setTransactionId( String transactionId ) { - this.transactionId = transactionId; - } - - /** - * Returns the value for the member attribute <b>transactionId</b> - * @return String - value of member attribute <b>transactionId</b>. - */ - public String getTransactionId( ) { - return this.transactionId; - } - - /** - * This method sets the value to the member attribute <b>action</b>. - * You cannot set null to the attribute. - * @param action Value to set member attribute <b>action</b> - */ - public void setAction( String action ) { - this.action = action; - } - - /** - * Returns the value for the member attribute <b>action</b> - * @return String - value of member attribute <b>action</b>. - */ - public String getAction( ) { - return this.action; - } - - /** - * This method sets the value to the member attribute <b>sessionId</b>. - * You cannot set null to the attribute. - * @param sessionId Value to set member attribute <b>sessionId</b> - */ - public void setSessionId( String sessionId ) { - this.sessionId = sessionId; - } - - /** - * Returns the value for the member attribute <b>sessionId</b> - * @return String - value of member attribute <b>sessionId</b>. - */ - public String getSessionId( ) { - return this.sessionId; - } - - /** - * This method sets the value to the member attribute <b>requestId</b>. - * You cannot set null to the attribute. - * @param requestId Value to set member attribute <b>requestId</b> - */ - public void setRequestId( String requestId ) { - this.requestId = requestId; - } - - /** - * Returns the value for the member attribute <b>requestId</b> - * @return String - value of member attribute <b>requestId</b>. - */ - public String getRequestId( ) { - return this.requestId; - } - - /** - * This method sets the value to the member attribute <b>sessionType</b>. - * You cannot set null to the attribute. - * @param sessionType Value to set member attribute <b>sessionType</b> - */ - public void setSessionType( String sessionType ) { - this.sessionType = sessionType; - } - - /** - * Returns the value for the member attribute <b>sessionType</b> - * @return String - value of member attribute <b>sessionType</b>. - */ - public String getSessionType( ) { - return this.sessionType; - } - - /** - * @return the parentObjectName - */ - public String getParentObjectName() { - return parentObjectName; - } - - /** - * @param parentObjectName the parentObjectName to set - */ - public void setParentObjectName(String parentObjectName) { - this.parentObjectName = parentObjectName; - } - - /** - * @return the objectName - */ - public String getObjectName() { - return objectName; - } - - /** - * @param objectName the objectName to set - */ - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - /** - * @return the id - */ - public Long getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(Long id) { - this.id = id; - } - - /** - * @return the createTime - */ - public Date getCreateTime() { - return createTime; - } - - /** - * @param createTime the createTime to set - */ - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - /** - * @return the updateTime - */ - public Date getUpdateTime() { - return updateTime; - } - - /** - * @param updateTime the updateTime to set - */ - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - /** - * @return the addedByUserId - */ - public Long getAddedByUserId() { - return addedByUserId; - } - - /** - * @param addedByUserId the addedByUserId to set - */ - public void setAddedByUserId(Long addedByUserId) { - this.addedByUserId = addedByUserId; - } - - - /** - * @return the updatedByUserId - */ - public Long getUpdatedByUserId() { - return updatedByUserId; - } - - /** - * @param updatedByUserId the updatedByUserId to set - */ - public void setUpdatedByUserId(Long updatedByUserId) { - this.updatedByUserId = updatedByUserId; - } - - /** - * @return the objectClassType - */ - public int getObjectClassType() { - return objectClassType; - } - - /** - * @param objectClassType the objectClassType to set - */ - public void setObjectClassType(int objectClassType) { - this.objectClassType = objectClassType; - } - - /** - * @return the objectId - */ - public Long getObjectId() { - return objectId; - } - - /** - * @param objectId the objectId to set - */ - public void setObjectId(Long objectId) { - this.objectId = objectId; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/json/Folder.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/com/xasecure/json/Folder.java b/security-admin/src/main/java/com/xasecure/json/Folder.java deleted file mode 100644 index 87ce55c..0000000 --- a/security-admin/src/main/java/com/xasecure/json/Folder.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 com.xasecure.json; - -import java.util.List; - -public class Folder { - - String name; - List<Folder> folders; - - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public List<Folder> getFolders() { - return folders; - } - public void setFolders(List<Folder> folders) { - this.folders = folders; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/json/JsonDateSerializer.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/com/xasecure/json/JsonDateSerializer.java b/security-admin/src/main/java/com/xasecure/json/JsonDateSerializer.java deleted file mode 100644 index ebbac08..0000000 --- a/security-admin/src/main/java/com/xasecure/json/JsonDateSerializer.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 com.xasecure.json; - -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; -import org.springframework.stereotype.Component; - -/** - * Used to serialize Java.util.Date, which is not a common JSON type, so we have - * to create a custom serialize method;. - * - */ -@Component -public class JsonDateSerializer extends JsonSerializer<Date> { - - private static final SimpleDateFormat dateFormat = new SimpleDateFormat - ("yyyy-MM-dd'T'HH:mm:ss'Z'"); - @Override - public void serialize(Date date, JsonGenerator gen, - SerializerProvider provider) throws IOException, - JsonProcessingException { - - String formattedDate = dateFormat.format(date); - gen.writeString(formattedDate); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/patch/BaseLoader.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/com/xasecure/patch/BaseLoader.java b/security-admin/src/main/java/com/xasecure/patch/BaseLoader.java deleted file mode 100644 index 0418e21..0000000 --- a/security-admin/src/main/java/com/xasecure/patch/BaseLoader.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * 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 com.xasecure.patch; - -import java.text.DecimalFormat; -import java.util.Date; - -import com.xasecure.common.DateUtil; - -import org.apache.log4j.Logger; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import com.xasecure.util.CLIUtil; - -/** - * - * - */ -public abstract class BaseLoader { - static Logger logger = Logger.getLogger(BaseLoader.class); - - long startTime = DateUtil.getUTCDate().getTime(); - long lastTime = startTime; - int countSoFar = 0; - int countFromLastTime = 0; - boolean moreToProcess = true; - boolean firstCall = true; - int batchSize = -1; - DecimalFormat twoDForm = new DecimalFormat("#.00"); - - public BaseLoader() { - } - - public void init(int batchSize) throws Exception { - this.batchSize = batchSize; - CLIUtil cliUtil = (CLIUtil) CLIUtil.getBean(CLIUtil.class); - cliUtil.authenticate(); - } - - public void init() throws Exception { - init(-1); - } - - abstract public void printStats(); - - public abstract void execLoad(); - - public void onExit() { - logger.info("onExit()"); - } - - /** - * @return the moreToProcess - */ - public boolean isMoreToProcess() { - return moreToProcess; - } - - /** - * @param moreToProcess - * the moreToProcess to set - */ - public void setMoreToProcess(boolean moreToProcess) { - this.moreToProcess = moreToProcess; - } - - @Transactional(readOnly = false, propagation = Propagation.REQUIRED) - public void load() { - if (firstCall) { - startTime = DateUtil.getUTCDate().getTime(); - startProgressMonitor(); - firstCall = false; - } - try { - execLoad(); - if (batchSize < 0) { - moreToProcess = false; - } - } catch (Throwable t) { - logger.error("Error while loading data.", t); - moreToProcess = false; - } - if (!moreToProcess) { - long endTime = DateUtil.getUTCDate().getTime(); - - logger.info("###############################################"); - printStats(); - logger.info("Loading completed!!!. Time taken=" - + formatTimeTaken(endTime - startTime) + " for " - + countSoFar); - logger.info("###############################################"); - synchronized (twoDForm) { - twoDForm.notifyAll(); - } - - } - } - - public void startProgressMonitor() { - Thread monitorThread = new Thread("Loader Monitor") { - @Override - public void run() { - while (isMoreToProcess()) { - printStats(); - try { - synchronized (twoDForm) { - if (!isMoreToProcess()) { - break; - } - twoDForm.wait(30 * 1000); - } - // Thread.sleep(60 * 1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - logger.info("Monitor Thread exiting!!!"); - } - }; - monitorThread.setDaemon(true); - monitorThread.start(); - - } - - public String timeTakenSoFar(int lineCount) { - countSoFar = lineCount; - long currTime = DateUtil.getUTCDate().getTime(); - String retStr = formatTimeTaken(currTime - startTime); - if (currTime - startTime > 0 && countSoFar > 0) { - double rateSoFar = countSoFar * 1000 / (currTime - startTime); - retStr = retStr + " " + ". Rate so far for " + countSoFar + " is " - + twoDForm.format(rateSoFar); - - if (currTime - lastTime > 0 && lineCount - countFromLastTime > 0) { - double rateFromLastCall = (lineCount - countFromLastTime) - * 1000.0 / (currTime - lastTime); - retStr = retStr + ", Last " - + formatTimeTaken(currTime - lastTime) + " for " - + (lineCount - countFromLastTime) + " is " - + twoDForm.format(rateFromLastCall); - } - - } - - lastTime = currTime; - countFromLastTime = countSoFar; - return retStr; - } - - String formatTimeTaken(long totalTime) { - if (totalTime <= 0) { - return "0ms"; - } - long ms = totalTime % 1000; - String retValue = ms + "ms"; - - totalTime = totalTime / 1000; - if (totalTime > 0) { - long secs = totalTime % 60; - retValue = secs + "secs, " + retValue; - - totalTime = totalTime / 60; - if (totalTime > 0) { - long mins = totalTime % 60; - retValue = mins + "mins, " + retValue; - - totalTime = totalTime / 60; - if (totalTime > 0) { - long hrs = totalTime % 60; - retValue = hrs + "hrs, " + retValue; - } - } - } - - return retValue; - - } - - protected void print(int count, String message) { - if (count > 0) { - logger.info(message.trim() + " : " + count); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/patch/PatchPasswordEncryption_J10001.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/com/xasecure/patch/PatchPasswordEncryption_J10001.java b/security-admin/src/main/java/com/xasecure/patch/PatchPasswordEncryption_J10001.java deleted file mode 100644 index e8c4370..0000000 --- a/security-admin/src/main/java/com/xasecure/patch/PatchPasswordEncryption_J10001.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 com.xasecure.patch; - -import java.util.List; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.xasecure.common.StringUtil; -import com.xasecure.db.XADaoManager; -import com.xasecure.entity.XXAsset; -import com.xasecure.service.XAssetService; -import com.xasecure.util.CLIUtil; - -@Component -public class PatchPasswordEncryption_J10001 extends BaseLoader { - static Logger logger = Logger.getLogger(PatchPasswordEncryption_J10001.class); - int lineCount = 0; - - @Autowired - XADaoManager xaDaoManager; - - @Autowired - StringUtil stringUtil; - - @Autowired - XAssetService xAssetService; - - public PatchPasswordEncryption_J10001() { - } - - - @Override - public void printStats() { - logger.info("Time taken so far:" + timeTakenSoFar(lineCount) - + ", moreToProcess=" + isMoreToProcess()); - print(lineCount, "Processed lines"); - } - - @Override - public void execLoad() { - encryptLookupUserPassword(); - } - - private void encryptLookupUserPassword() { - List<XXAsset> xAssetList = xaDaoManager.getXXAsset().getAll(); - String oldConfig=null; - String newConfig=null; - for (XXAsset xAsset : xAssetList) { - oldConfig=null; - newConfig=null; - oldConfig=xAsset.getConfig(); - if(!stringUtil.isEmpty(oldConfig)){ - newConfig=xAssetService.getConfigWithEncryptedPassword(oldConfig,false); - xAsset.setConfig(newConfig); - xaDaoManager.getXXAsset().update(xAsset); - } - lineCount++; - logger.info("Lookup Password updated for Asset : " - + xAsset.getName()); - logger.info("oldconfig : "+ oldConfig); - logger.info("newConfig : "+ newConfig); - print(lineCount, "Total updated assets count : "); - } - } - - public static void main(String[] args) { - logger.info("main()"); - try { - PatchPasswordEncryption_J10001 loader = (PatchPasswordEncryption_J10001) CLIUtil - .getBean(PatchPasswordEncryption_J10001.class); - //loader.init(); - while (loader.isMoreToProcess()) { - loader.load(); - } - logger.info("Load complete. Exiting!!!"); - System.exit(0); - }catch (Exception e) { - logger.error("Error loading", e); - System.exit(1); - } - } - -}
