use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.
the class ContentDAOImpl method findOrphanContentList.
@Override
public List<Content> findOrphanContentList(WebResource webResource, int start, int chunkSize) {
if (webResource instanceof Page) {
Query query = entityManager.createQuery("SELECT distinct s FROM " + SSPImpl.class.getName() + " s" + JOIN_WR + WEB_RESOURCE_CONDITION + HTTP_STATUS_CONDITION);
query.setParameter(WEB_RESOURCE_KEY, webResource);
query.setParameter(HTTP_STATUS_CODE_KEY, DEFAULT_HTTP_STATUS_VALUE);
query.setFirstResult(start);
query.setMaxResults(chunkSize);
return (List<Content>) query.getResultList();
} else if (webResource instanceof Site) {
Query query = entityManager.createQuery("SELECT distinct s FROM " + SSPImpl.class.getName() + " s" + JOIN_WR + " JOIN w.parent p" + " WHERE p=:webResource" + HTTP_STATUS_CONDITION);
query.setParameter(WEB_RESOURCE_KEY, webResource);
query.setParameter(HTTP_STATUS_CODE_KEY, DEFAULT_HTTP_STATUS_VALUE);
query.setFirstResult(start);
query.setMaxResults(chunkSize);
List<Content> contentList = (List<Content>) query.getResultList();
flushAndCloseEntityManager();
return contentList;
}
return Collections.emptyList();
}
use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.
the class ContentDAOImpl method findNumberOfRelatedContentFromWebResource.
@Override
public Long findNumberOfRelatedContentFromWebResource(WebResource webResource) {
if (webResource instanceof Page) {
Query query = entityManager.createQuery(SELECT_DISTINCT_RELATED_CONTENT + SSPImpl.class.getName() + " s" + " JOIN s.relatedContentSet rc" + JOIN_WR + WEB_RESOURCE_CONDITION + " AND s.httpStatusCode !=:httpStatusCode");
query.setParameter(WEB_RESOURCE_KEY, webResource);
query.setParameter(HTTP_STATUS_CODE_KEY, DEFAULT_HTTP_STATUS_VALUE);
return (Long) query.getSingleResult();
} else if (webResource instanceof Site) {
Query query = entityManager.createQuery(SELECT_DISTINCT_RELATED_CONTENT + SSPImpl.class.getName() + " s" + " JOIN s.relatedContentSet rc" + JOIN_WR + " WHERE w.parent.id=:idWebResource" + " AND s.httpStatusCode !=:httpStatusCode");
query.setParameter(ID_WEB_RESOURCE_KEY, webResource.getId());
query.setParameter(HTTP_STATUS_CODE_KEY, DEFAULT_HTTP_STATUS_VALUE);
return (Long) query.getSingleResult();
}
return (long) 0;
}
use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.
the class CheckTitleContentUnicityAtSiteLevelTest method setUpWebResourceMap.
@Override
protected void setUpWebResourceMap() {
// file:Site-Passed1
Site site = getWebResourceFactory().createSite("file:Site-Passed1");
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-1Passed-01", site);
Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rulescreationdemo/CheckTitleContentUnicityAtSiteLevel/Rulescreationdemo.Test.3.1.1-1Passed-01.html");
site.addChild(page);
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-page01", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rulescreationdemo/CheckTitleContentUnicityAtSiteLevel/Rulescreationdemo.Test.3.1.1-1Passed-02.html");
site.addChild(page);
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-page02", page);
// file:Site-Failed1
site = getWebResourceFactory().createSite("file:Site-Failed1");
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-2Failed-01", site);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rulescreationdemo/CheckTitleContentUnicityAtSiteLevel/Rulescreationdemo.Test.3.1.1-2Failed-01.html");
site.addChild(page);
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-page03", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rulescreationdemo/CheckTitleContentUnicityAtSiteLevel/Rulescreationdemo.Test.3.1.1-2Failed-02.html");
site.addChild(page);
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-page04", page);
// file:Site-NA1
site = getWebResourceFactory().createSite("file:Site-NA1");
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-4NA-01", site);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rulescreationdemo/CheckTitleContentUnicityAtSiteLevel/Rulescreationdemo.Test.3.1.1-4NA-01.html");
site.addChild(page);
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-page05", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rulescreationdemo/CheckTitleContentUnicityAtSiteLevel/Rulescreationdemo.Test.3.1.1-4NA-02.html");
site.addChild(page);
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-page06", page);
// file:Site-Passed2
site = getWebResourceFactory().createSite("file:Site-Passed2");
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-1Passed-02", site);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rulescreationdemo/CheckTitleContentUnicityAtSiteLevel/Rulescreationdemo.Test.3.1.1-4NA-02.html");
site.addChild(page);
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-page07", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rulescreationdemo/CheckTitleContentUnicityAtSiteLevel/Rulescreationdemo.Test.3.1.1-1Passed-01.html");
site.addChild(page);
getWebResourceMap().put("Rulescreationdemo.Test.3.1.1-page08", page);
}
use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.
the class Rgaa30Rule121104Test method setUpWebResourceMap.
@Override
protected void setUpWebResourceMap() {
getWebResourceMap().put("Rgaa30.Test.12.11.4-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa30/Rgaa30Rule121104/Rgaa30.Test.12.11.4-3NMI-01.html"));
Site site = getWebResourceFactory().createSite("file:Site-NotTested");
getWebResourceMap().put("Rgaa30.Test.12.11.4-5NT-01", site);
Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa30/Rgaa30Rule121104/Rgaa30.Test.12.11.4-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("Rgaa30.Test.12.11.4-5NT-01-page1", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa30/Rgaa30Rule121104/Rgaa30.Test.12.11.4-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("Rgaa30.Test.12.11.4-5NT-01-page1", page);
}
use of org.asqatasun.entity.subject.Page in project Asqatasun by Asqatasun.
the class Rgaa30Rule120101Test method setUpWebResourceMap.
@Override
protected void setUpWebResourceMap() {
getWebResourceMap().put("Rgaa30.Test.12.01.01-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa30/Rgaa30Rule120101/Rgaa30.Test.12.01.01-3NMI-01.html"));
Site site = getWebResourceFactory().createSite("file:Site-NotTested");
getWebResourceMap().put("Rgaa30.Test.12.01.01-5NT-01", site);
Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa30/Rgaa30Rule120101/Rgaa30.Test.12.01.01-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("Rgaa30.Test.12.01.01-5NT-01-page1", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa30/Rgaa30Rule120101/Rgaa30.Test.12.01.01-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("Rgaa30.Test.12.01.01-5NT-01-page1", page);
}
Aggregations