ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject [27/44] ARGUS-1. Initial code commit (Selvamohan Neethiraj via omalley)
Date Thu, 14 Aug 2014 20:50:38 GMT
http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/XAConstants.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/XAConstants.java b/security-admin/src/main/java/com/xasecure/common/XAConstants.java
new file mode 100644
index 0000000..ac09365
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/XAConstants.java
@@ -0,0 +1,150 @@
+/**
+ *
+ */
+
+package com.xasecure.common;
+
+public class XAConstants extends XACommonEnums {
+
+	// Default Roles
+	public final static String ROLE_SYS_ADMIN = "ROLE_SYS_ADMIN";
+	public final static String ROLE_ADMIN = "ROLE_ADMIN";
+	public final static String ROLE_INTEGRATOR = "ROLE_INTEGRATOR";
+	public final static String ROLE_DATA_ANALYST = "ROLE_DATA_ANALYST";
+	public final static String ROLE_BIZ_MGR = "ROLE_BIZ_MGR";
+
+	public final static String ROLE_USER = "ROLE_USER";
+	public final static String ROLE_ANON = "ROLE_ANON";
+	public final static String ROLE_OTHER = "ROLE_OTHER";
+	public final static String GROUP_PUBLIC = "public";
+	// Action constants
+	public final static String ACTION_EDIT = "edit";
+	public final static String ACTION_CHANGE = "change";
+	public final static String ACTION_DELETE = "delete";
+	public final static String ACTION_MARK_SPAM = "mark_spam";
+	public final static String ACTION_RATE = "rate";
+	public final static String ACTION_SELECT = "select";
+	public final static String ACTION_UNSELECT = "unselect";
+	public final static String ACTION_HIDE = "hide";
+	public final static String ACTION_UNHIDE = "unhide";
+	public final static String ACTION_SHARE = "share";
+	public final static String ACTION_UNSHARE = "unshare";
+	public final static String ACTION_BOOKMARK = "bookmark";
+	public final static String ACTION_UNBOOKMARK = "unbookmark";
+
+	// Sendgrid email API constants
+	public static final String SENDGRID_API_USER = "api_user";
+	public static final String SENDGRID_API_KEY = "api_key";
+	public static final String SENDGRID_TO = "to";
+	public static final String SENDGRID_TO_NAME = "toname";
+	public static final String SENDGRID_SUBJECT = "subject";
+	public static final String SENDGRID_TEXT = "text";
+	public static final String SENDGRID_HTML = "html";
+	public static final String SENDGRID_FROM_EMAIL = "from";
+	public static final String SENDGRID_FROM_NAME = "fromname";
+	public static final String SENDGRID_BCC = "bcc";
+	public static final String SENDGRID_CC = "cc";
+	public static final String SENDGRID_REPLY_TO = "replyto";
+	
+	// User create validation errors
+	public enum ValidationUserProfile {
+
+		NO_EMAIL_ADDR("xa.validation.userprofile.no_email_addr",
+				"Email address not provided"), INVALID_EMAIL_ADDR(
+				"xa.validation.userprofile.userprofile.invalid_email_addr",
+				"Invalid email address"), NO_FIRST_NAME(
+				"xa.validation.userprofile.userprofile.no_first_name",
+				"First name not provided"), INVALID_FIRST_NAME(
+				"xa.validation.userprofile.invalid_first_name",
+				"Invalid first name"), NO_LAST_NAME(
+				"xa.validation.userprofile.noemailaddr",
+				"Email address not provided"), INVALID_LAST_NAME(
+				"xa.validation.userprofile.noemailaddr",
+				"Email address not provided"), NO_PUBLIC_SCREEN_NAME(
+				"xa.validation.userprofile.noemailaddr",
+				"Email address not provided"), INVALID_PUBLIC_SCREEN_NAME(
+				"xa.validation.userprofile.noemailaddr",
+				"Email address not provided");
+
+		String rbKey;
+		String message;
+
+		ValidationUserProfile(String rbKey, String message) {
+			this.rbKey = rbKey;
+			this.message = message;
+		}
+	};
+
+	// these constants will be used in setting GjResponse object.
+
+	public final static String USER_PENDING_APPROVAL_MSG = "User is yet not reviewed by Administrator. Please contact at <number>.";
+	public final static int USER_PENDING_APPROVAL_STATUS_CODE = 0;
+
+	public final static String USER_APPROVAL_MSG = "User is approved";
+	public final static int USER_APPROVAL_STATUS_CODE = 1;
+
+	public final static String USER_REJECTION_MSG = "User is rejected";
+	public final static int USER_REJECTION_STATUS_CODE = 1;
+
+	public final static String USER_STATUS_ALREADY_CHANGED_MSG = "Can not change user status. it is either already activated/approved/rejected";
+	public final static int USER_STATUS_ALREADY_CHANGED_STATUS_CODE = 0;
+
+	public final static String USER_ALREADY_ACTIVATED_MSG = "Your account is already activated. If you have forgotten your password, then from the login page, select 'Forgot Password'";
+	public final static int USER_ALREADY_ACTIVATED_STATUS_CODE = 0;
+
+	public final static String USER_STATUS_NOT_ACTIVE_MSG = "User is not in active status. Please activate your account first.";
+	public final static int USER_STATUS_NOT_ACTIVE_STATUS_CODE = 0;
+
+	public final static String INVALID_EMAIL_ADDRESS_MSG = "Invalid email address";
+	public final static int INVALID_EMAIL_ADDRESS_STATUS_CODE = 0;
+
+	public final static String WRONG_ACTIVATION_CODE_MSG = "Wrong activation code";
+	public final static int WRONG_ACTIVATION_CODE_STATUS_CODE = 0;
+
+	public final static String VALID_EMAIL_ADDRESS_MSG = "Valid email address";
+	public final static int VALID_EMAIL_ADDRESS_STATUS_CODE = 1;
+
+	public final static String NO_ACTIVATION_RECORD_FOR_USER_ERR_MSG = "No activation record found for user:";
+	public final static String NO_ACTIVATION_ENTRY = "activation entry not found";
+
+	public final static String VALIDATION_INVALID_DATA_DESC = "Invalid value for";
+	public final static int VALIDATION_INVALID_DATA_CODE = 0;
+	public static final String GROUP_MODERATORS = "GROUP_MODERATORS";
+
+	// public final static String EMAIL_WELCOME_MSG =
+	// "Welcome to iSchoolCircle";
+	// public final static String EMAIL_LINK_WELCOME_MSG =
+	// "Welcome to iSchoolCircle ! Please verify your account by clicking on the link below: ";
+	// public static final String EMAIL_EDIT_REJECTED_MSG =
+	// "Your changes not approved for public sharing.";
+	// public static final String EMAIL_APPROVAL_NEEDED_MSG =
+	// "New objects pending approval";
+	// public static final String EMAIL_PWD_RESET_CODE_MSG =
+	// "iSchoolCircle - Password Reset";
+
+	public final static String PWD_RESET_FAILED_MSG = "Invalid password reset request";
+
+	public final static String INVALID_NEW_PASSWORD_MSG = "Invalid new password";
+	public static final String EMAIL_NEW_FEEDBACK_RECEIVED = "New feedback from";
+	public static final int INITIAL_DOCUMENT_VERSION = 1;
+
+	public static final int EMAIL_TYPE_ACCOUNT_CREATE = 0;
+	public static final int EMAIL_TYPE_USER_CREATE = 1;
+	public static final int EMAIL_TYPE_USER_ACCT_ADD = 2;
+	public static final int EMAIL_TYPE_DOCUMENT_CREATE = 3;
+	public static final int EMAIL_TYPE_DISCUSSION_CREATE = 4;
+	public static final int EMAIL_TYPE_NOTE_CREATE = 5;	
+	public static final int EMAIL_TYPE_TASK_CREATE = 6;
+	public static final int EMAIL_TYPE_USER_PASSWORD = 7;
+	public static final int EMAIL_TYPE_USER_ACTIVATION = 8;
+	public static final int EMAIL_TYPE_USER_ROLE_UPDATED = 9;
+	public static final int EMAIL_TYPE_USER_GRP_ADD = 10;
+	
+	public static enum RBAC_PERM {
+		ALLOW_NONE, 
+		ALLOW_READ, 
+		ALLOW_WRITE, 
+		ALLOW_DELETE
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/XAJAXBContextResolver.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/XAJAXBContextResolver.java b/security-admin/src/main/java/com/xasecure/common/XAJAXBContextResolver.java
new file mode 100644
index 0000000..4b0e8e0
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/XAJAXBContextResolver.java
@@ -0,0 +1,53 @@
+package com.xasecure.common;
+
+import com.xasecure.common.*;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBContext;
+
+import com.sun.jersey.api.json.JSONConfiguration;
+import com.sun.jersey.api.json.JSONJAXBContext;
+
+/**
+ * 
+ *
+ */
+@Provider
+public class XAJAXBContextResolver implements ContextResolver<JAXBContext> {
+
+    private JAXBContext context;
+    private Class<?>[] types = {
+	com.xasecure.view.VXAuthSessionList.class,
+	com.xasecure.view.VXResponse.class,
+	com.xasecure.view.VXStringList.class,
+	com.xasecure.view.VXPortalUserList.class,
+	com.xasecure.view.VXAssetList.class,
+	com.xasecure.view.VXResourceList.class,
+	com.xasecure.view.VXCredentialStoreList.class,
+	com.xasecure.view.VXGroupList.class,
+	com.xasecure.view.VXUserList.class,
+	com.xasecure.view.VXGroupUserList.class,
+	com.xasecure.view.VXGroupGroupList.class,
+	com.xasecure.view.VXPermMapList.class,
+	com.xasecure.view.VXAuditMapList.class,
+	com.xasecure.view.VXPolicyExportAuditList.class,
+	com.xasecure.view.VXAccessAuditList.class
+    };
+
+    public XAJAXBContextResolver() throws Exception {
+	JSONConfiguration config = JSONConfiguration.natural().build();
+	context = new JSONJAXBContext(config, types);
+    }
+
+    @Override
+    public JAXBContext getContext(Class<?> objectType) {
+	// return context;
+	for (Class<?> type : types) {
+	    if (type.getName().equals(objectType.getName())) {
+		return context;
+	    }
+	}
+	return null;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/XASearchUtil.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/XASearchUtil.java b/security-admin/src/main/java/com/xasecure/common/XASearchUtil.java
new file mode 100644
index 0000000..409227d
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/XASearchUtil.java
@@ -0,0 +1,60 @@
+package com.xasecure.common;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.xasecure.db.XADaoManager;
+import com.xasecure.common.SearchCriteria;
+import com.xasecure.common.SearchField;
+import com.xasecure.common.SearchUtil;
+
+@Component
+public class XASearchUtil extends SearchUtil {
+	final static Logger logger = Logger.getLogger(XASearchUtil.class);
+	/*
+	@Override
+	public Query createSearchQuery(EntityManager em, String queryStr, String sortClause,
+			SearchCriteria searchCriteria, List<SearchField> searchFields,
+			int objectClassType, boolean hasAttributes, boolean isCountQuery){
+
+		// [1] Build where clause
+		StringBuilder queryClause = buildWhereClause(searchCriteria,
+				searchFields);
+
+		// [2] Add domain-object-security clause if needed
+		// if (objectClassType != -1
+		// && !ContextUtil.getCurrentUserSession().isUserAdmin()) {
+		// addDomainObjectSecuirtyClause(queryClause, hasAttributes);
+		// }
+
+		// [2] Add order by clause
+		addOrderByClause(queryClause, sortClause);
+
+		// [3] Create Query Object
+		Query query = em.createQuery(
+					queryStr + queryClause);
+
+		// [4] Resolve query parameters with values
+		resolveQueryParams(query, searchCriteria, searchFields);
+
+		// [5] Resolve domain-object-security parameters
+		// if (objectClassType != -1 &&
+		// !securityHandler.hasModeratorPermission()) {
+		// resolveDomainObjectSecuirtyParams(query, objectClassType);
+		// }
+
+		if (!isCountQuery) {
+			query.setFirstResult(searchCriteria.getStartIndex());
+			updateQueryPageSize(query, searchCriteria);
+		}
+
+		return query;
+	}
+	*/
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationClassName.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationClassName.java b/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationClassName.java
new file mode 100644
index 0000000..e7bc219
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationClassName.java
@@ -0,0 +1,13 @@
+/**
+ *
+ */
+package com.xasecure.common.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface XAAnnotationClassName {
+    public Class class_name();
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationJSMgrName.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationJSMgrName.java b/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationJSMgrName.java
new file mode 100644
index 0000000..4f1ca96
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationJSMgrName.java
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package com.xasecure.common.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * 
+ *
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface XAAnnotationJSMgrName {
+    public String value();
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationRestAPI.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationRestAPI.java b/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationRestAPI.java
new file mode 100644
index 0000000..98cb3f6
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/annotation/XAAnnotationRestAPI.java
@@ -0,0 +1,17 @@
+/**
+ *
+ */
+package com.xasecure.common.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * Annotating the REST APIs
+ *
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface XAAnnotationRestAPI {
+    public String api_name() default "";
+    public boolean updates_generic_objects() default false;
+    public String updates_classes() default "";
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/db/BaseDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/db/BaseDao.java b/security-admin/src/main/java/com/xasecure/common/db/BaseDao.java
new file mode 100644
index 0000000..5c1af2c
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/db/BaseDao.java
@@ -0,0 +1,190 @@
+package com.xasecure.common.db;
+
+/*
+ * Copyright (c) 2014 XASecure.
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+
+import org.apache.log4j.Logger;
+
+import com.xasecure.common.ContextUtil;
+import com.xasecure.db.XADaoManager;
+import com.xasecure.db.XADaoManagerBase;
+import com.xasecure.entity.XXDBBase;
+
+public abstract class BaseDao<T> {
+	static final Logger logger = Logger.getLogger(BaseDao.class);
+
+	protected XADaoManager daoManager;
+
+	EntityManager em;
+
+	protected Class<T> tClass;
+
+	public BaseDao(XADaoManagerBase daoManager) {
+		this.daoManager = (XADaoManager) daoManager;
+		this.init(daoManager.getEntityManager());
+	}
+
+	public BaseDao(XADaoManagerBase daoManager, String persistenceContextUnit) {
+		this.daoManager = (XADaoManager) daoManager;
+
+		EntityManager em = this.daoManager.getEntityManager(persistenceContextUnit);
+
+		this.init(em);
+	}
+
+	@SuppressWarnings("unchecked")
+	private void init(EntityManager em) {
+		this.em = em;
+
+		ParameterizedType genericSuperclass = (ParameterizedType) getClass()
+				.getGenericSuperclass();
+
+		Type type = genericSuperclass.getActualTypeArguments()[0];
+
+		if (type instanceof ParameterizedType) {
+			this.tClass = (Class<T>) ((ParameterizedType) type).getRawType();
+		} else {
+			this.tClass = (Class<T>) type;
+		}
+	}
+
+	public EntityManager getEntityManager() {
+		return this.em;
+	}
+
+	public T create(T obj) {
+		T ret = null;
+
+		em.persist(obj);
+		em.flush();
+
+		ret = obj;
+		return ret;
+	}
+
+	public T update(T obj) {
+		em.merge(obj);
+		em.flush();
+		return obj;
+	}
+
+	public boolean remove(Long id) {
+		return remove(getById(id));
+	}
+
+	public boolean remove(T obj) {
+		if (obj == null) {
+			return true;
+		}
+
+		em.remove(obj);
+		em.flush();
+
+		return true;
+	}
+
+	public T getById(Long id) {
+		if (id == null) {
+			return null;
+		}
+		T ret = null;
+		try {
+			ret = em.find(tClass, id);
+		} catch (NoResultException e) {
+			return null;
+		}
+		return ret;
+	}
+
+	public List<T> findByNamedQuery(String namedQuery, String paramName,
+			Object refId) {
+		List<T> ret = new ArrayList<T>();
+
+		if (namedQuery == null) {
+			return ret;
+		}
+		try {
+			TypedQuery<T> qry = em.createNamedQuery(namedQuery, tClass);
+			qry.setParameter(paramName, refId);
+			ret = qry.getResultList();
+		} catch (NoResultException e) {
+			// ignore
+		}
+		return ret;
+	}
+
+	public List<T> findByParentId(Long parentId) {
+		String namedQuery = tClass.getSimpleName() + ".findByParentId";
+		return findByNamedQuery(namedQuery, "parentId", parentId);
+	}
+
+	
+	public List<T> executeQueryInSecurityContext(Class<T> clazz, Query query) {
+		return executeQueryInSecurityContext(clazz, query, true);
+	}
+
+	@SuppressWarnings("unchecked")
+	public List<T> executeQueryInSecurityContext(Class<T> clazz, Query query,
+			boolean userPrefFilter) {
+		// boolean filterEnabled = false;
+		List<T> rtrnList = null;
+		try {
+			// filterEnabled = enableVisiblityFilters(clazz, userPrefFilter);
+
+			rtrnList = query.getResultList();
+		} finally {
+			// if (filterEnabled) {
+			// disableVisiblityFilters(clazz);
+			// }
+
+		}
+
+		return rtrnList;
+	}
+
+	/**
+	 * @param clazz
+	 * @param query
+	 * @param b
+	 * @return
+	 */
+	private Long executeCountQueryInSecurityContext(Class<T> clazz,
+			Query query, boolean userPrefFilter) {
+		// boolean filterEnabled = false;
+		Long rtrnObj = null;
+		try {
+			// filterEnabled = enableVisiblityFilters(clazz, userPrefFilter);
+			rtrnObj = (Long) query.getSingleResult();
+		} finally {
+			// if (filterEnabled) {
+			// disableVisiblityFilters(clazz);
+			// }
+		}
+
+		return rtrnObj;
+	}
+
+	public Long executeCountQueryInSecurityContext(Class<T> clazz, Query query) {
+		return executeCountQueryInSecurityContext(clazz, query, true);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/db/JPABeanCallbacks.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/db/JPABeanCallbacks.java b/security-admin/src/main/java/com/xasecure/common/db/JPABeanCallbacks.java
new file mode 100644
index 0000000..8e09b0d
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/db/JPABeanCallbacks.java
@@ -0,0 +1,86 @@
+package com.xasecure.common.db;
+
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+
+import com.xasecure.common.DateUtil;
+import com.xasecure.common.UserSessionBase;
+import com.xasecure.entity.XXDBBase;
+
+import org.apache.log4j.Logger;
+
+import com.xasecure.security.context.XAContextHolder;
+import com.xasecure.security.context.XASecurityContext;
+
+public class JPABeanCallbacks {
+	static final Logger logger = Logger.getLogger(JPABeanCallbacks.class);
+
+	@PrePersist
+	void onPrePersist(Object o) {
+		try {
+			if (o != null && o instanceof XXDBBase) {
+				XXDBBase entity = (XXDBBase) o;
+
+				entity.setUpdateTime(DateUtil.getUTCDate());
+
+				XASecurityContext context = XAContextHolder
+						.getSecurityContext();
+				if (context != null) {
+					UserSessionBase userSession = context.getUserSession();
+					if (userSession != null) {
+						entity.setAddedByUserId(userSession.getUserId());
+						entity.setUpdatedByUserId(userSession
+								.getUserId());
+					}
+				} else {
+					if (logger.isDebugEnabled()) {
+						logger.debug(
+								"Security context not found for this request. obj="
+										+ o, new Throwable());
+					}
+				}
+			}
+		} catch (Throwable t) {
+			logger.error(t);
+		}
+
+	}
+
+	// @PostPersist
+	// void onPostPersist(Object o) {
+	// if (o != null && o instanceof MBase) {
+	// MBase entity = (MBase) o;
+	// if (logger.isDebugEnabled()) {
+	// logger.debug("DBChange.create:class=" + o.getClass().getName()
+	// + entity.getId());
+	// }
+	//
+	// }
+	// }
+
+	// @PostLoad void onPostLoad(Object o) {}
+
+	@PreUpdate
+	void onPreUpdate(Object o) {
+		try {
+			if (o != null && o instanceof XXDBBase) {
+				XXDBBase entity = (XXDBBase) o;
+				entity.setUpdateTime(DateUtil.getUTCDate());
+			}
+		} catch (Throwable t) {
+			logger.error(t);
+		}
+
+	}
+
+	// @PostUpdate
+	// void onPostUpdate(Object o) {
+	// }
+
+	// @PreRemove void onPreRemove(Object o) {}
+
+	// @PostRemove
+	// void onPostRemove(Object o) {
+	// }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/view/VEnum.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/view/VEnum.java b/security-admin/src/main/java/com/xasecure/common/view/VEnum.java
new file mode 100644
index 0000000..348169f
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/view/VEnum.java
@@ -0,0 +1,88 @@
+package com.xasecure.common.view;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.xasecure.common.XACommonEnums;
+
+
+@XmlRootElement
+public class VEnum extends ViewBaseBean implements java.io.Serializable {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Name of the enum
+	 */
+	protected String enumName;
+	/**
+	 * List of elements for this enum
+	 */
+	protected List<VEnumElement> elementList;
+
+	/**
+	 * Default constructor. This will set all the attributes to default value.
+	 */
+	public VEnum() {
+	}
+
+	/**
+	 * This method sets the value to the member attribute <b>enumName</b>. You
+	 * cannot set null to the attribute.
+	 * 
+	 * @param enumName
+	 *            Value to set member attribute <b>enumName</b>
+	 */
+	public void setEnumName(String enumName) {
+		this.enumName = enumName;
+	}
+
+	/**
+	 * Returns the value for the member attribute <b>enumName</b>
+	 * 
+	 * @return String - value of member attribute <b>enumName</b>.
+	 */
+	public String getEnumName() {
+		return this.enumName;
+	}
+
+	/**
+	 * This method sets the value to the member attribute <b>elementList</b>.
+	 * You cannot set null to the attribute.
+	 * 
+	 * @param elementList
+	 *            Value to set member attribute <b>elementList</b>
+	 */
+	public void setElementList(List<VEnumElement> elementList) {
+		this.elementList = elementList;
+	}
+
+	/**
+	 * Returns the value for the member attribute <b>elementList</b>
+	 * 
+	 * @return List<VEnumElement> - value of member attribute
+	 *         <b>elementList</b>.
+	 */
+	public List<VEnumElement> getElementList() {
+		return this.elementList;
+	}
+
+	@Override
+	public int getMyClassType() {
+		return XACommonEnums.CLASS_TYPE_ENUM;
+	}
+
+	/**
+	 * This return the bean content in string format
+	 * 
+	 * @return formatedStr
+	 */
+	public String toString() {
+		String str = "VEnum={";
+		str += super.toString();
+		str += "enumName={" + enumName + "} ";
+		str += "elementList={" + elementList + "} ";
+		str += "}";
+		return str;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/view/VEnumElement.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/view/VEnumElement.java b/security-admin/src/main/java/com/xasecure/common/view/VEnumElement.java
new file mode 100644
index 0000000..c802512
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/view/VEnumElement.java
@@ -0,0 +1,147 @@
+package com.xasecure.common.view;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.xasecure.common.XACommonEnums;
+
+@XmlRootElement
+public class VEnumElement extends ViewBaseBean implements java.io.Serializable {
+	private static final long serialVersionUID = 1L;
+
+
+	/**
+	 * Name of the element
+	 */
+	protected String elementName;
+	/**
+	 * Name of the enum
+	 */
+	protected String enumName;
+	/**
+	 * Value of the element
+	 */
+	protected int elementValue;
+	/**
+	 * Label for the element
+	 */
+	protected String elementLabel;
+	/**
+	 * Resource bundle key
+	 */
+	protected String rbKey;
+
+	/**
+	 * Default constructor. This will set all the attributes to default value.
+	 */
+	public VEnumElement ( ) {
+	}
+
+	/**
+	 * This method sets the value to the member attribute <b>elementName</b>.
+	 * You cannot set null to the attribute.
+	 * @param elementName Value to set member attribute <b>elementName</b>
+	 */
+	public void setElementName( String elementName ) {
+		this.elementName = elementName;
+	}
+
+	
+
+	/**
+	 * @return the elementName
+	 */
+	public String getElementName() {
+		return elementName;
+	}
+
+	/**
+	 * @return the enumName
+	 */
+	public String getEnumName() {
+		return enumName;
+	}
+
+	/**
+	 * @return the rbKey
+	 */
+	public String getRbKey() {
+		return rbKey;
+	}
+
+	/**
+	 * This method sets the value to the member attribute <b>enumName</b>.
+	 * You cannot set null to the attribute.
+	 * @param enumName Value to set member attribute <b>enumName</b>
+	 */
+	public void setEnumName( String enumName ) {
+		this.enumName = enumName;
+	}
+
+	
+
+	/**
+	 * This method sets the value to the member attribute <b>elementValue</b>.
+	 * You cannot set null to the attribute.
+	 * @param elementValue Value to set member attribute <b>elementValue</b>
+	 */
+	public void setElementValue( int elementValue ) {
+		this.elementValue = elementValue;
+	}
+
+	/**
+	 * Returns the value for the member attribute <b>elementValue</b>
+	 * @return int - value of member attribute <b>elementValue</b>.
+	 */
+	public int getElementValue( ) {
+		return this.elementValue;
+	}
+
+	/**
+	 * This method sets the value to the member attribute <b>elementLabel</b>.
+	 * You cannot set null to the attribute.
+	 * @param elementLabel Value to set member attribute <b>elementLabel</b>
+	 */
+	public void setElementLabel( String elementLabel ) {
+		this.elementLabel = elementLabel;
+	}
+
+	/**
+	 * Returns the value for the member attribute <b>elementLabel</b>
+	 * @return String - value of member attribute <b>elementLabel</b>.
+	 */
+	public String getElementLabel( ) {
+		return this.elementLabel;
+	}
+
+	/**
+	 * This method sets the value to the member attribute <b>rbKey</b>.
+	 * You cannot set null to the attribute.
+	 * @param rbKey Value to set member attribute <b>rbKey</b>
+	 */
+	public void setRbKey( String rbKey ) {
+		this.rbKey = rbKey;
+	}
+
+	
+
+	@Override
+	public int getMyClassType( ) {
+	    return XACommonEnums.CLASS_TYPE_ENUM_ELEMENT;
+	}
+
+	/**
+	 * This return the bean content in string format
+	 * @return formatedStr
+	*/
+	public String toString( ) {
+		String str = "VEnumElement={";
+		str += super.toString();
+		str += "elementName={" + elementName + "} ";
+		str += "enumName={" + enumName + "} ";
+		str += "elementValue={" + elementValue + "} ";
+		str += "elementLabel={" + elementLabel + "} ";
+		str += "rbKey={" + rbKey + "} ";
+		str += "}";
+		return str;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/view/VList.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/view/VList.java b/security-admin/src/main/java/com/xasecure/common/view/VList.java
new file mode 100644
index 0000000..a80f564
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/view/VList.java
@@ -0,0 +1,180 @@
+package com.xasecure.common.view;
+
+/*
+ * Copyright (c) 2014 XASecure.
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import java.util.List;
+
+import javax.xml.bind.annotation.*;
+
+@XmlRootElement
+public abstract class VList extends ViewBaseBean implements
+	java.io.Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Start index for the result
+     */
+    protected int startIndex;
+    /**
+     * Page size used for the result
+     */
+    protected int pageSize;
+    /**
+     * Total records in the database for the given search conditions
+     */
+    protected long totalCount;
+    /**
+     * Number of rows returned for the search condition
+     */
+    protected int resultSize;
+    /**
+     * Sort type. Either desc or asc
+     */
+    protected String sortType;
+    /**
+     * Comma seperated list of the fields for sorting
+     */
+    protected String sortBy;
+
+    protected long queryTimeMS = System.currentTimeMillis();
+
+    /**
+     * Default constructor. This will set all the attributes to default value.
+     */
+    public VList() {
+    }
+
+    /**
+     * Initialize with existing list
+     *
+     * @param size
+     */
+    public VList(@SuppressWarnings("rawtypes") List objectList) {
+	int size = 0;
+	if (objectList != null) {
+	    size = objectList.size();
+	}
+
+	startIndex = 0;
+	pageSize = size;
+	totalCount = size;
+	resultSize = size;
+	sortType = null;
+	sortBy = null;
+    }
+
+    abstract public int getListSize();
+
+    abstract public List<?> getList();
+
+    /**
+     * This method sets the value to the member attribute <b>startIndex</b>. You
+     * cannot set null to the attribute.
+     *
+     * @param startIndex
+     *            Value to set member attribute <b>startIndex</b>
+     */
+    public void setStartIndex(int startIndex) {
+	this.startIndex = startIndex;
+    }
+
+
+    /**
+     * This method sets the value to the member attribute <b>pageSize</b>. You
+     * cannot set null to the attribute.
+     *
+     * @param pageSize
+     *            Value to set member attribute <b>pageSize</b>
+     */
+    public void setPageSize(int pageSize) {
+	this.pageSize = pageSize;
+    }
+
+
+    /**
+     * This method sets the value to the member attribute <b>totalCount</b>. You
+     * cannot set null to the attribute.
+     *
+     * @param totalCount
+     *            Value to set member attribute <b>totalCount</b>
+     */
+    public void setTotalCount(long totalCount) {
+	this.totalCount = totalCount;
+    }
+
+    
+
+    /**
+     * This method sets the value to the member attribute <b>resultSize</b>. You
+     * cannot set null to the attribute.
+     *
+     * @param resultSize
+     *            Value to set member attribute <b>resultSize</b>
+     */
+    public void setResultSize(int resultSize) {
+	this.resultSize = resultSize;
+    }
+
+    /**
+     * Returns the value for the member attribute <b>resultSize</b>
+     *
+     * @return int - value of member attribute <b>resultSize</b>.
+     */
+    public int getResultSize() {
+	return getListSize();
+    }
+
+    /**
+     * This method sets the value to the member attribute <b>sortType</b>. You
+     * cannot set null to the attribute.
+     *
+     * @param sortType
+     *            Value to set member attribute <b>sortType</b>
+     */
+    public void setSortType(String sortType) {
+	this.sortType = sortType;
+    }
+
+
+
+    /**
+     * This method sets the value to the member attribute <b>sortBy</b>. You
+     * cannot set null to the attribute.
+     *
+     * @param sortBy
+     *            Value to set member attribute <b>sortBy</b>
+     */
+    public void setSortBy(String sortBy) {
+	this.sortBy = sortBy;
+    }
+
+   
+
+  
+
+    
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+	return "VList [startIndex=" + startIndex + ", pageSize="
+		+ pageSize + ", totalCount=" + totalCount
+		+ ", resultSize=" + resultSize + ", sortType="
+		+ sortType + ", sortBy=" + sortBy + ", queryTimeMS="
+		+ queryTimeMS + "]";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/view/VTrxLogAttr.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/view/VTrxLogAttr.java b/security-admin/src/main/java/com/xasecure/common/view/VTrxLogAttr.java
new file mode 100644
index 0000000..7e39f77
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/view/VTrxLogAttr.java
@@ -0,0 +1,65 @@
+package com.xasecure.common.view;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.xasecure.common.AppConstants;
+
+import com.xasecure.common.XACommonEnums;
+import com.xasecure.common.view.ViewBaseBean;
+
+@XmlRootElement
+public class VTrxLogAttr extends ViewBaseBean implements Serializable{
+	private static final long serialVersionUID = 1L;
+	
+	protected String attribName;
+	protected String attribUserFriendlyName;
+	protected boolean isEnum;
+	
+	public VTrxLogAttr(){}
+
+	public VTrxLogAttr(String attribName, String attribUserFriendlyName,
+			boolean isEnum) {
+		super();
+		this.attribName = attribName;
+		this.attribUserFriendlyName = attribUserFriendlyName;
+		this.isEnum = isEnum;
+	}
+
+	
+
+
+	/**
+	 * @return the attribUserFriendlyName
+	 */
+	public String getAttribUserFriendlyName() {
+		return attribUserFriendlyName;
+	}
+
+
+	/**
+	 * @return the isEnum
+	 */
+	public boolean isEnum() {
+		return isEnum;
+	}
+
+	
+	
+	@Override
+	public int getMyClassType( ) {
+	    return AppConstants.CLASS_TYPE_XA_TRANSACTION_LOG_ATTRIBUTE;
+	}
+
+	@Override
+	public String toString(){
+		String str = "VTrxLogAttr={";
+		str += super.toString();
+		str += "attribName={" + attribName + "} ";
+		str += "attribUserFriendlyName={" + attribUserFriendlyName + "} ";
+		str += "isEnum={" + isEnum + "} ";
+		str += "}";
+		return str;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/common/view/ViewBaseBean.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/common/view/ViewBaseBean.java b/security-admin/src/main/java/com/xasecure/common/view/ViewBaseBean.java
new file mode 100644
index 0000000..bfca9e6
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/common/view/ViewBaseBean.java
@@ -0,0 +1,38 @@
+package com.xasecure.common.view;
+
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+import com.xasecure.common.XACommonEnums;
+import com.xasecure.entity.XXDBBase;
+
+public class ViewBaseBean implements java.io.Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @JsonIgnore
+    private XXDBBase mObj = null;
+
+    /**
+     * @return the gjObj
+     */
+    @XmlTransient
+    @JsonIgnore
+    public XXDBBase getMObj() {
+	return mObj;
+    }
+
+    /**
+     * @param gjObj
+     *            the gjObj to set
+     */
+    public void setMObj(XXDBBase gjObj) {
+	this.mObj = gjObj;
+    }
+
+    @XmlTransient
+    @JsonIgnore
+    public int getMyClassType() {
+	return XACommonEnums.CLASS_TYPE_NONE;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/credentialapi/CredentialReader.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/credentialapi/CredentialReader.java b/security-admin/src/main/java/com/xasecure/credentialapi/CredentialReader.java
new file mode 100644
index 0000000..1b55370
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/credentialapi/CredentialReader.java
@@ -0,0 +1,62 @@
+package com.xasecure.credentialapi;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.alias.CredentialProvider;
+import org.apache.hadoop.security.alias.CredentialProviderFactory;
+import org.apache.hadoop.security.alias.JavaKeyStoreProvider;
+
+public class CredentialReader {
+	
+	public static String getDecryptedString(String CrendentialProviderPath,String alias) {
+		  String credential=null;
+		  try{
+			  if(CrendentialProviderPath==null || alias==null){
+				  return null;
+			  }		  		  
+			  char[] pass = null;
+			  Configuration conf = new Configuration();
+			  String crendentialProviderPrefix=JavaKeyStoreProvider.SCHEME_NAME + "://file";
+			  crendentialProviderPrefix=crendentialProviderPrefix.toLowerCase();
+			  CrendentialProviderPath=CrendentialProviderPath.trim();
+			  alias=alias.trim();
+			  if(CrendentialProviderPath.toLowerCase().startsWith(crendentialProviderPrefix)){
+				  conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH,
+						   //UserProvider.SCHEME_NAME + ":///," +
+				  CrendentialProviderPath);
+			  }else{
+				  conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH,
+						   //UserProvider.SCHEME_NAME + ":///," +
+				  JavaKeyStoreProvider.SCHEME_NAME + "://file" + CrendentialProviderPath);			  
+			  }	 	  
+			  List<CredentialProvider> providers = CredentialProviderFactory.getProviders(conf);
+			  List<String> aliasesList=new ArrayList<String>();
+			  CredentialProvider.CredentialEntry credEntry=null;
+			  for(CredentialProvider provider: providers) {
+	              //System.out.println("Credential Provider :" + provider);
+				  aliasesList=provider.getAliases();
+				  if(aliasesList!=null && aliasesList.contains(alias.toLowerCase())){
+					  credEntry=null;
+					  credEntry= provider.getCredentialEntry(alias);
+					  pass = credEntry.getCredential();
+					  if(pass!=null && pass.length>0){
+						  credential=String.valueOf(pass);
+						  break;
+					  }				  
+				  }
+			  }
+		  }catch(Exception ex){
+			  ex.printStackTrace();
+			  credential=null;
+		  }
+		  return credential;
+	  }
+  
+  /*
+  public static void main(String args[]) throws Exception{
+	  String keystoreFile =new String("/tmp/mykey3.jceks");  
+	  String password=CredentialReader.getDecryptedString(keystoreFile, "mykey3");
+	   System.out.println(password);
+  }*/
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XADaoManager.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XADaoManager.java b/security-admin/src/main/java/com/xasecure/db/XADaoManager.java
new file mode 100644
index 0000000..9ec914e
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XADaoManager.java
@@ -0,0 +1,70 @@
+package com.xasecure.db;
+
+/*
+ * Copyright (c) 2014 XASecure.
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+
+import javax.persistence.*;
+
+import com.xasecure.common.*;
+import org.apache.log4j.Logger;
+
+import com.xasecure.common.db.BaseDao;
+
+import org.springframework.stereotype.Component;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@Component
+public class XADaoManager extends XADaoManagerBase {
+	final static Logger logger = Logger.getLogger(XADaoManager.class);
+
+	@PersistenceContext(unitName = "defaultPU")
+	private EntityManager em;
+
+	@PersistenceContext(unitName = "loggingPU")
+	private EntityManager loggingEM;
+
+	@Autowired
+	StringUtil stringUtil;
+
+	@Override
+	public EntityManager getEntityManager() {
+		return em;
+	}
+
+	public EntityManager getEntityManager(String persistenceContextUnit) {
+		logger.error("XADaoManager.getEntityManager(" + persistenceContextUnit + ")");
+		if (persistenceContextUnit.equalsIgnoreCase("loggingPU")) {
+			return loggingEM;
+		}
+		return getEntityManager();
+	}
+
+	
+	/**
+	 * @return the stringUtil
+	 */
+	public StringUtil getStringUtil() {
+		return stringUtil;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 */
+	@Override
+	public BaseDao<?> getDaoForClassType(int classType) {
+		if (classType == XAConstants.CLASS_TYPE_NONE) {
+			return null;
+		}
+		return super.getDaoForClassType(classType);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XADaoManagerBase.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XADaoManagerBase.java b/security-admin/src/main/java/com/xasecure/db/XADaoManagerBase.java
new file mode 100644
index 0000000..7570580
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XADaoManagerBase.java
@@ -0,0 +1,205 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure
+ */
+
+/**
+ * 
+ */
+
+import javax.persistence.*;
+import java.util.*;
+import org.apache.log4j.Logger;
+import com.xasecure.entity.*;
+import com.xasecure.common.*;
+import com.xasecure.common.db.*;
+import org.springframework.stereotype.Component;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public abstract class XADaoManagerBase {
+	final static Logger logger = Logger.getLogger(XADaoManagerBase.class);
+
+	@Autowired
+	protected RESTErrorUtil restErrorUtil;
+	abstract public EntityManager getEntityManager();
+
+	public XADaoManagerBase() {
+	}
+
+	public BaseDao<?> getDaoForClassType(int classType) {
+		if (classType == AppConstants.CLASS_TYPE_AUTH_SESS) {
+			return getXXAuthSession();
+		}
+		if (classType == AppConstants.CLASS_TYPE_USER_PROFILE) {
+			return getXXPortalUser();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_ASSET) {
+			return getXXAsset();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_RESOURCE) {
+			return getXXResource();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_CRED_STORE) {
+			return getXXCredentialStore();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_GROUP) {
+			return getXXGroup();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_USER) {
+			return getXXUser();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_GROUP_USER) {
+			return getXXGroupUser();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_GROUP_GROUP) {
+			return getXXGroupGroup();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_PERM_MAP) {
+			return getXXPermMap();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_AUDIT_MAP) {
+			return getXXAuditMap();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_POLICY_EXPORT_AUDIT) {
+			return getXXPolicyExportAudit();
+		}
+		if (classType == AppConstants.CLASS_TYPE_TRX_LOG) {
+			return getXXTrxLog();
+		}
+		if (classType == AppConstants.CLASS_TYPE_XA_ACCESS_AUDIT) {
+			return getXXAccessAudit();
+		}
+
+		logger.error("No DaoManager found for classType=" + classType, new Throwable());
+		return null;
+	}
+
+	public BaseDao<?> getDaoForClassName(String className) {
+		if (className.equals("XXDBBase")) {
+			return getXXDBBase();
+		}
+		if (className.equals("XXAuthSession")) {
+			return getXXAuthSession();
+		}
+		if (className.equals("XXPortalUser")) {
+			return getXXPortalUser();
+		}
+		if (className.equals("XXPortalUserRole")) {
+			return getXXPortalUserRole();
+		}
+		if (className.equals("XXAsset")) {
+			return getXXAsset();
+		}
+		if (className.equals("XXResource")) {
+			return getXXResource();
+		}
+		if (className.equals("XXCredentialStore")) {
+			return getXXCredentialStore();
+		}
+		if (className.equals("XXGroup")) {
+			return getXXGroup();
+		}
+		if (className.equals("XXUser")) {
+			return getXXUser();
+		}
+		if (className.equals("XXGroupUser")) {
+			return getXXGroupUser();
+		}
+		if (className.equals("XXGroupGroup")) {
+			return getXXGroupGroup();
+		}
+		if (className.equals("XXPermMap")) {
+			return getXXPermMap();
+		}
+		if (className.equals("XXAuditMap")) {
+			return getXXAuditMap();
+		}
+		if (className.equals("XXPolicyExportAudit")) {
+			return getXXPolicyExportAudit();
+		}
+		if (className.equals("XXTrxLog")) {
+			return getXXTrxLog();
+		}
+		if (className.equals("XXAccessAudit")) {
+			return getXXAccessAudit();
+		}
+
+		logger.error("No DaoManager found for className=" + className, new Throwable());
+		return null;
+	}
+
+	public XXDBBaseDao getXXDBBase() {
+		return new XXDBBaseDao(this);
+	}
+
+	public XXAuthSessionDao getXXAuthSession() {
+		return new XXAuthSessionDao(this);
+	}
+
+	public XXPortalUserDao getXXPortalUser() {
+		return new XXPortalUserDao(this);
+	}
+
+	public XXPortalUserRoleDao getXXPortalUserRole() {
+		return new XXPortalUserRoleDao(this);
+	}
+
+	public XXAssetDao getXXAsset() {
+		return new XXAssetDao(this);
+	}
+
+	public XXResourceDao getXXResource() {
+		return new XXResourceDao(this);
+	}
+
+	public XXCredentialStoreDao getXXCredentialStore() {
+		return new XXCredentialStoreDao(this);
+	}
+
+	public XXGroupDao getXXGroup() {
+		return new XXGroupDao(this);
+	}
+
+	public XXUserDao getXXUser() {
+		return new XXUserDao(this);
+	}
+
+	public XXGroupUserDao getXXGroupUser() {
+		return new XXGroupUserDao(this);
+	}
+
+	public XXGroupGroupDao getXXGroupGroup() {
+		return new XXGroupGroupDao(this);
+	}
+
+	public XXPermMapDao getXXPermMap() {
+		return new XXPermMapDao(this);
+	}
+
+	public XXAuditMapDao getXXAuditMap() {
+		return new XXAuditMapDao(this);
+	}
+
+	public XXPolicyExportAuditDao getXXPolicyExportAudit() {
+		return new XXPolicyExportAuditDao(this);
+	}
+
+	public XXTrxLogDao getXXTrxLog() {
+		return new XXTrxLogDao(this);
+	}
+
+	public XXAccessAuditDao getXXAccessAudit() {
+		return new XXAccessAuditDao(this);
+	}
+
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXAccessAuditDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXAccessAuditDao.java b/security-admin/src/main/java/com/xasecure/db/XXAccessAuditDao.java
new file mode 100644
index 0000000..29a2745
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXAccessAuditDao.java
@@ -0,0 +1,24 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import com.xasecure.entity.XXAccessAudit;
+import com.xasecure.common.*;
+import com.xasecure.common.db.*;
+import com.xasecure.entity.*;
+
+public class XXAccessAuditDao extends BaseDao<XXAccessAudit> {
+
+    public XXAccessAuditDao( XADaoManagerBase daoManager ) {
+		super(daoManager, "loggingPU");
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXAssetDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXAssetDao.java b/security-admin/src/main/java/com/xasecure/db/XXAssetDao.java
new file mode 100644
index 0000000..876e8a4
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXAssetDao.java
@@ -0,0 +1,47 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import javax.persistence.NoResultException;
+
+import org.apache.log4j.Logger;
+
+import com.xasecure.entity.XXAsset;
+
+import com.xasecure.common.XACommonEnums;
+import com.xasecure.common.db.*;
+
+public class XXAssetDao extends BaseDao<XXAsset> {
+	static final Logger logger = Logger.getLogger(XXAssetDao.class);
+
+    public XXAssetDao( XADaoManagerBase  daoManager ) {
+		super(daoManager);
+    }
+    
+    public XXAsset findByAssetName(String name){
+		if (daoManager.getStringUtil().isEmpty(name)) {
+			logger.debug("name is empty");
+			return null;
+		}
+		try {
+			return getEntityManager()
+					.createNamedQuery("XXAsset.findByAssetName", XXAsset.class)
+					.setParameter("name", name.trim())
+					.setParameter("status",XACommonEnums.STATUS_DELETED)
+					.getSingleResult();
+		} catch (NoResultException e) {
+			// ignore
+		}
+		return null;
+    }
+    
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXAuditMapDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXAuditMapDao.java b/security-admin/src/main/java/com/xasecure/db/XXAuditMapDao.java
new file mode 100644
index 0000000..23baaeb
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXAuditMapDao.java
@@ -0,0 +1,52 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import org.apache.log4j.Logger;
+
+import com.xasecure.entity.XXAuditMap;
+import com.xasecure.entity.XXPermMap;
+
+import com.xasecure.common.*;
+import com.xasecure.common.db.*;
+import com.xasecure.entity.*;
+
+public class XXAuditMapDao extends BaseDao<XXAuditMap> {
+	static final Logger logger = Logger.getLogger(XXAssetDao.class);
+
+    public XXAuditMapDao( XADaoManagerBase daoManager ) {
+		super(daoManager);
+    }
+
+	public List<XXAuditMap> findByResourceId(Long resourceId) {
+		if (resourceId != null) {
+			try {
+				return getEntityManager()
+						.createNamedQuery("XXAuditMap.findByResourceId", XXAuditMap.class)
+						.setParameter("resourceId", resourceId)
+						.getResultList();
+			} catch (NoResultException e) {
+				logger.debug(e.getMessage());
+			}
+		} else {
+			logger.debug("ResourceId not provided.");
+			return new ArrayList<XXAuditMap>();
+		}
+		return new ArrayList<XXAuditMap>();
+	}
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXAuthSessionDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXAuthSessionDao.java b/security-admin/src/main/java/com/xasecure/db/XXAuthSessionDao.java
new file mode 100644
index 0000000..4c48261
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXAuthSessionDao.java
@@ -0,0 +1,44 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure.
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import com.xasecure.common.db.BaseDao;
+import com.xasecure.entity.XXAuthSession;
+
+public class XXAuthSessionDao extends BaseDao<XXAuthSession> {
+
+    public XXAuthSessionDao( XADaoManagerBase daoManager ) {
+		super(daoManager);
+    }
+    
+    @SuppressWarnings("unchecked")
+	public List<Object[]> getUserLoggedIn(){
+    	return getEntityManager()
+    			.createNamedQuery("XXAuthSession.getUserLoggedIn")
+    			.getResultList();
+    }
+	
+	public XXAuthSession getAuthSessionBySessionId(String sessionId){
+		try{
+	    	return (XXAuthSession) getEntityManager()
+	    			.createNamedQuery("XXAuthSession.getAuthSessionBySessionId")
+	    			.setParameter("sessionId", sessionId)
+	    			.getSingleResult();
+		} catch(NoResultException ignoreNoResultFound) {
+			return null;
+		}
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXCredentialStoreDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXCredentialStoreDao.java b/security-admin/src/main/java/com/xasecure/db/XXCredentialStoreDao.java
new file mode 100644
index 0000000..e94c801
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXCredentialStoreDao.java
@@ -0,0 +1,25 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import com.xasecure.entity.XXCredentialStore;
+
+import com.xasecure.common.*;
+import com.xasecure.common.db.*;
+import com.xasecure.entity.*;
+
+public class XXCredentialStoreDao extends BaseDao<XXCredentialStore> {
+
+    public XXCredentialStoreDao( XADaoManagerBase daoManager ) {
+		super(daoManager);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXDBBaseDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXDBBaseDao.java b/security-admin/src/main/java/com/xasecure/db/XXDBBaseDao.java
new file mode 100644
index 0000000..d049b1e
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXDBBaseDao.java
@@ -0,0 +1,22 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure.
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import com.xasecure.common.db.BaseDao;
+import com.xasecure.entity.*;
+
+public class XXDBBaseDao extends BaseDao<XXDBBase> {
+
+    public XXDBBaseDao( XADaoManagerBase daoManager ) {
+		super(daoManager);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXGroupDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXGroupDao.java b/security-admin/src/main/java/com/xasecure/db/XXGroupDao.java
new file mode 100644
index 0000000..f8720ac
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXGroupDao.java
@@ -0,0 +1,65 @@
+package com.xasecure.db;
+
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+
+import com.xasecure.entity.XXGroup;
+
+import com.xasecure.common.*;
+import com.xasecure.common.db.*;
+import com.xasecure.entity.*;
+
+public class XXGroupDao extends BaseDao<XXGroup> {
+
+	public XXGroupDao(XADaoManagerBase daoManager) {
+		super(daoManager);
+	}
+
+	@SuppressWarnings("unchecked")
+	public List<XXGroup> findByUserId(Long userId) {
+		if (userId == null) {
+			return new ArrayList<XXGroup>();
+		}
+
+		List<XXGroup> groupList = (List<XXGroup>) getEntityManager()
+				.createNamedQuery("XXGroup.findByUserId")
+				.setParameter("userId", userId).getResultList();
+
+		if (groupList == null) {
+			groupList = new ArrayList<XXGroup>();
+		}
+
+		return groupList;
+	}
+
+	@SuppressWarnings("unchecked")
+	public XXGroup findByGroupName(String groupName) {
+		if (groupName == null) {
+			return null;
+		}
+		try {
+
+			return (XXGroup) getEntityManager()
+					.createNamedQuery("XXGroup.findByGroupName")
+					.setParameter("name", groupName.toLowerCase())
+					.getSingleResult();
+		} catch (Exception e) {
+
+		}
+		return null;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXGroupGroupDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXGroupGroupDao.java b/security-admin/src/main/java/com/xasecure/db/XXGroupGroupDao.java
new file mode 100644
index 0000000..ff013e6
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXGroupGroupDao.java
@@ -0,0 +1,25 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import com.xasecure.entity.XXGroupGroup;
+
+import com.xasecure.common.*;
+import com.xasecure.common.db.*;
+import com.xasecure.entity.*;
+
+public class XXGroupGroupDao extends BaseDao<XXGroupGroup> {
+
+    public XXGroupGroupDao( XADaoManagerBase daoManager ) {
+		super(daoManager);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXGroupUserDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXGroupUserDao.java b/security-admin/src/main/java/com/xasecure/db/XXGroupUserDao.java
new file mode 100644
index 0000000..a7a7a97
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXGroupUserDao.java
@@ -0,0 +1,59 @@
+package com.xasecure.db;
+
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import org.apache.log4j.Logger;
+
+import com.xasecure.entity.XXGroupUser;
+import com.xasecure.entity.XXPermMap;
+
+import com.xasecure.common.*;
+import com.xasecure.common.db.*;
+import com.xasecure.entity.*;
+
+public class XXGroupUserDao extends BaseDao<XXGroupUser> {
+	static final Logger logger = Logger.getLogger(XXGroupUserDao.class);
+
+	public XXGroupUserDao(XADaoManagerBase daoManager) {
+		super(daoManager);
+	}
+
+	public void deleteByGroupIdAndUserId(Long groupId, Long userId) {
+		getEntityManager()
+				.createNamedQuery("XXGroupUser.deleteByGroupIdAndUserId")
+				.setParameter("userId", userId)
+				.setParameter("parentGroupId", groupId).executeUpdate();
+
+	}
+
+	public List<XXGroupUser> findByUserId(Long userId) {
+		if (userId != null) {
+			try {
+				return getEntityManager()
+						.createNamedQuery("XXGroupUser.findByUserId", XXGroupUser.class)
+						.setParameter("userId", userId)
+						.getResultList();
+			} catch (NoResultException e) {
+				logger.debug(e.getMessage());
+			}
+		} else {
+			logger.debug("ResourceId not provided.");
+			return new ArrayList<XXGroupUser>();
+		}
+		return null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXPermMapDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXPermMapDao.java b/security-admin/src/main/java/com/xasecure/db/XXPermMapDao.java
new file mode 100644
index 0000000..0d7fb29
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXPermMapDao.java
@@ -0,0 +1,51 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import org.apache.log4j.Logger;
+
+import com.xasecure.entity.XXPermMap;
+import com.xasecure.entity.XXResource;
+
+import com.xasecure.common.*;
+import com.xasecure.common.db.*;
+import com.xasecure.entity.*;
+
+public class XXPermMapDao extends BaseDao<XXPermMap> {
+	static final Logger logger = Logger.getLogger(XXResourceDao.class);
+
+    public XXPermMapDao( XADaoManagerBase daoManager ) {
+		super(daoManager);
+    }
+
+	public List<XXPermMap> findByResourceId(Long resourceId) {
+		if (resourceId != null) {
+			try {
+				return getEntityManager()
+						.createNamedQuery("XXPermMap.findByResourceId", XXPermMap.class)
+						.setParameter("resourceId", resourceId)
+						.getResultList();
+			} catch (NoResultException e) {
+				logger.debug(e.getMessage());
+			}
+		} else {
+			logger.debug("ResourceId not provided.");
+			return new ArrayList<XXPermMap>();
+		}
+		return null;
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXPolicyExportAuditDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXPolicyExportAuditDao.java b/security-admin/src/main/java/com/xasecure/db/XXPolicyExportAuditDao.java
new file mode 100644
index 0000000..8c24713
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXPolicyExportAuditDao.java
@@ -0,0 +1,24 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import com.xasecure.entity.XXPolicyExportAudit;
+import com.xasecure.common.*;
+import com.xasecure.common.db.*;
+import com.xasecure.entity.*;
+
+public class XXPolicyExportAuditDao extends BaseDao<XXPolicyExportAudit> {
+
+    public XXPolicyExportAuditDao( XADaoManagerBase daoManager ) {
+		super(daoManager);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXPortalUserDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXPortalUserDao.java b/security-admin/src/main/java/com/xasecure/db/XXPortalUserDao.java
new file mode 100644
index 0000000..13ce9f5
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXPortalUserDao.java
@@ -0,0 +1,70 @@
+package com.xasecure.db;
+
+/*
+ * Copyright (c) 2014 XASecure.
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import java.util.List;
+
+import com.xasecure.entity.XXPortalUser;
+import com.xasecure.common.db.*;
+
+public class XXPortalUserDao extends BaseDao<XXPortalUser> {
+
+	public XXPortalUserDao(XADaoManagerBase daoManager) {
+		super(daoManager);
+	}
+
+	public XXPortalUser findByLoginId(String loginId) {
+		if (daoManager.getStringUtil().isEmpty(loginId)) {
+			return null;
+		}
+
+		@SuppressWarnings("rawtypes")
+		List resultList = getEntityManager()
+				.createNamedQuery("XXPortalUser.findByLoginId")
+				.setParameter("loginId", loginId.toLowerCase()).getResultList();
+		if (resultList.size() != 0) {
+			return (XXPortalUser) resultList.get(0);
+		}
+		return null;
+	}
+
+	public XXPortalUser findByEmailAddress(String emailAddress) {
+		if (daoManager.getStringUtil().isEmpty(emailAddress)) {
+			return null;
+		}
+
+		@SuppressWarnings("rawtypes")
+		List resultList = getEntityManager()
+				.createNamedQuery("XXPortalUser.findByEmailAddress")
+				.setParameter("emailAddress", emailAddress.toLowerCase())
+				.getResultList();
+		if (resultList.size() != 0) {
+			return (XXPortalUser) resultList.get(0);
+		}
+		return null;
+	}
+
+	@SuppressWarnings("unchecked")
+	public List<XXPortalUser> findByRole(String userRole) {
+		return getEntityManager().createNamedQuery("XXPortalUser.findByRole")
+				.setParameter("userRole", userRole.toUpperCase())
+				.getResultList();
+	}
+    
+    @SuppressWarnings("unchecked")
+	public List<Object[]> getUserAddedReport(){
+    	return getEntityManager()
+    			.createNamedQuery("XXPortalUser.getUserAddedReport")
+    			.getResultList();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXPortalUserRoleDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXPortalUserRoleDao.java b/security-admin/src/main/java/com/xasecure/db/XXPortalUserRoleDao.java
new file mode 100644
index 0000000..763e0c0
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXPortalUserRoleDao.java
@@ -0,0 +1,50 @@
+package com.xasecure.db;
+
+/*
+ * Copyright (c) 2014 XASecure.
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import com.xasecure.entity.XXPortalUserRole;
+import com.xasecure.common.db.*;
+
+public class XXPortalUserRoleDao extends BaseDao<XXPortalUserRole> {
+
+	public XXPortalUserRoleDao(XADaoManagerBase daoManager) {
+		super(daoManager);
+	}
+
+	@SuppressWarnings("unchecked")
+	public List<XXPortalUserRole> findByUserId(Long userId) {
+		if (userId == null) {
+			return new ArrayList<XXPortalUserRole>();
+		}
+		return getEntityManager().createNamedQuery("XXPortalUserRole.findByUserId")
+				.setParameter("userId", userId).getResultList();
+	}
+	
+	public XXPortalUserRole findByRoleUserId(Long userId, String role) {
+		if(userId == null || role == null || role.isEmpty()){
+			return null;
+		}
+		try{
+			return (XXPortalUserRole)getEntityManager().createNamedQuery("XXPortalUserRole.findByRoleUserId")
+					.setParameter("userId", userId)
+					.setParameter("userRole", role).getSingleResult();
+		} catch(NoResultException e){
+			//doNothing;
+		}
+		return null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXResourceDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXResourceDao.java b/security-admin/src/main/java/com/xasecure/db/XXResourceDao.java
new file mode 100644
index 0000000..64ef77b
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXResourceDao.java
@@ -0,0 +1,267 @@
+package com.xasecure.db;
+
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import java.util.Date;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import org.apache.log4j.Logger;
+
+
+import com.xasecure.entity.XXResource;
+
+import com.xasecure.common.db.*;
+
+public class XXResourceDao extends BaseDao<XXResource> {
+	static final Logger logger = Logger.getLogger(XXResourceDao.class);
+
+	public XXResourceDao(XADaoManagerBase daoManager) {
+		super(daoManager);
+	}
+
+	public XXResource findByResourceName(String name) {
+		if (daoManager.getStringUtil().isEmpty(name)) {
+			logger.debug("name is empty");
+			return null;
+		}
+		try {
+			return getEntityManager()
+					.createNamedQuery("XXResource.findByResourceName",
+							XXResource.class).setParameter("name", name.trim())
+					.getSingleResult();
+		} catch (NoResultException e) {
+			// ignore
+		}
+		return null;
+	}	
+
+	public List<XXResource> findUpdatedResourcesByAssetId(
+			Long assetId, Date lastUpdated) {
+		if (assetId != null) {
+			try {
+				return getEntityManager()
+						.createNamedQuery("XXResource.findUpdatedResourcesByAssetId",
+								XXResource.class)
+						.setParameter("assetId", assetId)
+						.setParameter("lastUpdated", lastUpdated)
+						.getResultList();
+			} catch (NoResultException e) {
+				logger.debug(e.getMessage());
+			}
+		} else {
+			logger.debug("AssetId not provided.");
+			return new ArrayList<XXResource>();
+		}
+		return null;
+	}
+	
+	public List<XXResource> findByAssetId(Long assetId) {
+		List<XXResource> xResourceList = null;
+		if (assetId != null) {
+			try {
+				xResourceList = getEntityManager()
+						.createNamedQuery("XXResource.findByAssetId", XXResource.class)
+						.setParameter("assetId", assetId)
+						.getResultList();
+			} catch (NoResultException e) {
+				// ignore
+				logger.debug(e.getMessage());
+			}
+			if(xResourceList == null) {
+				xResourceList = new ArrayList<XXResource>();
+			}
+		} else {
+			logger.debug("AssetId not provided.");
+			xResourceList = new ArrayList<XXResource>();
+		}
+		return xResourceList;
+	}
+	
+	public List<XXResource> findByAssetType(Integer assetType) {
+		List<XXResource> xResourceList = null;
+		if (assetType != null) {
+			try {
+				xResourceList = getEntityManager()
+						.createNamedQuery("XXResource.findByAssetType", XXResource.class)
+						.setParameter("assetType", assetType)
+						.getResultList();
+			} catch (NoResultException e) {
+				// ignore
+				logger.debug(e.getMessage());
+			}
+			if(xResourceList == null) {
+				xResourceList = new ArrayList<XXResource>();
+			}
+		} else {
+			logger.debug("AssetType not provided.");
+			xResourceList = new ArrayList<XXResource>();
+		}
+		return xResourceList;
+	}
+	
+	public Timestamp getMaxUpdateTimeForAssetName(String assetName) {
+		if (assetName == null) {
+			return null;
+		}
+		try {		
+			 Date date=(Date)getEntityManager()
+			.createNamedQuery("XXResource.getMaxUpdateTimeForAssetName")
+			.setParameter("assetName", assetName)
+			.getSingleResult();
+			 if(date!=null){
+				 Timestamp timestamp=new Timestamp(date.getTime());	
+				 return timestamp;
+			 }else{
+				 return null;
+			 }		
+		} catch (NoResultException e) {
+			// ignore
+		}
+		return null;
+	}
+
+	public List<XXResource> findUpdatedResourcesByAssetName(
+			String assetName, Date lastUpdated) {
+		if (assetName != null) {
+			try {
+				return getEntityManager()
+						.createNamedQuery(
+								"XXResource.findUpdatedResourcesByAssetName",
+								XXResource.class)
+						.setParameter("assetName", assetName)
+						.setParameter("lastUpdated", lastUpdated)
+						.getResultList();
+			} catch (NoResultException e) {
+				logger.debug(e.getMessage());
+			}
+		} else {
+			logger.debug("Asset name not provided.");
+			return new ArrayList<XXResource>();
+		}
+		return null;
+	}
+
+	public List<XXResource> findByResourceNameAndAssetIdAndRecursiveFlag(
+			String name,Long assetId,int isRecursive ) {
+		if (daoManager.getStringUtil().isEmpty(name)) {
+			logger.debug("name is empty");
+			return null;
+		}
+		if (assetId==null) {
+			logger.debug("assetId is null");
+			return null;
+		}
+		try {
+			String resourceName = name.trim();
+			resourceName = "%"+resourceName+"%";
+			return getEntityManager()
+					.createNamedQuery(
+							"XXResource.findByResourceNameAndAssetIdAndRecursiveFlag",
+							XXResource.class).setParameter("name", resourceName)							
+					.setParameter("assetId", assetId)
+					.setParameter("isRecursive", isRecursive)
+					.getResultList();
+		} catch (NoResultException e) {
+			// ignore
+		}
+		return null;
+	}
+
+	public List<XXResource> findByResourceNameAndAssetIdAndResourceType(String name,Long assetId,int resourceType) {
+		if (daoManager.getStringUtil().isEmpty(name)) {
+			logger.debug("name is empty");
+			return null;
+		}
+		if (assetId==null) {
+			logger.debug("assetId is null");
+			return null;
+		}
+		try {
+			String resourceName = name.trim();
+			resourceName = "%"+resourceName+"%";
+			return getEntityManager()
+					.createNamedQuery(
+							"XXResource.findByResourceNameAndAssetIdAndResourceType",
+							XXResource.class).setParameter("name", resourceName)							
+					.setParameter("assetId", assetId)
+					.setParameter("resourceType", resourceType)
+					.getResultList();
+		} catch (NoResultException e) {
+			// ignore
+		}
+		return null;
+	}
+	
+	@SuppressWarnings("unchecked")
+	public List<XXResource> findByAssetIdAndResourceTypes(Long assetId,
+			List<Integer> resourceType) {
+		if (assetId == null) {
+			logger.debug("assetId is null");
+			return null;
+		}
+		try {
+			StringBuffer query = new StringBuffer(
+					"SELECT obj FROM XXResource obj WHERE obj.assetId="
+							+ assetId);
+			String whereClause = makeWhereCaluseForResourceType(resourceType);
+			if (!whereClause.trim().isEmpty()) {
+				query.append(" and ( " + whereClause + " )");
+			}
+			return getEntityManager().createQuery(query.toString())
+					.getResultList();
+		} catch (NoResultException e) {
+			// ignore
+		}
+		return null;
+	}
+
+	private String makeWhereCaluseForResourceType(List<Integer> resourceTypes) {
+		StringBuffer whereClause = new StringBuffer();
+		if (resourceTypes != null && resourceTypes.size() != 0) {
+
+			for (int i = 0; i < resourceTypes.size() - 1; i++) {
+				whereClause.append("obj.resourceType=" + resourceTypes.get(i)
+						+ " OR ");
+			}
+			whereClause.append("obj.resourceType="
+					+ resourceTypes.get(resourceTypes.size() - 1));
+		}
+		return whereClause.toString();
+	}
+	
+	public List<XXResource> findByAssetIdAndResourceStatus(Long assetId, int resourceStatus) {
+		List<XXResource> xResourceList = null;
+		if (assetId != null) {
+			try {
+				xResourceList = getEntityManager()
+						.createNamedQuery("XXResource.findByAssetIdAndResourceStatus", XXResource.class)
+						.setParameter("assetId", assetId)
+						.setParameter("resourceStatus", resourceStatus)
+						.getResultList();
+			} catch (NoResultException e) {
+				// ignore
+				logger.debug(e.getMessage());
+			}
+			if(xResourceList == null) {
+				xResourceList = new ArrayList<XXResource>();
+			}
+		} else {
+			logger.debug("AssetId not provided.");
+			xResourceList = new ArrayList<XXResource>();
+		}
+		return xResourceList;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXTrxLogDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXTrxLogDao.java b/security-admin/src/main/java/com/xasecure/db/XXTrxLogDao.java
new file mode 100644
index 0000000..6321ba1
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXTrxLogDao.java
@@ -0,0 +1,49 @@
+package com.xasecure.db;
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.NoResultException;
+
+import org.apache.log4j.Logger;
+
+import com.xasecure.entity.XXTrxLog;
+
+import com.xasecure.common.db.*;
+
+public class XXTrxLogDao extends BaseDao<XXTrxLog> {
+	private static Logger logger = Logger.getLogger(XXTrxLogDao.class);
+	
+    public XXTrxLogDao( XADaoManagerBase daoManager ) {
+		super(daoManager);
+    }
+    
+    public List<XXTrxLog> findByTransactionId(String transactionId){
+    	if(transactionId == null){
+    		return null;
+    	}
+    	
+		List<XXTrxLog> xTrxLogList = new ArrayList<XXTrxLog>();
+		try {
+			xTrxLogList = getEntityManager()
+					.createNamedQuery("XXTrxLog.findByTrxId", XXTrxLog.class)
+					.setParameter("transactionId", transactionId)
+					.getResultList();
+		} catch (NoResultException e) {
+			logger.debug(e.getMessage());
+		}
+		
+		return xTrxLogList;
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/java/com/xasecure/db/XXUserDao.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/db/XXUserDao.java b/security-admin/src/main/java/com/xasecure/db/XXUserDao.java
new file mode 100644
index 0000000..937d386
--- /dev/null
+++ b/security-admin/src/main/java/com/xasecure/db/XXUserDao.java
@@ -0,0 +1,44 @@
+package com.xasecure.db;
+
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+import javax.persistence.NoResultException;
+
+import org.apache.log4j.Logger;
+
+import com.xasecure.entity.XXUser;
+
+import com.xasecure.common.db.*;
+
+public class XXUserDao extends BaseDao<XXUser> {
+	static final Logger logger = Logger.getLogger(XXResourceDao.class);
+
+	public XXUserDao(XADaoManagerBase daoManager) {
+		super(daoManager);
+	}
+
+	public XXUser findByUserName(String name) {
+		if (daoManager.getStringUtil().isEmpty(name)) {
+			logger.debug("name is empty");
+			return null;
+		}
+		try {
+			return getEntityManager()
+					.createNamedQuery("XXUser.findByUserName", XXUser.class)
+					.setParameter("name", name.trim().toLowerCase())
+					.getSingleResult();
+		} catch (NoResultException e) {
+			// ignore
+		}
+		return null;
+	}
+}


Mime
View raw message