int approvalid = aar.generateApprovalId();
// Check if user already exists
if (userAdminSession.existsUser(admin, userdata.getUsername())) {
// a user already exists, so this is an edit entity request we are preparing
log.debug("User already exist, we will look for an edit end entity request");
approvalid = ear.generateApprovalId();
}
Query query = new Query(Query.TYPE_APPROVALQUERY);
query.add(ApprovalMatch.MATCH_WITH_APPROVALID, BasicMatch.MATCH_TYPE_EQUALS, Integer.toString(approvalid), Query.CONNECTOR_AND);
query.add(ApprovalMatch.MATCH_WITH_STATUS, BasicMatch.MATCH_TYPE_EQUALS, "" + ApprovalDataVO.STATUS_WAITINGFORAPPROVAL, Query.CONNECTOR_AND);
Date now = new Date();