use of org.asqatasun.entity.reference.Nomenclature in project Asqatasun by Asqatasun.
the class NomenclatureDAOImpl method retrieveByCode.
@Override
public Nomenclature retrieveByCode(String code) {
Query query = entityManager.createQuery("SELECT n FROM " + getEntityClass().getName() + " n" + " WHERE n.code = :code");
query.setParameter("code", code);
return (Nomenclature) query.getSingleResult();
}
use of org.asqatasun.entity.reference.Nomenclature in project Asqatasun by Asqatasun.
the class SSPHandlerImpl method domCheckNodeValueInNomenclature.
@Override
public TestSolution domCheckNodeValueInNomenclature(String nomenclatureCode, String errorMessage) {
Collection<TestSolution> resultSet = new ArrayList<>();
Nomenclature nomenclature = nomenclatureLoaderService.loadByCode(nomenclatureCode);
for (Node node : domHandler.getSelectedElementList()) {
boolean isInNomenclature = false;
String nodeValue = node.getNodeValue();
for (String nomenclatureElementValue : nomenclature.getValueList()) {
if (nodeValue.toLowerCase().equals(nomenclatureElementValue.toLowerCase())) {
isInNomenclature = true;
break;
}
}
if (isInNomenclature) {
resultSet.add(TestSolution.PASSED);
} else {
resultSet.add(TestSolution.FAILED);
ProcessRemark remark = processRemarkDataService.create();
remark.setIssue(TestSolution.FAILED);
remark.setMessageCode(errorMessage);
remark.setSelectionExpression(selectionExpression);
remark.selectedElement(nodeValue);
// remarkList.add(remark);
}
}
return RuleHelper.synthesizeTestSolutionCollection(resultSet);
}
use of org.asqatasun.entity.reference.Nomenclature in project Asqatasun by Asqatasun.
the class LangChecker method loadXhtmlDoctypes.
/**
* This method loads the allowed xhtml doctypes nomenclature
*/
protected void loadXhtmlDoctypes() {
if (xhtmlDoctypesSet == null) {
Nomenclature xhtmlDoctypes = getNomenclatureLoaderService().loadByCode(XHTML_DOCTYPE_NOM);
xhtmlDoctypesSet = xhtmlDoctypes.getValueList();
}
}
use of org.asqatasun.entity.reference.Nomenclature in project Asqatasun by Asqatasun.
the class Aw22Rule10012 method select.
@Override
protected void select(SSPHandler sspHandler) {
totalNumberOfElements = sspHandler.getTotalNumberOfElements();
// retrieve element from the nomenclature
Nomenclature deprecatedHtmlAttr = nomenclatureLoaderService.loadByCode(PRESENTATION_ATTR_NOM);
for (String deprecatedAttr : deprecatedHtmlAttr.getValueList()) {
SimpleElementSelector sec = new SimpleElementSelector(buildQuery(deprecatedAttr));
ElementHandler<Element> eh = new ElementHandlerImpl();
sec.selectElements(sspHandler, eh);
attrElementHandlerMap.put(deprecatedAttr, eh);
}
// elements with width attribute that are not img
SimpleElementSelector secWidthAttrNotImg = new SimpleElementSelector(ELEMENT_WITH_WITDH_ATTR_NOT_IMG);
ElementHandler<Element> ehWithAttrNotImg = new ElementHandlerImpl();
secWidthAttrNotImg.selectElements(sspHandler, ehWithAttrNotImg);
attrElementHandlerMap.put(WIDTH_ATTR, ehWithAttrNotImg);
// elements with width attribute that are not img
SimpleElementSelector secHeightAttrNotImg = new SimpleElementSelector(ELEMENT_WITH_HEIGHT_ATTR_NOT_IMG);
ElementHandler<Element> ehHeightAttrNotImg = new ElementHandlerImpl();
secHeightAttrNotImg.selectElements(sspHandler, ehHeightAttrNotImg);
attrElementHandlerMap.put(HEIGHT_ATTR, ehHeightAttrNotImg);
}
use of org.asqatasun.entity.reference.Nomenclature in project Asqatasun by Asqatasun.
the class Rgaa22Rule07081 method select.
@Override
protected void select(SSPHandler sspHandler) {
super.select(sspHandler);
// retrieve element from the nomenclature
Nomenclature deprecatedHtmlTags = nomenclatureLoaderService.loadByCode(PRESENTATION_TAG_NOM);
// add each element of the nomenclature to the selector
MultipleElementSelector mes = new MultipleElementSelector();
for (String deprecatedTag : deprecatedHtmlTags.getValueList()) {
mes.addCssQuery(deprecatedTag.toLowerCase());
}
mes.selectElements(sspHandler, deprecatedElementHandler);
// retrieve element from the nomenclature
Nomenclature deprecatedHtmlAttr = nomenclatureLoaderService.loadByCode(PRESENTATION_ATTR_NOM);
for (String deprecatedAttr : deprecatedHtmlAttr.getValueList()) {
SimpleElementSelector sec = new SimpleElementSelector(buildQuery(deprecatedAttr));
ElementHandler eh = new ElementHandlerImpl();
sec.selectElements(sspHandler, eh);
attrElementHandlerMap.put(deprecatedAttr, eh);
}
}
Aggregations