Package org.apache.oodt.xmlquery

Examples of org.apache.oodt.xmlquery.QueryElement


            return Collections.emptyList();

        List<QueryElement> newSet = new Vector<QueryElement>();

        for (Iterator<QueryElement> i = origSet.iterator(); i.hasNext();) {
            QueryElement elem = i.next();
            if (elem.getRole().equals(XMLQueryHelper.ROLE_ELEMNAME)
                    && mapping.constantField(elem.getValue())) {
                newSet.add(elem);
            }
        }

        return newSet;
View Full Code Here


            boolean selectSet) throws Exception {
        // go through each query element: use the mapping fields
        // to translate the names

        for (Iterator<QueryElement> i = elemSet.iterator(); i.hasNext();) {
            QueryElement elem = i.next();
            if (elem.getRole().equals(XMLQueryHelper.ROLE_ELEMNAME)) {
                // do the translation
                String elemValue = elem.getValue();
                MappingField fld = this.mapping.getFieldByName(elemValue);
                // make sure fld is not null
                if (fld == null) {
                    continue;
                }

                // make sure scope is null, or if it's not null, then it's
                // FieldScope.QUERY

                if (fld.getScope() != null
                        && fld.getScope().equals(FieldScope.RETURN)) {
                    // skip
                    continue;
                }

                // check to see if it has a dbname attr, if not, then the name
                // stays
                // the same
                String newFldName = fld.getLocalName();

                elem.setValue(newFldName);

                // now translate the domain vocab if there are translate funcs
                // present and this isn't the select set

                if (!selectSet && fld.getFuncs() != null
                        && fld.getFuncs().size() > 0) {
                    // the next query element should be
                    // XMLQueryHelper.ROLE_LITERAL
                    if (!i.hasNext())
                        break;
                    QueryElement litElem = i.next();
                    if (!litElem.getRole().equals(XMLQueryHelper.ROLE_LITERAL)) {
                        throw new Exception("next query element not "
                                + XMLQueryHelper.ROLE_LITERAL + "! role is "
                                + litElem.getRole() + " instead!");
                    }

                    for (Iterator<MappingFunc> j = fld.getFuncs().iterator(); j
                            .hasNext();) {
                        MappingFunc func = j.next();
                        CDEValue origVal = new CDEValue(fld.getName(),
                                litElem.getValue());
                        CDEValue newVal = func.translate(origVal);
                        litElem.setValue(newVal.getVal());
                    }

                }

            }
View Full Code Here

TOP

Related Classes of org.apache.oodt.xmlquery.QueryElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.