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);
}
}
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;
}
Aggregations