Examples of SortSpec


Examples of autotest.common.table.DataSource.SortSpec

    }

    private void restoreTableSorting() {
        for (ListIterator<SortSpec> i = tableSorts.listIterator(tableSorts.size());
             i.hasPrevious();) {
            SortSpec sortSpec = i.previous();
            table.sortOnColumn(sortSpec.getField(), sortSpec.getDirection());
        }
    }
View Full Code Here

Examples of ca.uhn.fhir.rest.api.SortSpec

public class SortParameter implements IParameter {

  @Override
  public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException {
    SortSpec ss = (SortSpec) theSourceClientArgument;
    while (ss != null) {
      String name;
      if (ss.getOrder() == null) {
        name = Constants.PARAM_SORT;
      } else if (ss.getOrder() == SortOrderEnum.ASC) {
        name = Constants.PARAM_SORT_ASC;
      } else {
        name = Constants.PARAM_SORT_DESC;
      }

      if (ss.getParamName() != null) {
        if (!theTargetQueryArguments.containsKey(name)) {
          theTargetQueryArguments.put(name, new ArrayList<String>());
        }
        theTargetQueryArguments.get(name).add(ss.getParamName());
      }
      ss = ss.getChain();
    }
  }
View Full Code Here

Examples of ca.uhn.fhir.rest.api.SortSpec

          return null;
        }
      }
    }

    SortSpec outerSpec = null;
    SortSpec innerSpec = null;
    for (String nextParamName : theRequest.getParameters().keySet()) {
      SortOrderEnum order;
      if (Constants.PARAM_SORT.equals(nextParamName)) {
        order = null;
      } else if (Constants.PARAM_SORT_ASC.equals(nextParamName)) {
        order = SortOrderEnum.ASC;
      } else if (Constants.PARAM_SORT_DESC.equals(nextParamName)) {
        order = SortOrderEnum.DESC;
      } else {
        continue;
      }

      String[] values = theRequest.getParameters().get(nextParamName);
      if (values != null) {
        for (String nextValue : values) {
          if (isNotBlank(nextValue)) {
            SortSpec spec = new SortSpec();
            spec.setOrder(order);
            spec.setParamName(nextValue);
            if (innerSpec == null) {
              outerSpec = spec;
              innerSpec = spec;
            } else {
              innerSpec.setChain(spec);
View Full Code Here

Examples of ca.uhn.fhir.rest.api.SortSpec

public class SortParameter implements IParameter {

  @Override
  public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, BaseHttpClientInvocation theClientInvocation) throws InternalErrorException {
    SortSpec ss = (SortSpec) theSourceClientArgument;
    while (ss != null) {
      String name;
      if (ss.getOrder() == null) {
        name = Constants.PARAM_SORT;
      } else if (ss.getOrder() == SortOrderEnum.ASC) {
        name = Constants.PARAM_SORT_ASC;
      } else {
        name = Constants.PARAM_SORT_DESC;
      }

      if (ss.getParamName() != null) {
        if (!theTargetQueryArguments.containsKey(name)) {
          theTargetQueryArguments.put(name, new ArrayList<String>());
        }
        theTargetQueryArguments.get(name).add(ss.getParamName());
      }
      ss = ss.getChain();
    }
  }
View Full Code Here

Examples of org.apache.chemistry.opencmis.server.support.query.QueryObject.SortSpec

        assertNotNull(walker);

        List<SortSpec> orderBys = queryObj.getOrderBys();
        assertTrue(1 == orderBys.size());

        SortSpec sp = orderBys.get(0);
        assertTrue(sp.isAscending());

        CmisSelector sortSpec = sp.getSelector();
        assert(sortSpec instanceof ColumnReference);
        assertEquals("abc", ((ColumnReference)sortSpec).getQualifier());
        assertEquals("def", ((ColumnReference)sortSpec).getPropertyQueryName());
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.server.support.query.QueryObject.SortSpec

        assertNotNull(walker);

        List<SortSpec> orderBys = queryObj.getOrderBys();
        assertTrue(1 == orderBys.size());

        SortSpec sp = orderBys.get(0);
        assertFalse(sp.isAscending());

        CmisSelector sortSpec = sp.getSelector();
        assert(sortSpec instanceof ColumnReference);
        assertNull(((ColumnReference)sortSpec).getQualifier());
        assertEquals("def", ((ColumnReference)sortSpec).getPropertyQueryName());
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.server.support.query.QueryObject.SortSpec

        }
        class ResultComparator implements Comparator<StoredObject> {

            @SuppressWarnings("unchecked")
            public int compare(StoredObject so1, StoredObject so2) {
                SortSpec s = orderBy.get(0);
                CmisSelector sel = s.getSelector();
                int result;

                if (sel instanceof ColumnReference) {
                    String propId = ((ColumnReference) sel).getPropertyId();
                    Object propVal1 = so1.getProperties().get(propId).getFirstValue();
                    Object propVal2 = so2.getProperties().get(propId).getFirstValue();
                    if (propVal1 == null && propVal2 == null) {
                        result = 0;
                    } else if (propVal1 == null) {
                        result = -1;
                    } else if (propVal2 == null) {
                        result = 1;
                    } else {
                        result = ((Comparable<Object>) propVal1).compareTo(propVal2);
                    }
                } else {
                    // String funcName = ((FunctionReference) sel).getName();
                    // evaluate function here, currently ignore
                    result = 0;
                }
                if (!s.isAscending()) {
                    result = -result;
                }
                return result;
            }
View Full Code Here

Examples of org.apache.chemistry.opencmis.server.support.query.QueryObject.SortSpec

        }
        class ResultComparator implements Comparator<StoredObject> {

            @SuppressWarnings("unchecked")
            public int compare(StoredObject so1, StoredObject so2) {
                SortSpec s = orderBy.get(0);
                CmisSelector sel = s.getSelector();
                int result;

                if (sel instanceof ColumnReference) {
                    String propId = ((ColumnReference) sel).getPropertyId();
                    Object propVal1 = so1.getProperties().get(propId).getFirstValue();
                    Object propVal2 = so2.getProperties().get(propId).getFirstValue();
                    if (propVal1 == null && propVal2 == null) {
                        result = 0;
                    } else if (propVal1 == null) {
                        result = -1;
                    } else if (propVal2 == null) {
                        result = 1;
                    } else {
                        result = ((Comparable<Object>) propVal1).compareTo(propVal2);
                    }
                } else {
                    // String funcName = ((FunctionReference) sel).getName();
                    // evaluate function here, currently ignore
                    result = 0;
                }
                if (!s.isAscending()) {
                    result = -result;
                }
                return result;
            }
        }
View Full Code Here

Examples of org.apache.chemistry.opencmis.server.support.query.QueryObject.SortSpec

        }
        class ResultComparator implements Comparator<StoredObject> {

            @SuppressWarnings("unchecked")
            public int compare(StoredObject so1, StoredObject so2) {
                SortSpec s = orderBy.get(0);
                CmisSelector sel = s.getSelector();
                int result;

                if (sel instanceof ColumnReference) {
                    String propId = ((ColumnReference) sel).getPropertyId();
                    Object propVal1 = so1.getProperties().get(propId).getFirstValue();
                    Object propVal2 = so2.getProperties().get(propId).getFirstValue();
                    if (propVal1 == null && propVal2 == null) {
                        result = 0;
                    } else if (propVal1 == null) {
                        result = -1;
                    } else if (propVal2 == null) {
                        result = 1;
                    } else {
                        result = ((Comparable<Object>) propVal1).compareTo(propVal2);
                    }
                } else {
                    // String funcName = ((FunctionReference) sel).getName();
                    // evaluate function here, currently ignore
                    result = 0;
                }
                if (!s.isAscending()) {
                    result = -result;
                }
                return result;
            }
        }
View Full Code Here

Examples of org.apache.chemistry.opencmis.server.support.query.QueryObject.SortSpec

        }
        class ResultComparator implements Comparator<StoredObject> {

            @SuppressWarnings("unchecked")
            public int compare(StoredObject so1, StoredObject so2) {
                SortSpec s = orderBy.get(0);
                CmisSelector sel = s.getSelector();
                int result;

                if (sel instanceof ColumnReference) {
                    String propId = ((ColumnReference) sel).getPropertyId();
                    Object propVal1 = so1.getProperties().get(propId).getFirstValue();
                    Object propVal2 = so2.getProperties().get(propId).getFirstValue();
                    if (propVal1 == null && propVal2 == null) {
                        result = 0;
                    } else if (propVal1 == null) {
                        result = -1;
                    } else if (propVal2 == null) {
                        result = 1;
                    } else {
                        result = ((Comparable<Object>) propVal1).compareTo(propVal2);
                    }
                } else {
                    // String funcName = ((FunctionReference) sel).getName();
                    // evaluate function here, currently ignore
                    result = 0;
                }
                if (!s.isAscending()) {
                    result = -result;
                }
                return result;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.