Search in sources :

Example 66 with Page

use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.

the class ScenarioLoaderImpl method fireNewSSP.

/**
     * 
     * @param url
     * @param sourceCode 
     */
private void fireNewSSP(String url, String sourceCode, byte[] snapshotContent, Map<String, String> jsScriptMap) {
    LOGGER.debug("fire New SSP " + url);
    if (StringUtils.isEmpty(sourceCode)) {
        LOGGER.debug("Emtpy SSP " + url + " not saved");
        return;
    }
    String charset = UFT8;
    try {
        charset = CrawlUtils.extractCharset(IOUtils.toInputStream(sourceCode));
    } catch (IOException ex) {
        Logger.getLogger(this.getClass()).warn(ex);
    }
    Page page = getWebResource(url);
    SSP ssp = contentDataService.getSSP(dateFactory.createDate(), url, sourceCode, page, HttpStatus.SC_OK);
    ssp.setCharset(charset);
    contentDataService.saveOrUpdate(ssp);
    result.add(ssp);
    //        if (snapshotContent != null) {
    //            Snapshot snapshot = snapshotFactory.create(
    //                    page, 
    //                    snapshotContent);
    //            snapshotDataService.saveOrUpdate(snapshot);
    //        }
    Audit audit = null;
    if (page.getAudit() != null) {
        audit = page.getAudit();
    } else if (page.getParent().getAudit() != null) {
        audit = page.getParent().getAudit();
    }
    for (Map.Entry<String, String> entry : jsScriptMap.entrySet()) {
        PreProcessResult ppr = preProcessResultDataService.getPreProcessResult(entry.getKey(), entry.getValue(), audit, page);
        preProcessResultDataService.saveOrUpdate(ppr);
    }
}
Also used : SSP(org.asqatasun.entity.audit.SSP) Audit(org.asqatasun.entity.audit.Audit) PreProcessResult(org.asqatasun.entity.audit.PreProcessResult) Page(org.asqatasun.entity.subject.Page) IOException(java.io.IOException) Map(java.util.Map)

Example 67 with Page

use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.

the class ScenarioLoaderImpl method getWebResource.

/**
     * 
     * @param url
     * @return the page instance for a given URL
     */
private Page getWebResource(String url) {
    Page page = null;
    if (webResource instanceof Page) {
        if (!StringUtils.equals(url, webResource.getURL())) {
            webResource.setURL(url);
        }
        page = (Page) webResource;
        page.setRank(1);
    } else if (webResource instanceof Site) {
        page = webResourceDataService.createPage(url);
        page.setRank(pageRank);
        pageRank++;
        ((Site) webResource).addChild(page);
    }
    page = (Page) webResourceDataService.saveOrUpdate(page);
    return page;
}
Also used : Site(org.asqatasun.entity.subject.Site) Page(org.asqatasun.entity.subject.Page)

Example 68 with Page

use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.

the class Aw22Rule12022Test method setUpWebResourceMap.

@Override
protected void setUpWebResourceMap() {
    getWebResourceMap().put("AW22.Test.12.2.2-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12022/AW22.Test.12.2.2-3NMI-01.html"));
    Site site = getWebResourceFactory().createSite("file:Site-NotTested");
    getWebResourceMap().put("AW22.Test.12.2.2-5NT-01", site);
    Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12022/AW22.Test.12.2.2-3NMI-01.html");
    site.addChild(page);
    getWebResourceMap().put("AW22.Test.12.2.2-5NT-01-page1", page);
    page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12022/AW22.Test.12.2.2-3NMI-01.html");
    site.addChild(page);
    getWebResourceMap().put("AW22.Test.12.2.2-5NT-01-page1", page);
}
Also used : Site(org.asqatasun.entity.subject.Site) Page(org.asqatasun.entity.subject.Page)

Example 69 with Page

use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.

the class Aw22Rule12032Test method setUpWebResourceMap.

@Override
protected void setUpWebResourceMap() {
    getWebResourceMap().put("AW22.Test.12.3.2-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12032/AW22.Test.12.3.2-3NMI-01.html"));
    Site site = getWebResourceFactory().createSite("file:Site-NotTested");
    getWebResourceMap().put("AW22.Test.12.3.2-5NT-01", site);
    Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12032/AW22.Test.12.3.2-3NMI-01.html");
    site.addChild(page);
    getWebResourceMap().put("AW22.Test.12.3.2-5NT-01-page1", page);
    page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12032/AW22.Test.12.3.2-3NMI-01.html");
    site.addChild(page);
    getWebResourceMap().put("AW22.Test.12.3.2-5NT-01-page1", page);
}
Also used : Site(org.asqatasun.entity.subject.Site) Page(org.asqatasun.entity.subject.Page)

Example 70 with Page

use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.

the class Aw22Rule12063Test method setUpWebResourceMap.

@Override
protected void setUpWebResourceMap() {
    getWebResourceMap().put("AW22.Test.12.6.3-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12063/AW22.Test.12.6.3-3NMI-01.html"));
    Site site = getWebResourceFactory().createSite("file:Site-NotTested");
    getWebResourceMap().put("AW22.Test.12.6.3-5NT-01", site);
    Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12063/AW22.Test.12.6.3-3NMI-01.html");
    site.addChild(page);
    getWebResourceMap().put("AW22.Test.12.6.3-5NT-01-page1", page);
    page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12063/AW22.Test.12.6.3-3NMI-01.html");
    site.addChild(page);
    getWebResourceMap().put("AW22.Test.12.6.3-5NT-01-page1", page);
}
Also used : Site(org.asqatasun.entity.subject.Site) Page(org.asqatasun.entity.subject.Page)

Aggregations

Page (org.asqatasun.entity.subject.Page)77 Site (org.asqatasun.entity.subject.Site)68 WebResource (org.asqatasun.entity.subject.WebResource)7 ArrayList (java.util.ArrayList)6 Query (javax.persistence.Query)6 Audit (org.asqatasun.entity.audit.Audit)4 ProcessResult (org.asqatasun.entity.audit.ProcessResult)4 List (java.util.List)3 Map (java.util.Map)3 SSP (org.asqatasun.entity.audit.SSP)3 Content (org.asqatasun.entity.audit.Content)2 DefiniteResult (org.asqatasun.entity.audit.DefiniteResult)2 ForbiddenPageException (org.asqatasun.webapp.exception.ForbiddenPageException)2 ColumnBuilderException (ar.com.fdvs.dj.domain.builders.ColumnBuilderException)1 IOException (java.io.IOException)1 JRException (net.sf.jasperreports.engine.JRException)1 PreProcessResult (org.asqatasun.entity.audit.PreProcessResult)1 Scope (org.asqatasun.entity.reference.Scope)1 ContentDataService (org.asqatasun.entity.service.audit.ContentDataService)1 WebResourceDataService (org.asqatasun.entity.service.subject.WebResourceDataService)1