Example usage for org.hibernate.criterion DetachedCriteria createCriteria

List of usage examples for org.hibernate.criterion DetachedCriteria createCriteria

Introduction

In this page you can find the example usage for org.hibernate.criterion DetachedCriteria createCriteria.

Prototype

public DetachedCriteria createCriteria(String associationPath) 

Source Link

Document

Creates a nested DetachedCriteria representing the association path.

Usage

From source file:ro.cs.om.model.dao.impl.DaoOrganisationImpl.java

License:Open Source License

/**
 * /* w w  w. j a v  a2 s .  c  o  m*/
 * Get all orgainsationIds that have a module identified by id
 * @author mitziuro
 * @param moduleId
 * @return
 */
public List<Integer> getOrganisationIdsByModule(Integer moduleId) {
    logger.debug("getOrgainsationIdsByModule - START for organisation for moduleId:"
            .concat(String.valueOf(moduleId)));

    List<Integer> res = new ArrayList<Integer>();

    DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.organisationWithModulesEntity);
    dc.createCriteria("modules").add(Restrictions.eq("moduleId", moduleId));
    List<Organisation> organisations = getHibernateTemplate().findByCriteria(dc);

    for (Organisation organisation : organisations) {
        res.add(organisation.getOrganisationId());
    }

    logger.debug("getOrgainsationIdsByModule - END");
    return res;
}

From source file:ro.cs.om.model.dao.impl.DaoPermissionImpl.java

License:Open Source License

/**
 * Get the list of permissions for a module without the default permission for the module
 * /*from   w ww.  ja  va  2s  .  c  om*/
 * @author Adelina
 * 
 * @param moduleId
 * 
 * @return List<Permission>, a list of permissions
 */

@SuppressWarnings("unchecked")
public List<Permission> getPermissionByModule(Integer moduleId) {
    logger.debug("getPermissionByModule DAO IMPL - START - ");

    Map<Integer, String> map = new HashMap<Integer, String>();

    PermissionConstant permCt = PermissionConstant.getInstance();

    map.put(new Integer(1), permCt.getOM_Basic());
    map.put(new Integer(2), permCt.getDM_Basic());

    String permissionName = (String) map.get(new Integer(moduleId));

    DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.permissionForListingEntity);
    dc.createCriteria("module").add(Restrictions.eq("moduleId", moduleId));
    if (permissionName != null) {
        dc.add(Restrictions.ne("name", permissionName));
    }
    List permissions = getHibernateTemplate().findByCriteria(dc);

    logger.debug("getPermissionByModule DAO IMPL - END - ".concat(String.valueOf(permissions.size())));

    return permissions;

}

From source file:ro.cs.om.model.dao.impl.DaoPersonImpl.java

License:Open Source License

/**
 * Searches for persons after criterion from searchPersonBean.
 * // www .jav  a  2s.c om
 * @author alu
 * 
 * @return A list of log beans 
 * @throws ParseException 
 */
public List<Person> getFromSearch(SearchPersonBean searchPersonBean, boolean isDeleteAction, List<Integer> orgs)
        throws ParseException {
    logger.debug("getFromSearch - START");
    /*Once a Projection is being set to a Detached Criteria object, it cannot be removed anymore, so two identical DetachedCriteria objects 
    must be created: 
    -dcCount ( on which the projection is being set )used to retrieve the number of distinct results which is set when 
    the request didn't come from the pagination area and needed further more to set the current page after a delete action; 
    -dc used to retrieve the result set after the current page has been set in case of a delete action
    */

    // set search criterion
    DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.personForListingEntity);
    DetachedCriteria dcCount = DetachedCriteria.forEntityName(IModelConstant.personForListingEntity);

    // Status
    dc.add(Restrictions.ne("status", IConstant.NOM_PERSON_STATUS_DELETED));
    dcCount.add(Restrictions.ne("status", IConstant.NOM_PERSON_STATUS_DELETED));

    if (Tools.getInstance().stringNotEmpty(searchPersonBean.getFirstName())) {
        dc.add(Restrictions.ilike("firstName", "%".concat(searchPersonBean.getFirstName()).concat("%")));
        dcCount.add(Restrictions.ilike("firstName", "%".concat(searchPersonBean.getFirstName()).concat("%")));
        logger.debug("firstName: " + searchPersonBean.getFirstName());
    }

    if (Tools.getInstance().stringNotEmpty(searchPersonBean.getLastName())) {
        dc.add(Restrictions.ilike("lastName", "%".concat(searchPersonBean.getLastName()).concat("%")));
        dcCount.add(Restrictions.ilike("lastName", "%".concat(searchPersonBean.getLastName()).concat("%")));
        logger.debug("lastName: " + searchPersonBean.getLastName());
    }

    if (Tools.getInstance().stringNotEmpty(searchPersonBean.getUsername())) {
        dc.add(Restrictions.ilike("username", "%".concat(searchPersonBean.getUsername()).concat("%")));
        dcCount.add(Restrictions.ilike("username", "%".concat(searchPersonBean.getUsername()).concat("%")));
        logger.debug("username: " + searchPersonBean.getUsername());
    }

    if (searchPersonBean.getDepartmentId() > 0) {
        dc.createCriteria("depts")
                .add(Restrictions.eq("departmentId", new Integer(searchPersonBean.getDepartmentId())));
        dcCount.createCriteria("depts")
                .add(Restrictions.eq("departmentId", new Integer(searchPersonBean.getDepartmentId())));
        logger.debug("departmentId: " + searchPersonBean.getDepartmentId());

    } else if (searchPersonBean.getOrganisationId() > 0) {
        //if the search is in all branches we use it
        if (orgs != null) {
            dc.createCriteria("depts").add(Restrictions.in("organisationId", orgs));
            dcCount.createCriteria("depts").add(Restrictions.in("organisationId", orgs));
            logger.debug("number of branches: " + orgs.size());
        } else {
            dc.createCriteria("depts")
                    .add(Restrictions.eq("organisationId", new Integer(searchPersonBean.getOrganisationId())));
            dcCount.createCriteria("depts")
                    .add(Restrictions.eq("organisationId", new Integer(searchPersonBean.getOrganisationId())));
            logger.debug("organisationId: " + searchPersonBean.getOrganisationId());
        }

    }

    if (searchPersonBean.getSex() != null) {
        if (searchPersonBean.getSex().equals(IConstant.NOM_PERSON_SEX_F)
                || searchPersonBean.getSex().equals(IConstant.NOM_PERSON_SEX_M)) {
            dc.add(Restrictions.eq("sex", searchPersonBean.getSex()));
            dcCount.add(Restrictions.eq("sex", searchPersonBean.getSex()));
            logger.debug("sex: " + searchPersonBean.getSex());
        }
    }

    dc.setProjection(Projections.id());
    dcCount.setProjection(Projections.id());
    // until here, I've created the subquery
    // now, it's time to retrive all the persons that are in the list of the subquery
    DetachedCriteria dc1 = DetachedCriteria.forEntityName(IModelConstant.personForListingEntity);
    dc1.add(Subqueries.propertyIn("personId", dc));

    // check if I have to order the results
    if (searchPersonBean.getSortParam() != null && StringUtils.hasLength(searchPersonBean.getSortParam())) {
        // if I have to, check if I have to order them ascending or descending
        if (searchPersonBean.getSortDirection() == IConstant.ASCENDING) {
            // ascending
            dc1.addOrder(Order.asc(searchPersonBean.getSortParam()));
        } else {
            // descending
            dc1.addOrder(Order.desc(searchPersonBean.getSortParam()));
        }
    }

    // if the request didn't come from the pagination area, 
    // it means that I have to set the number of result and pages
    if (isDeleteAction || searchPersonBean.getNbrOfResults() == -1) {
        boolean isSearch = false;
        if (searchPersonBean.getNbrOfResults() == -1) {
            isSearch = true;
        }
        // set the countDistinct restriction
        dcCount.setProjection(Projections.countDistinct("personId"));

        int nbrOfResults = ((Integer) getHibernateTemplate().findByCriteria(dcCount, 0, 0).get(0)).intValue();
        searchPersonBean.setNbrOfResults(nbrOfResults);
        logger.debug("NbrOfResults " + searchPersonBean.getNbrOfResults());
        logger.debug("----> searchPersonBean.getResults " + searchPersonBean.getResultsPerPage());
        // get the number of pages
        if (nbrOfResults % searchPersonBean.getResultsPerPage() == 0) {
            searchPersonBean.setNbrOfPages(nbrOfResults / searchPersonBean.getResultsPerPage());
        } else {
            searchPersonBean.setNbrOfPages(nbrOfResults / searchPersonBean.getResultsPerPage() + 1);
        }
        // after a person is deleted, the same page has to be displayed;
        //only when all the persons from last page are deleted, the previous page will be shown 
        if (isDeleteAction && (searchPersonBean.getCurrentPage() > searchPersonBean.getNbrOfPages())) {
            searchPersonBean.setCurrentPage(searchPersonBean.getNbrOfPages());
        } else if (isSearch) {
            searchPersonBean.setCurrentPage(1);
        }
    }

    List<Person> res = getHibernateTemplate().findByCriteria(dc1,
            (searchPersonBean.getCurrentPage() - 1) * searchPersonBean.getResultsPerPage(),
            searchPersonBean.getResultsPerPage());

    logger.debug("Res " + res.size());
    logger.debug("getFromSearch - END - results size : ".concat(String.valueOf(res.size())));
    return res;
}

From source file:ro.cs.om.model.dao.impl.DaoPersonImpl.java

License:Open Source License

/**
 * Return a list with all the Persons from the given Organization and Module and all the persons from organization
 * //from   ww w  .ja  v  a 2  s. c o m
 * @author mitziuro
 * 
 * @param organizationId
 * @param moduleId
 * @return
 */
public Entry<List<Integer>, List<Person>> getPersonsIdsByOrganizationIdAndModuleId(int organizationId,
        int moduleId) {
    logger.debug("getPersonsIdsByOrganizationIdAndModuleId START: organizationId = "
            .concat(String.valueOf(organizationId).concat(" moduleId = ").concat(String.valueOf(moduleId))));

    List<Integer> persons = null;
    List<Person> allPersons = null;

    DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.personForListingEntity);
    //we search for organisation id

    dc.createCriteria("depts").setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
            .add(Restrictions.eq("organisationId", new Integer(organizationId)));

    dc.add(Restrictions.ne("status", IConstant.NOM_PERSON_STATUS_DELETED));

    //we search
    allPersons = getHibernateTemplate().findByCriteria(dc);

    DetachedCriteria dcp = DetachedCriteria.forEntityName(IModelConstant.personForListingEntity);
    //we search for organisation id
    dcp.createCriteria("depts").add(Restrictions.eq("organisationId", new Integer(organizationId)));
    dcp.add(Restrictions.ne("status", IConstant.NOM_PERSON_STATUS_DELETED));

    //distinct results
    dcp.setProjection(Projections
            .distinct(Projections.projectionList().add(Projections.property("personId"), "personId")));
    //we search for module id
    dcp.createCriteria("roles").add(Restrictions.eq("moduleId", new Integer(moduleId)));

    //we search
    persons = getHibernateTemplate().findByCriteria(dcp);

    logger.debug("getPersonsIdsByOrganizationIdAndModuleId END: size = "
            .concat(persons != null ? String.valueOf(allPersons.size()) : "null"));

    return new SimpleEntry(persons, allPersons);
}

From source file:ro.cs.om.model.dao.impl.DaoPersonImpl.java

License:Open Source License

/**
 * Return a list with all the deactivated Persons from the given Organization and Module and all the persons from organization
 * //  ww w  .  j  a  v a  2 s.c o m
 * @author liviu
 * 
 * @param organizationId
 * @param moduleId
 * @return
 */
public Entry<List<Integer>, List<Person>> getDeletedPersonsIdsByOrganizationIdAndModuleId(int organizationId,
        int moduleId) {
    logger.debug("getDeletedPersonsIdsByOrganizationIdAndModuleId START: organizationId = "
            .concat(String.valueOf(organizationId).concat(" moduleId = ").concat(String.valueOf(moduleId))));

    List<Integer> persons = null;
    List<Person> allPersons = null;

    DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.personForListingEntity);
    //we search for organisation id
    dc.createCriteria("depts").add(Restrictions.eq("organisationId", new Integer(organizationId)));
    dc.add(Restrictions.eq("status", IConstant.NOM_PERSON_STATUS_DELETED));

    //we search
    allPersons = getHibernateTemplate().findByCriteria(dc);

    //we search for module id
    dc.createCriteria("roles").add(Restrictions.eq("moduleId", new Integer(moduleId)));

    //distinct results
    dc.setProjection(Projections
            .distinct(Projections.projectionList().add(Projections.property("personId"), "personId")));

    //we search
    persons = getHibernateTemplate().findByCriteria(dc);

    logger.debug("getDeletedPersonsIdsByOrganizationIdAndModuleId END: size = "
            .concat(persons != null ? String.valueOf(persons.size()) : "null"));

    return new SimpleEntry(persons, allPersons);
}

From source file:ro.cs.om.model.dao.impl.DaoPersonImpl.java

License:Open Source License

/**
 * Return a list of person from a given organization,
 * that has a certain role/*from  w ww .j  av  a2s  .  co m*/
 * 
 * @author Adelina
 * 
 * @param organisationId
 * @param roleName
 * @return
 */
public List<Person> getPersonsWithRoleByOrganisation(Integer organisationId, String roleName) {
    logger.debug("getPersonsWithRoleByOrganisation - START: organizationId = "
            .concat(String.valueOf(organisationId)));

    List<Person> persons = null;
    DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.personForListingEntity);
    dc.add(Restrictions.ne("status", IConstant.NOM_PERSON_STATUS_DELETED));

    // we search for the organizationId
    dc.createCriteria("depts").add(Restrictions.eq("organisationId", new Integer(organisationId)));

    // and roleName
    dc.createCriteria("roles").add(Restrictions.eq("name", roleName));

    // the search
    persons = (List<Person>) getHibernateTemplate().findByCriteria(dc);
    logger.debug("getPersonsWithRoleByOrganisation - END");
    return persons;
}

From source file:ro.cs.om.model.dao.impl.DaoPersonImpl.java

License:Open Source License

/**
 * Returns a list of the persons from the user group with the specified id
 * //  ww w  .  ja v  a2s  . co  m
 * @author Coni
 * 
 * @param userGroupId
 * @return
 */
public List<Person> getByUserGroupId(Integer userGroupId) {
    logger.debug("getByUserGroupId - START - user group id: ".concat(userGroupId.toString()));

    DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.personWithUserGroupsEntity);
    dc.add(Restrictions.ne("status", IConstant.NOM_PERSON_STATUS_DELETED));
    dc.createCriteria("userGroups").add(Restrictions.eq("userGroupId", userGroupId));

    List<Person> persons = (List<Person>) getHibernateTemplate().findByCriteria(dc);
    logger.debug("getByUserGroupId - START");
    return persons;
}

From source file:ro.cs.om.model.dao.impl.DaoPersonImpl.java

License:Open Source License

/**
 * Retrieves from search a list of person with basic info 
 * /*from  w  ww. ja v  a2  s. c o m*/
 * @author Coni
 * @param searchPersonBean
 * @return
 */
public List<Person> getFromSearchSimple(SearchPersonBean searchPersonBean, boolean withDeleted) {
    logger.debug("getFromSearchSimple - START");

    DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.personFromOrganisationEntity);

    // Status; in all the other modules the disabled persons are treated the same as the deleted persons
    if (!withDeleted) {
        dc.add(Restrictions.eq("status", IConstant.NOM_PERSON_STATUS_ACTIVATED));
    }

    if (Tools.getInstance().stringNotEmpty(searchPersonBean.getFirstName())) {
        dc.add(Restrictions.ilike("firstName", "%".concat(searchPersonBean.getFirstName()).concat("%")));
        logger.debug("firstName: " + searchPersonBean.getFirstName());
    }

    if (Tools.getInstance().stringNotEmpty(searchPersonBean.getLastName())) {
        dc.add(Restrictions.ilike("lastName", "%".concat(searchPersonBean.getLastName()).concat("%")));
        logger.debug("lastName: " + searchPersonBean.getLastName());
    }

    if (Tools.getInstance().stringNotEmpty(searchPersonBean.getUsername())) {
        dc.add(Restrictions.ilike("username", "%".concat(searchPersonBean.getUsername()).concat("%")));
        logger.debug("username: " + searchPersonBean.getUsername());
    }

    if (searchPersonBean.getOrganisationId() > 0) {
        dc.createCriteria("depts")
                .add(Restrictions.eq("organisationId", new Integer(searchPersonBean.getOrganisationId())));
        logger.debug("organizationId: " + searchPersonBean.getOrganisationId());
    }

    List<Person> res = getHibernateTemplate().findByCriteria(dc);

    logger.debug("getFromSearchSimple - END");
    return res;
}

From source file:ro.cs.om.model.dao.impl.DaoPersonImpl.java

License:Open Source License

/**
 * Retrieves from search a list of person with basic info and pagination
 * /*from   w  w  w.ja v a  2  s.c  om*/
 * @author Coni
 * @param searchPersonBean
 * @return
 */
public List<Person> getFromSearchSimpleWithPagination(SearchPersonBean searchPersonBean, boolean withDeleted) {
    logger.debug("getFromSearch - START");

    // set search criterion
    DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.personFromOrganisationEntity);
    DetachedCriteria dcCount = DetachedCriteria.forEntityName(IModelConstant.personFromOrganisationEntity);

    // Status; in all the other modules the disabled persons are treated the same as the deleted persons
    if (!withDeleted) {
        dc.add(Restrictions.eq("status", IConstant.NOM_PERSON_STATUS_ACTIVATED));
        dcCount.add(Restrictions.eq("status", IConstant.NOM_PERSON_STATUS_ACTIVATED));
    }

    if (Tools.getInstance().stringNotEmpty(searchPersonBean.getFirstName())) {
        dc.add(Restrictions.ilike("firstName", "%".concat(searchPersonBean.getFirstName()).concat("%")));
        dcCount.add(Restrictions.ilike("firstName", "%".concat(searchPersonBean.getFirstName()).concat("%")));
        logger.debug("firstName: " + searchPersonBean.getFirstName());
    }

    if (Tools.getInstance().stringNotEmpty(searchPersonBean.getLastName())) {
        dc.add(Restrictions.ilike("lastName", "%".concat(searchPersonBean.getLastName()).concat("%")));
        dcCount.add(Restrictions.ilike("lastName", "%".concat(searchPersonBean.getLastName()).concat("%")));
        logger.debug("lastName: " + searchPersonBean.getLastName());
    }

    if (Tools.getInstance().stringNotEmpty(searchPersonBean.getUsername())) {
        dc.add(Restrictions.ilike("username", "%".concat(searchPersonBean.getUsername()).concat("%")));
        dcCount.add(Restrictions.ilike("username", "%".concat(searchPersonBean.getUsername()).concat("%")));
        logger.debug("username: " + searchPersonBean.getUsername());
    }

    if (searchPersonBean.getDepartmentId() > 0) {
        dc.createCriteria("depts")
                .add(Restrictions.eq("departmentId", new Integer(searchPersonBean.getDepartmentId())));
        dcCount.createCriteria("depts")
                .add(Restrictions.eq("departmentId", new Integer(searchPersonBean.getDepartmentId())));
        logger.debug("departmentId: " + searchPersonBean.getDepartmentId());

    } else if (searchPersonBean.getOrganisationId() > 0) {
        //if the search is in all branches we use it
        dc.createCriteria("depts")
                .add(Restrictions.eq("organisationId", new Integer(searchPersonBean.getOrganisationId())));
        dcCount.createCriteria("depts")
                .add(Restrictions.eq("organisationId", new Integer(searchPersonBean.getOrganisationId())));
        logger.debug("organisationId: " + searchPersonBean.getOrganisationId());
    }

    if (searchPersonBean.getSex() != null) {
        if (searchPersonBean.getSex().equals(IConstant.NOM_PERSON_SEX_F)
                || searchPersonBean.getSex().equals(IConstant.NOM_PERSON_SEX_M)) {
            dc.add(Restrictions.eq("sex", searchPersonBean.getSex()));
            dcCount.add(Restrictions.eq("sex", searchPersonBean.getSex()));
            logger.debug("sex: " + searchPersonBean.getSex());
        }
    }

    dc.setProjection(Projections.id());
    dcCount.setProjection(Projections.id());
    // until here, I've created the subquery
    // now, it's time to retrive all the persons that are in the list of the subquery
    DetachedCriteria dc1 = DetachedCriteria.forEntityName(IModelConstant.personFromOrganisationEntity);
    dc1.add(Subqueries.propertyIn("personId", dc));

    // check if I have to order the results
    if (searchPersonBean.getSortParam() != null && StringUtils.hasLength(searchPersonBean.getSortParam())) {
        // if I have to, check if I have to order them ascending or descending
        if (searchPersonBean.getSortDirection() == IConstant.ASCENDING) {
            // ascending
            dc1.addOrder(Order.asc(searchPersonBean.getSortParam()));
        } else {
            // descending
            dc1.addOrder(Order.desc(searchPersonBean.getSortParam()));
        }
    }

    // if the request didn't come from the pagination area, 
    // it means that I have to set the number of result and pages
    if (searchPersonBean.getNbrOfResults() == -1) {
        // set the countDistinct restriction
        dcCount.setProjection(Projections.countDistinct("personId"));

        int nbrOfResults = ((Integer) getHibernateTemplate().findByCriteria(dcCount, 0, 0).get(0)).intValue();
        searchPersonBean.setNbrOfResults(nbrOfResults);
        logger.debug("NbrOfResults " + searchPersonBean.getNbrOfResults());
        logger.debug("----> searchPersonBean.getResults " + searchPersonBean.getResultsPerPage());
        // get the number of pages
        if (nbrOfResults % searchPersonBean.getResultsPerPage() == 0) {
            searchPersonBean.setNbrOfPages(nbrOfResults / searchPersonBean.getResultsPerPage());
        } else {
            searchPersonBean.setNbrOfPages(nbrOfResults / searchPersonBean.getResultsPerPage() + 1);
        }
        searchPersonBean.setCurrentPage(1);
    }

    List<Person> res = getHibernateTemplate().findByCriteria(dc1,
            (searchPersonBean.getCurrentPage() - 1) * searchPersonBean.getResultsPerPage(),
            searchPersonBean.getResultsPerPage());

    logger.debug("Res " + res.size());
    logger.debug("getFromSearch - END - results size : ".concat(String.valueOf(res.size())));
    return res;
}

From source file:ro.cs.om.model.dao.impl.DaoRoleImpl.java

License:Open Source License

/**
 * Gets the list of persons that has a specific permission
 * /*  w ww . ja v a 2s  . c  o  m*/
 * @author Adelina
 * 
 * @param permissionName
 * @return
 */
public Set<Person> getPersonsByRole(String permissionName, Integer organizationId) {

    logger.debug("getPersonsByRole - START");

    Set<Person> persons = new HashSet<Person>();

    DetachedCriteria dc = DetachedCriteria.forEntityName(IModelConstant.roleAllEntity);
    dc.add(Restrictions.eq("name", IConstant.TS_USER_ALL));
    dc.add(Restrictions.eq("module.moduleId", IConstant.TS_MODULE_ID));
    dc.add(Restrictions.eq("organisation.organisationId", organizationId));

    Permission permission = permissionDao.getByName(permissionName);
    logger.debug("permission = " + permission);

    if (permission == null) {
        return new HashSet<Person>();
    }

    dc.createCriteria("permissions").add(Restrictions.eq("permissionId", permission.getPermissionId()));

    List<Role> roles = getHibernateTemplate().findByCriteria(dc);
    logger.debug("roles = " + roles);
    if (roles != null && roles.size() > 0) {
        for (Role role : roles) {
            logger.debug("role = " + role);
            Set<Person> rolesPersons = role.getPersons();
            logger.debug("rolesPersons = " + rolesPersons);
            if (rolesPersons != null && rolesPersons.size() > 0) {
                for (Person person : rolesPersons) {
                    persons.add(person);
                }
            }
        }
    } else {
        logger.debug("getPersonBYRole - END");
        return new HashSet<Person>();
    }

    logger.debug("getPersonBYRole - END");
    return persons;

}