use of org.mifos.framework.struts.tags.XmlBuilder in project head by mifos.
the class TableTag method doStartTag.
/**
* Function to render the tag
*/
@Override
public int doStartTag() throws JspException {
// call the helper method to display the result.
try {
// Value of the list which we are getting from the Cache
List list = getList();
if (list == null) {
return super.doStartTag();
}
if (list.size() == 0) {
JspWriter out = pageContext.getOut();
XmlBuilder result;
result = noResults((String) SessionUtils.getAttribute(Constants.OFFICE_NAME, (HttpServletRequest) pageContext.getRequest()), (String) SessionUtils.getAttribute(Constants.BRANCH_ID, (HttpServletRequest) pageContext.getRequest()), (String) SessionUtils.getAttribute(Constants.SEARCH_STRING, (HttpServletRequest) pageContext.getRequest()));
out.write(result.getOutput());
return super.doStartTag();
}
getTableData(list);
} catch (TableTagException tte) {
throw new JspException(tte);
} catch (TableTagParseException ttpe) {
throw new JspException(ttpe);
} catch (TableTagTypeParserException tttpe) {
throw new JspException(tttpe);
} catch (IOException ioe) {
throw new JspException(ioe);
} catch (HibernateSearchException hse) {
throw new JspException(hse);
} catch (PageExpiredException e) {
throw new JspException(e);
}
return super.doStartTag();
}
use of org.mifos.framework.struts.tags.XmlBuilder in project head by mifos.
the class OfficeListTag method getLink.
XmlBuilder getLink(Short officeId, String officeName) {
String urlencodedOfficeName = URLEncoder.encode(officeName);
XmlBuilder builder = new XmlBuilder();
String url = (actionName + "?method=" + methodName + "&office.officeId=" + officeId + "&office.officeName=" + urlencodedOfficeName + "&officeId=" + officeId + "&officeName=" + urlencodedOfficeName + "¤tFlowKey=" + flowKey);
builder.startTag("a", "href", url);
builder.text(officeName);
builder.endTag("a");
return builder;
}
use of org.mifos.framework.struts.tags.XmlBuilder in project head by mifos.
the class OfficeListTag method getOfficeList.
String getOfficeList(Locale preferredUserLocale, List<OfficeDetailsDto> levels, String loggedInOfficeSearchId, List<OfficeHierarchyDto> officeHierarchy, List<OfficeBO> officesTillBranchOffice) {
String termForBranch = "";
String regional = "";
String subregional = "";
String area = "";
for (OfficeDetailsDto level : levels) {
if (level.getLevelId().equals(OfficeLevel.BRANCHOFFICE.getValue())) {
termForBranch = level.getLevelName();
} else if (level.getLevelId().equals(OfficeLevel.AREAOFFICE.getValue())) {
area = level.getLevelName();
} else if (level.getLevelId().equals(OfficeLevel.REGIONALOFFICE.getValue())) {
regional = level.getLevelName();
} else if (level.getLevelId().equals(OfficeLevel.SUBREGIONALOFFICE.getValue())) {
subregional = level.getLevelName();
}
}
XmlBuilder result = new XmlBuilder();
if (onlyBranchOffices != null) {
getBranchOffices(result, officeHierarchy, preferredUserLocale, loggedInOfficeSearchId, termForBranch);
} else {
getAboveBranches(result, officesTillBranchOffice, regional, subregional, area);
getBranchOffices(result, officeHierarchy, preferredUserLocale, loggedInOfficeSearchId, termForBranch);
}
return result.getOutput();
}
use of org.mifos.framework.struts.tags.XmlBuilder in project head by mifos.
the class OfficeListTag method getAboveBranches.
void getAboveBranches(XmlBuilder html, List<OfficeBO> officeList, String regional, String subregional, String area) {
if (null != officeList) {
XmlBuilder regionalHtml = null;
XmlBuilder subregionalHtml = null;
XmlBuilder areaHtml = null;
for (int i = 0; i < officeList.size(); i++) {
OfficeBO office = officeList.get(i);
if (office.getOfficeLevel() == OfficeLevel.HEADOFFICE) {
html.singleTag("br");
html.startTag("span", "class", "fontnormalbold");
html.append(getLink(office.getOfficeId(), office.getOfficeName()));
html.singleTag("br");
html.endTag("span");
} else if (office.getOfficeLevel() == OfficeLevel.REGIONALOFFICE) {
regionalHtml = processOffice(regionalHtml, office, regional);
} else if (office.getOfficeLevel() == OfficeLevel.SUBREGIONALOFFICE) {
subregionalHtml = processOffice(subregionalHtml, office, subregional);
} else if (office.getOfficeLevel() == OfficeLevel.AREAOFFICE) {
areaHtml = processOffice(areaHtml, office, area);
}
}
outputLevel(html, regionalHtml);
outputLevel(html, subregionalHtml);
outputLevel(html, areaHtml);
}
}
use of org.mifos.framework.struts.tags.XmlBuilder in project head by mifos.
the class Dispatcher method doGet.
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
XmlBuilder html = new XmlBuilder();
String pathInfo = request.getPathInfo();
if (pathInfo == null) {
redirectTo(response, stringUrlOf(request) + "/");
return;
} else if (pathInfo.equals("/")) {
String contextPath = request.getContextPath();
developerPage(contextPath, html);
} else if (isCreateReport(pathInfo)) {
new CreateReport().createPage(html);
} else if (pathInfo.startsWith("/reports/")) {
String reportIdString = pathInfo.substring("/reports/".length());
try {
int reportId = Integer.parseInt(reportIdString);
redirectToReport(response, request, reportId);
} catch (NumberFormatException notValidNumber) {
errorPage(html, pathInfo);
response.setStatus(404);
}
} else {
errorPage(html, pathInfo);
response.setStatus(404);
}
response.getWriter().write(html.getOutput());
}
Aggregations