Search in sources :

Example 1 with HierarchyManager

use of org.mifos.security.authorization.HierarchyManager in project head by mifos.

the class EventManger method postEvent.

/**
     * This function will handle the posting of event to autherization manager
     *
     * @param type
     *            type of event
     * @param obj
     *            actual modified object
     * @param EventName
     *            name of event
     */
public static void postEvent(String type, Object obj, String EventName) {
    SecurityEvent se = EventFactory.getEventFactory().createEvent(EventName, obj, type);
    if (EventName.equalsIgnoreCase(SecurityConstants.OFFICECHANGEEVENT)) {
        HierarchyManager hm = HierarchyManager.getInstance();
        hm.handleEvent(se);
    }
}
Also used : HierarchyManager(org.mifos.security.authorization.HierarchyManager)

Example 2 with HierarchyManager

use of org.mifos.security.authorization.HierarchyManager in project head by mifos.

the class OfficePersistence method getPersonnelOffices.

/**
     * This function is used to get the list of the offices under the given
     * personnel office under any user at any time
     *
     * @param officeid
     *            office id of the person
     * @return List list of the offices under him
     * @throws HibernateProcessException
     */
public List<OfficeSearch> getPersonnelOffices(Short officeid) throws SystemException, ApplicationException {
    HierarchyManager hm = HierarchyManager.getInstance();
    String pattern = hm.getSearchId(officeid) + "%";
    List<OfficeSearch> lst = null;
    try {
        Session session = StaticHibernateUtil.getSessionTL();
        Query officeSearch = session.getNamedQuery(NamedQueryConstants.GETOFFICESEARCH);
        officeSearch.setString(SecurityConstants.PATTERN, pattern);
        lst = officeSearch.list();
    } catch (HibernateException he) {
        throw new SecurityException(SecurityConstants.GENERALERROR, he);
    }
    return lst;
}
Also used : HierarchyManager(org.mifos.security.authorization.HierarchyManager) Query(org.hibernate.Query) HibernateException(org.hibernate.HibernateException) OfficeSearch(org.mifos.security.util.OfficeSearch) SecurityException(org.mifos.framework.exceptions.SecurityException) Session(org.hibernate.Session)

Aggregations

HierarchyManager (org.mifos.security.authorization.HierarchyManager)2 HibernateException (org.hibernate.HibernateException)1 Query (org.hibernate.Query)1 Session (org.hibernate.Session)1 SecurityException (org.mifos.framework.exceptions.SecurityException)1 OfficeSearch (org.mifos.security.util.OfficeSearch)1