use of org.mifos.framework.hibernate.helper.QueryInputs in project head by mifos.
the class CustomerPersistence method setQueryInputsValues.
private QueryInputs setQueryInputsValues(final String[] namedQuery, final List<Param> paramList) {
QueryInputs queryInputs = new QueryInputs();
queryInputs.setQueryStrings(namedQuery);
queryInputs.setParamList(paramList);
queryInputs.setPath("org.mifos.customers.business.CustomerSearchDto");
queryInputs.setAliasNames(getAliasNames());
return queryInputs;
}
use of org.mifos.framework.hibernate.helper.QueryInputs in project head by mifos.
the class CustomerPersistence method searchGroupClient.
public QueryResult searchGroupClient(final String searchString, final Short userId, boolean isNewGLIMCreation) throws ConfigurationException, PersistenceException {
String[] namedQuery = new String[2];
List<Param> paramList = new ArrayList<Param>();
QueryInputs queryInputs = new QueryInputs();
QueryResult queryResult = QueryFactory.getQueryResult(CustomerSearchConstants.ACCOUNTSEARCHRESULTS);
PersonnelBO personnel = getLegacyPersonnelDao().getPersonnel(userId);
if (personnel.getLevelEnum() == PersonnelLevel.LOAN_OFFICER) {
namedQuery[0] = NamedQueryConstants.SEARCH_GROUP_CLIENT_COUNT_LO;
namedQuery[1] = NamedQueryConstants.SEARCH_GROUP_CLIENT_LO;
paramList.add(typeNameValue("Short", "PERSONNEL_ID", userId));
} else if (isNewGLIMCreation) {
namedQuery[0] = NamedQueryConstants.SEARCH_GROUP_FOR_GROUP_LOAN_COUNT;
namedQuery[1] = NamedQueryConstants.SEARCH_GROUP_FOR_GROUP_LOAN;
} else {
namedQuery[0] = NamedQueryConstants.SEARCH_GROUP_CLIENT_COUNT;
namedQuery[1] = NamedQueryConstants.SEARCH_GROUP_CLIENT;
}
paramList.add(typeNameValue("String", "SEARCH_ID", personnel.getOffice().getSearchId() + "%"));
paramList.add(typeNameValue("String", "SEARCH_STRING", "%" + searchString + "%"));
paramList.add(typeNameValue("Boolean", "GROUP_LOAN_ALLOWED", ClientRules.getGroupCanApplyLoans() ? Boolean.TRUE : Boolean.FALSE));
String[] aliasNames = { "clientName", "clientId", "groupName", "centerName", "officeName", "globelNo", "levelId" };
queryInputs.setQueryStrings(namedQuery);
queryInputs.setPath("org.mifos.accounts.util.helpers.AccountSearchResultsDto");
queryInputs.setAliasNames(aliasNames);
queryInputs.setParamList(paramList);
try {
queryResult.setQueryInputs(queryInputs);
} catch (HibernateSearchException e) {
throw new PersistenceException(e);
}
return queryResult;
}
use of org.mifos.framework.hibernate.helper.QueryInputs in project head by mifos.
the class CustomerPersistence method searchCustForSavings.
public QueryResult searchCustForSavings(final String searchString, final Short userId) throws PersistenceException {
String[] namedQuery = new String[2];
List<Param> paramList = new ArrayList<Param>();
QueryInputs queryInputs = new QueryInputs();
QueryResult queryResult = QueryFactory.getQueryResult(CustomerSearchConstants.CUSTOMERSFORSAVINGSACCOUNT);
PersonnelBO personnel = getLegacyPersonnelDao().getPersonnel(userId);
if (personnel.getLevelEnum() == PersonnelLevel.LOAN_OFFICER) {
namedQuery[0] = NamedQueryConstants.SEARCH_CUSTOMER_FOR_SAVINGS_COUNT;
namedQuery[1] = NamedQueryConstants.SEARCH_CUSTOMER_FOR_SAVINGS;
paramList.add(typeNameValue("Short", "PERSONNEL_ID", userId));
} else {
namedQuery[0] = NamedQueryConstants.SEARCH_CUSTOMER_FOR_SAVINGS_COUNT_NOLO;
namedQuery[1] = NamedQueryConstants.SEARCH_CUSTOMER_FOR_SAVINGS_NOLO;
}
paramList.add(typeNameValue("String", "SEARCH_ID", personnel.getOffice().getSearchId() + "%"));
paramList.add(typeNameValue("String", "SEARCH_STRING", "%" + searchString + "%"));
String[] aliasNames = { "clientName", "clientId", "groupName", "centerName", "officeName", "globelNo" };
queryInputs.setQueryStrings(namedQuery);
queryInputs.setPath("org.mifos.accounts.util.helpers.AccountSearchResultsDto");
queryInputs.setAliasNames(aliasNames);
queryInputs.setParamList(paramList);
try {
queryResult.setQueryInputs(queryInputs);
} catch (HibernateSearchException e) {
throw new PersistenceException(e);
}
return queryResult;
}
use of org.mifos.framework.hibernate.helper.QueryInputs in project head by mifos.
the class GroupPersistence method searchForAddingClientToGroup.
public QueryResult searchForAddingClientToGroup(String searchString, Short userId) throws PersistenceException {
String[] namedQuery = new String[2];
List<Param> paramList = new ArrayList<Param>();
QueryInputs queryInputs = new QueryInputs();
QueryResult queryResult = QueryFactory.getQueryResult(CustomerSearchConstants.GROUPLIST);
PersonnelBO personnel = legacyPersonnelDao.getPersonnel(userId);
String officeSearchId = personnel.getOffice().getSearchId();
if (ClientRules.getCenterHierarchyExists()) {
namedQuery[0] = NamedQueryConstants.GROUP_SEARCH_COUNT_WITH_CENTER_FOR_ADDING_GROUPMEMBER;
namedQuery[1] = NamedQueryConstants.GROUP_SEARCHWITH_CENTER_FOR_ADDING_GROUPMEMBER;
String[] aliasNames = { "officeName", "groupName", "centerName", "groupId" };
queryInputs.setAliasNames(aliasNames);
} else {
namedQuery[0] = NamedQueryConstants.GROUP_SEARCH_COUNT_WITHOUT_CENTER_FOR_ADDING_GROUPMEMBER;
namedQuery[1] = NamedQueryConstants.GROUP_SEARCH_WITHOUT_CENTER_FOR_ADDING_GROUPMEMBER;
String[] aliasNames = { "officeName", "groupName", "groupId" };
queryInputs.setAliasNames(aliasNames);
}
paramList.add(typeNameValue("String", "SEARCH_ID", officeSearchId + "%"));
paramList.add(typeNameValue("String", "SEARCH_STRING", searchString + "%"));
paramList.add(typeNameValue("Short", "LEVEL_ID", CustomerLevel.GROUP.getValue()));
paramList.add(typeNameValue("Short", "USER_ID", userId));
paramList.add(typeNameValue("Short", "USER_LEVEL_ID", personnel.getLevelEnum().getValue()));
paramList.add(typeNameValue("Short", "LO_LEVEL_ID", PersonnelLevel.LOAN_OFFICER.getValue()));
queryInputs.setQueryStrings(namedQuery);
queryInputs.setPath("org.mifos.customers.group.util.helpers.GroupSearchResults");
queryInputs.setParamList(paramList);
try {
queryResult.setQueryInputs(queryInputs);
} catch (HibernateSearchException e) {
throw new PersistenceException(e);
}
return queryResult;
}
use of org.mifos.framework.hibernate.helper.QueryInputs in project head by mifos.
the class GroupPersistence method search.
public QueryResult search(String searchString, Short userId) throws PersistenceException {
String[] namedQuery = new String[2];
List<Param> paramList = new ArrayList<Param>();
QueryInputs queryInputs = new QueryInputs();
QueryResult queryResult = QueryFactory.getQueryResult(CustomerSearchConstants.GROUPLIST);
PersonnelBO personnel = legacyPersonnelDao.getPersonnel(userId);
String officeSearchId = personnel.getOffice().getSearchId();
if (ClientRules.getCenterHierarchyExists()) {
namedQuery[0] = NamedQueryConstants.GROUP_SEARCH_COUNT_WITH_CENTER;
namedQuery[1] = NamedQueryConstants.GROUP_SEARCHWITH_CENTER;
String[] aliasNames = { "officeName", "groupName", "centerName", "groupId" };
queryInputs.setAliasNames(aliasNames);
} else {
namedQuery[0] = NamedQueryConstants.GROUP_SEARCH_COUNT_WITHOUT_CENTER;
namedQuery[1] = NamedQueryConstants.GROUP_SEARCH_WITHOUT_CENTER;
String[] aliasNames = { "officeName", "groupName", "groupId" };
queryInputs.setAliasNames(aliasNames);
}
paramList.add(typeNameValue("String", "SEARCH_ID", officeSearchId + "%"));
paramList.add(typeNameValue("String", "SEARCH_STRING", "%" + searchString + "%"));
paramList.add(typeNameValue("Short", "LEVEL_ID", CustomerLevel.GROUP.getValue()));
paramList.add(typeNameValue("Short", "USER_ID", userId));
paramList.add(typeNameValue("Short", "USER_LEVEL_ID", personnel.getLevelEnum().getValue()));
paramList.add(typeNameValue("Short", "LO_LEVEL_ID", PersonnelLevel.LOAN_OFFICER.getValue()));
queryInputs.setQueryStrings(namedQuery);
queryInputs.setPath("org.mifos.customers.group.util.helpers.GroupSearchResults");
queryInputs.setParamList(paramList);
try {
queryResult.setQueryInputs(queryInputs);
} catch (HibernateSearchException e) {
throw new PersistenceException(e);
}
return queryResult;
}
Aggregations