Search in sources :

Example 1 with PageResult

use of org.asqatasun.webapp.presentation.data.PageResult in project Asqatasun by Asqatasun.

the class StatisticsDAOImpl method convertRawResultAsPageResultSet.

/**
     * 
     * @param result
     * @return a collection of PageResult from a raw result collection
     */
private Set<PageResult> convertRawResultAsPageResultSet(Collection<Object[]> result) {
    Set<PageResult> failedPageInfoSet = new LinkedHashSet();
    for (Object[] obj : result) {
        Float weightedMark;
        // cast to deal with different sgbd interpretation
        if (obj[2] instanceof Float) {
            weightedMark = (Float) obj[2];
        } else if (obj[2] instanceof Double) {
            weightedMark = ((Double) obj[2]).floatValue();
        } else {
            weightedMark = (Float) obj[2];
        }
        Float rawMark;
        if (obj[3] instanceof Float) {
            rawMark = (Float) obj[3];
        } else if (obj[3] instanceof Double) {
            rawMark = ((Double) obj[3]).floatValue();
        } else {
            rawMark = (Float) obj[3];
        }
        PageResult fti = PageResultFactory.getInstance().getPageResult((String) obj[0], // rank
        (Integer) obj[1], //weighted mark
        weightedMark, // raw mark
        rawMark, //webresource Id
        ((BigInteger) obj[4]).longValue(), // http status code
        ((Integer) obj[5]).toString());
        failedPageInfoSet.add(fti);
    }
    return failedPageInfoSet;
}
Also used : PageResult(org.asqatasun.webapp.presentation.data.PageResult)

Example 2 with PageResult

use of org.asqatasun.webapp.presentation.data.PageResult in project Asqatasun by Asqatasun.

the class PageListWrapper method getUrlWithPageResultLinkAndExternalLink.

/**
     * Decoration of the displayed raw mark to add the appropriate grade css
     * class.
     *
     * @return
     */
public String getUrlWithPageResultLinkAndExternalLink() {
    Object lObject = this.getCurrentRowObject();
    ResourceBundle resourceBundle = getResourceBundle(this.getPageContext().getRequest());
    PageResult pageResult = null;
    if (lObject instanceof PageResult) {
        pageResult = ((PageResult) lObject);
    }
    StringBuilder strb = new StringBuilder();
    strb.append(buildExternalLinkUrl(pageResult != null ? pageResult.getUrl() : null, resourceBundle));
    strb.append(getUrlLink(pageResult, resourceBundle));
    return strb.toString();
}
Also used : ResourceBundle(java.util.ResourceBundle) PageResult(org.asqatasun.webapp.presentation.data.PageResult)

Example 3 with PageResult

use of org.asqatasun.webapp.presentation.data.PageResult in project Asqatasun by Asqatasun.

the class PageListWrapper method getUrlWithExternalLink.

/**
     *
     * @return
     */
public String getUrlWithExternalLink() {
    Object lObject = this.getCurrentRowObject();
    ResourceBundle resourceBundle = getResourceBundle(this.getPageContext().getRequest());
    PageResult pageResult = null;
    if (lObject instanceof PageResult) {
        pageResult = ((PageResult) lObject);
    }
    StringBuilder strb = new StringBuilder();
    strb.append(buildExternalLinkUrl(pageResult != null ? pageResult.getUrl() : null, resourceBundle));
    strb.append(pageResult.getUrl());
    return strb.toString();
}
Also used : ResourceBundle(java.util.ResourceBundle) PageResult(org.asqatasun.webapp.presentation.data.PageResult)

Aggregations

PageResult (org.asqatasun.webapp.presentation.data.PageResult)3 ResourceBundle (java.util.ResourceBundle)2