Search in sources :

Example 1 with TLiteral

use of org.wso2.carbon.humantask.TLiteral in project carbon-business-process by wso2.

the class LiteralBasedOrgEntityProvider method getOrganizationalEntities.

public List<OrganizationalEntityDAO> getOrganizationalEntities(PeopleQueryEvaluator peopleQueryEvaluator, TFrom tFrom, EvaluationContext evaluationContext) {
    TLiteral literal = tFrom.getLiteral();
    List<OrganizationalEntityDAO> orgEntityList = new ArrayList<OrganizationalEntityDAO>();
    Element domNode = (Element) literal.getDomNode();
    if (domNode != null) {
        NodeList orgEntityNodes = domNode.getElementsByTagNameNS(HumanTaskConstants.organizationalEntityQname.getNamespaceURI(), HumanTaskConstants.organizationalEntityQname.getLocalPart());
        // There should be only one organizational Entity
        if (orgEntityNodes.getLength() == 1) {
            Node orgEntityNode = orgEntityNodes.item(0);
            addOrgEntitiesForOrganizationEntityNode(orgEntityNode, peopleQueryEvaluator, orgEntityList);
        } else {
            NodeList elements = domNode.getElementsByTagNameNS(HumanTaskConstants.userQname.getNamespaceURI(), HumanTaskConstants.userQname.getLocalPart());
            if (elements.getLength() == 1) {
                // There should only be one user element
                CommonTaskUtil.addOrgEntityForUserNode(elements.item(0), peopleQueryEvaluator, orgEntityList);
            }
        }
    }
    return orgEntityList;
}
Also used : TLiteral(org.wso2.carbon.humantask.TLiteral) OrganizationalEntityDAO(org.wso2.carbon.humantask.core.dao.OrganizationalEntityDAO) Element(org.w3c.dom.Element) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1 TLiteral (org.wso2.carbon.humantask.TLiteral)1 OrganizationalEntityDAO (org.wso2.carbon.humantask.core.dao.OrganizationalEntityDAO)1