Package org.springframework.data.jpa.domain

Examples of org.springframework.data.jpa.domain.JpaSort$Path


      throw new RuntimeException("Failed to add routes for " + routeControllerClass + ".", t);
    }

    for (Method routeMethod : routeControllerClass.getDeclaredMethods()) {
      String routeMethodName = routeMethod.getName();
      Path pathAnnotation = routeMethod.getAnnotation(Path.class);
      Paths pathsAnnotation = routeMethod.getAnnotation(Paths.class);
      if (pathAnnotation != null || pathsAnnotation != null) {
        String actionName;
        if (routeMethodName.endsWith("Action")) {
          actionName = routeMethodName.substring(0, routeMethodName.length() - "Action".length());
        }
        else {
          actionName = routeMethodName;
        }

        ERXRoute.Method method = null;
        // Search annotations for @PUT, @GET, etc.
        for (Annotation annotation : routeMethod.getAnnotations()) {
          HttpMethod httpMethod = annotation.annotationType().getAnnotation(HttpMethod.class);
          if (httpMethod != null) {
            if (method == null) {
              method = httpMethod.value();
            }
            else {
              throw new IllegalArgumentException(routeControllerClass.getSimpleName() + "." + routeMethod.getName() + " is annotated as more than one http method.");
            }
          }
        }

        // Finally default declared REST actions to @GET
        if (method == null) {
          method = ERXRoute.Method.Get;
        }

        if (pathAnnotation != null) {
          addRoute(new ERXRoute(entityName, pathAnnotation.value(), method, routeControllerClass, actionName));
          declaredRoutesFound = true;
        }
        if (pathsAnnotation != null) {
          for (Path path : pathsAnnotation.value()) {
            addRoute(new ERXRoute(entityName, path.value(), method, routeControllerClass, actionName));
View Full Code Here


      throw new ParserException("Reached end of xml document unexpectedly");
   }

   private Icon parseIcon(XMLStreamReader reader) throws XMLStreamException, ParserException
   {
      Path largeIcon = null;
      Path smallIcon = null;

      //getting attributes
      String id = reader.getAttributeValue(null, Icon.Attribute.ID.getLocalName());
      String lang = reader.getAttributeValue(null, Icon.Attribute.ID.getLocalName());
View Full Code Here

  private static final PluralAttribute<?, ?, ?> NULL_PLURAL_ATTRIBUTE = null;
  private static final PluralAttribute<?, ?, ?>[] EMPTY_PLURAL_ATTRIBUTES = new PluralAttribute<?, ?, ?>[0];

  @Test(expected = IllegalArgumentException.class)
  public void rejectsNullAttribute() {
    new JpaSort(NULL_ATTRIBUTE);
  }
View Full Code Here

    new JpaSort(NULL_ATTRIBUTE);
  }

  @Test(expected = IllegalArgumentException.class)
  public void rejectsEmptyAttributes() {
    new JpaSort(EMPTY_ATTRIBUTES);
  }
View Full Code Here

    new JpaSort(EMPTY_ATTRIBUTES);
  }

  @Test(expected = IllegalArgumentException.class)
  public void rejectsNullPluralAttribute() {
    new JpaSort(NULL_PLURAL_ATTRIBUTE);
  }
View Full Code Here

    new JpaSort(NULL_PLURAL_ATTRIBUTE);
  }

  @Test(expected = IllegalArgumentException.class)
  public void rejectsEmptyPluralAttributes() {
    new JpaSort(EMPTY_PLURAL_ATTRIBUTES);
  }
View Full Code Here

    new JpaSort(EMPTY_PLURAL_ATTRIBUTES);
  }

  @Test
  public void sortBySinglePropertyWithDefaultSortDirection() {
    assertThat(new JpaSort(path(User_.firstname)), hasItems(new Sort.Order("firstname")));
  }
View Full Code Here

  }

  @Test
  public void sortByMultiplePropertiesWithDefaultSortDirection() {

    assertThat(new JpaSort(User_.firstname, User_.lastname),
        hasItems(new Sort.Order("firstname"), new Sort.Order("lastname")));
  }
View Full Code Here

  }

  @Test
  public void sortByMultiplePropertiesWithDescSortDirection() {

    assertThat(new JpaSort(Direction.DESC, User_.firstname, User_.lastname),
        hasItems(new Sort.Order(Direction.DESC, "firstname"), new Sort.Order(Direction.DESC, "lastname")));
  }
View Full Code Here

  }

  @Test
  public void combiningSortByMultipleProperties() {

    assertThat(new JpaSort(User_.firstname).and(new JpaSort(User_.lastname)),
        hasItems(new Sort.Order("firstname"), new Sort.Order("lastname")));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.jpa.domain.JpaSort$Path

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.