use of org.asqatasun.entity.subject.Site in project Asqatasun by Asqatasun.
the class Aw22Rule12021Test method setUpWebResourceMap.
@Override
protected void setUpWebResourceMap() {
getWebResourceMap().put("AW22.Test.12.2.1-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12021/AW22.Test.12.2.1-3NMI-01.html"));
Site site = getWebResourceFactory().createSite("file:Site-NotTested");
getWebResourceMap().put("AW22.Test.12.2.1-5NT-01", site);
Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12021/AW22.Test.12.2.1-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("AW22.Test.12.2.1-5NT-01-page1", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "accessiweb22/Aw22Rule12021/AW22.Test.12.2.1-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("AW22.Test.12.2.1-5NT-01-page1", page);
}
use of org.asqatasun.entity.subject.Site in project Asqatasun by Asqatasun.
the class Rgaa30Rule110302Test method setUpWebResourceMap.
@Override
protected void setUpWebResourceMap() {
getWebResourceMap().put("Rgaa30.Test.11.03.02-4NA-01", getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa30/Rgaa30Rule110302/Rgaa30.Test.11.03.02-3NMI-01.html"));
Site site = getWebResourceFactory().createSite("file:Site-NotTested");
getWebResourceMap().put("Rgaa30.Test.11.03.02-5NT-01", site);
Page page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa30/Rgaa30Rule110302/Rgaa30.Test.11.03.02-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("Rgaa30.Test.11.03.02-5NT-01-page1", page);
page = getWebResourceFactory().createPage(getTestcasesFilePath() + "rgaa30/Rgaa30Rule110302/Rgaa30.Test.11.03.02-3NMI-01.html");
site.addChild(page);
getWebResourceMap().put("Rgaa30.Test.11.03.02-5NT-01-page1", page);
}
use of org.asqatasun.entity.subject.Site in project Asqatasun by Asqatasun.
the class ContentDAOImpl method findNumberOfOrphanRelatedContentFromWebResource.
@Override
public Long findNumberOfOrphanRelatedContentFromWebResource(WebResource webResource) {
if (webResource instanceof Page) {
Query query = entityManager.createQuery(SELECT_DISTINCT_RELATED_CONTENT + RelatedContentImpl.class.getName() + RELATED_CONTENT_KEY + JOIN_PARENT_CONTENT_SET + JOIN_WR + WEB_RESOURCE_CONDITION + " AND rc.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 + RelatedContentImpl.class.getName() + RELATED_CONTENT_KEY + JOIN_PARENT_CONTENT_SET + JOIN_WR + " JOIN w.parent p" + " WHERE p=:webResource" + " AND rc.httpStatusCode =:httpStatusCode");
query.setParameter(WEB_RESOURCE_KEY, webResource);
query.setParameter(HTTP_STATUS_CODE_KEY, DEFAULT_HTTP_STATUS_VALUE);
return (Long) query.getSingleResult();
}
return (long) 0;
}
use of org.asqatasun.entity.subject.Site in project Asqatasun by Asqatasun.
the class ContentDAOImpl method findNumberOfSSPFromWebResource.
@Override
public Long findNumberOfSSPFromWebResource(WebResource webResource, int httpStatusCode) {
if (webResource != null) {
StringBuilder strb = new StringBuilder();
strb.append(SELECT_DISTINCT_SSP);
strb.append(SSPImpl.class.getName());
strb.append(" s");
strb.append(JOIN_WR);
if (webResource instanceof Page) {
strb.append(" WHERE w.id=:idWebResource");
} else if (webResource instanceof Site) {
strb.append(" WHERE w.parent.id=:idWebResource");
}
if (httpStatusCode != -1) {
strb.append(HTTP_STATUS_CONDITION);
} else {
strb.append(" AND s.httpStatusCode!=:httpStatusCode");
}
Query query = entityManager.createQuery(strb.toString());
query.setParameter(ID_WEB_RESOURCE_KEY, webResource.getId());
query.setParameter(HTTP_STATUS_CODE_KEY, httpStatusCode);
return (Long) query.getSingleResult();
} else {
return (long) 0;
}
}
use of org.asqatasun.entity.subject.Site 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();
}
Aggregations