Examples of Fetch


Examples of com.rallydev.rest.util.Fetch

    @Test
    public void shouldConstructTheCorrectUrl() {
        JsonObject body = new JsonObject();
        CreateRequest req = new CreateRequest("Defect", body);
        req.setFetch(new Fetch("Name", "Description"));
        Assert.assertEquals(req.toUrl(), "/defect/create.js?fetch=Name%2CDescription");
    }
View Full Code Here

Examples of com.rallydev.rest.util.Fetch

        try {
            //Get a story with defects
            System.out.println("\nQuerying for stories with defects...");
            QueryRequest storiesWithDefects = new QueryRequest("hierarchicalrequirement");
            storiesWithDefects.setQueryFilter(new QueryFilter("Defects.ObjectID", "!=", null));
            storiesWithDefects.setFetch(new Fetch("FormattedID", "Name", "Defects"));
            QueryResponse storiesWithDefectsResponse = restApi.query(storiesWithDefects);
            JsonObject story = storiesWithDefectsResponse.getResults().get(0).getAsJsonObject();
            System.out.println(String.format("Found: %s - %s", story.get("FormattedID").getAsString(), story.get("Name").getAsString()));

            //Inspect the defects collection
            JsonObject defectInfo = story.getAsJsonObject("Defects");
            int defectCount = defectInfo.get("Count").getAsInt();
            System.out.println(String.format("\nTotal defects: %d", defectCount));

            //Query the defects collection
            QueryRequest defectRequest = new QueryRequest(defectInfo);
            defectRequest.setFetch(new Fetch("FormattedID", "Name", "State", "Priority"));

            QueryResponse queryResponse = restApi.query(defectRequest);
            if (queryResponse.wasSuccessful()) {
                for (JsonElement result : queryResponse.getResults()) {
                    JsonObject defect = result.getAsJsonObject();
View Full Code Here

Examples of com.rallydev.rest.util.Fetch

    @Test
    public void shouldConstructTheCorrectUrl() {
        JsonObject body = new JsonObject();
        UpdateRequest req= new UpdateRequest("/defect/1234.js", body);
        req.setFetch(new Fetch("Name", "Description"));
        Assert.assertEquals(req.toUrl(), "/defect/1234.js?fetch=Name%2CDescription");
    }
View Full Code Here

Examples of com.rallydev.rest.util.Fetch

    }

    @Test
    public void shouldReturnCorrectUrlWithFetchParams() {
        GetRequest req = new GetRequest("https://rally1.rallydev.com/slm/webservice/1.32/defect/1234.js");
        req.setFetch(new Fetch("Name", "Description"));
        Assert.assertEquals(req.toUrl(), "/defect/1234.js?fetch=Name%2CDescription");
    }
View Full Code Here

Examples of com.rallydev.rest.util.Fetch

    @Test
    public void shouldCreateCorrectQueryWithFetch() {

        QueryRequest q = new QueryRequest("Defect");
        q.setFetch(new Fetch("Name", "Description"));
        Assert.assertTrue(q.toUrl().contains("fetch=Name%2CDescription"));
    }
View Full Code Here

Examples of javax.persistence.criteria.Fetch

     *            join type
     * @return the resulting join
     */
    public <Y> Fetch<X, Y> fetch(PluralAttribute<? super X, ?, Y> assoc, JoinType jt) {
        org.eclipse.persistence.expressions.Expression node;
        Fetch fetch;
        if (jt.equals(JoinType.LEFT)) {
            node = this.currentNode.anyOfAllowingNone(assoc.getName());
        } else if (jt.equals(JoinType.RIGHT)) {
            throw new UnsupportedOperationException(ExceptionLocalization.buildMessage("RIGHT_JOIN_NOT_SUPPORTED"));
        } else {
View Full Code Here

Examples of org.hibernate.annotations.Fetch

    propertyBinder.makePropertyAndBind();
  }

  protected static void defineFetchingStrategy(ToOne toOne, XProperty property) {
    LazyToOne lazy = property.getAnnotation( LazyToOne.class );
    Fetch fetch = property.getAnnotation( Fetch.class );
    ManyToOne manyToOne = property.getAnnotation( ManyToOne.class );
    OneToOne oneToOne = property.getAnnotation( OneToOne.class );
    FetchType fetchType;
    if ( manyToOne != null ) {
      fetchType = manyToOne.fetch();
    }
    else if ( oneToOne != null ) {
      fetchType = oneToOne.fetch();
    }
    else {
      throw new AssertionFailure(
          "Define fetch strategy on a property not annotated with @OneToMany nor @OneToOne"
      );
    }
    if ( lazy != null ) {
      toOne.setLazy( !( lazy.value() == LazyToOneOption.FALSE ) );
      toOne.setUnwrapProxy( ( lazy.value() == LazyToOneOption.NO_PROXY ) );
    }
    else {
      toOne.setLazy( fetchType == FetchType.LAZY );
      toOne.setUnwrapProxy( false );
    }
    if ( fetch != null ) {
      if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
        toOne.setFetchMode( FetchMode.JOIN );
        toOne.setLazy( false );
        toOne.setUnwrapProxy( false );
      }
      else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
        toOne.setFetchMode( FetchMode.SELECT );
      }
      else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
        throw new AnnotationException( "Use of FetchMode.SUBSELECT not allowed on ToOne associations" );
      }
      else {
        throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );
      }
    }
    else {
      toOne.setFetchMode( getFetchMode( fetchType ) );
    }
View Full Code Here

Examples of org.hibernate.annotations.Fetch

    propertyHolder.addProperty( prop, columns );
  }

  protected static void defineFetchingStrategy(ToOne toOne, XProperty property) {
    LazyToOne lazy = property.getAnnotation( LazyToOne.class );
    Fetch fetch = property.getAnnotation( Fetch.class );
    ManyToOne manyToOne = property.getAnnotation( ManyToOne.class );
    OneToOne oneToOne = property.getAnnotation( OneToOne.class );
    FetchType fetchType;
    if ( manyToOne != null ) {
      fetchType = manyToOne.fetch();
    }
    else if ( oneToOne != null ) {
      fetchType = oneToOne.fetch();
    }
    else {
      throw new AssertionFailure(
          "Define fetch strategy on a property not annotated with @OneToMany nor @OneToOne"
      );
    }
    if ( lazy != null ) {
      toOne.setLazy( !( lazy.value() == LazyToOneOption.FALSE ) );
      toOne.setUnwrapProxy( ( lazy.value() == LazyToOneOption.NO_PROXY ) );
    }
    else {
      toOne.setLazy( fetchType == FetchType.LAZY );
      toOne.setUnwrapProxy( false );
    }
    if ( fetch != null ) {
      if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
        toOne.setFetchMode( FetchMode.JOIN );
        toOne.setLazy( false );
        toOne.setUnwrapProxy( false );
      }
      else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
        toOne.setFetchMode( FetchMode.SELECT );
      }
      else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
        throw new AnnotationException( "Use of FetchMode.SUBSELECT not allowed on ToOne associations" );
      }
      else {
        throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );
      }
    }
    else {
      toOne.setFetchMode( getFetchMode( fetchType ) );
    }
View Full Code Here

Examples of org.hibernate.annotations.Fetch

    propertyHolder.addProperty( prop );
  }

  private void defineFetchingStrategy() {
    LazyCollection lazy = property.getAnnotation( LazyCollection.class );
    Fetch fetch = property.getAnnotation( Fetch.class );
    OneToMany oneToMany = property.getAnnotation( OneToMany.class );
    ManyToMany manyToMany = property.getAnnotation( ManyToMany.class );
    CollectionOfElements elements = property.getAnnotation( CollectionOfElements.class );
    ManyToAny manyToAny = property.getAnnotation( ManyToAny.class );
    FetchType fetchType;
    if ( oneToMany != null ) {
      fetchType = oneToMany.fetch();
    }
    else if ( manyToMany != null ) {
      fetchType = manyToMany.fetch();
    }
    else if ( elements != null ) {
      fetchType = elements.fetch();
    }
    else if ( manyToAny != null ) {
      fetchType = FetchType.LAZY;
    }
    else {
      throw new AssertionFailure(
          "Define fetch strategy on a property not annotated with @ManyToOne nor @OneToMany nor @CollectionOfElements"
      );
    }
    if ( lazy != null ) {
      collection.setLazy( !( lazy.value() == LazyCollectionOption.FALSE ) );
      collection.setExtraLazy( lazy.value() == LazyCollectionOption.EXTRA );
    }
    else {
      collection.setLazy( fetchType == FetchType.LAZY );
      collection.setExtraLazy( false );
    }
    if ( fetch != null ) {
      if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
        collection.setFetchMode( FetchMode.JOIN );
        collection.setLazy( false );
      }
      else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
        collection.setFetchMode( FetchMode.SELECT );
      }
      else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
        collection.setFetchMode( FetchMode.SELECT );
        collection.setSubselectLoadable( true );
        collection.getOwner().setSubselectLoadableCollections( true );
      }
      else {
        throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );
      }
    }
    else {
      collection.setFetchMode( AnnotationBinder.getFetchMode( fetchType ) );
    }
View Full Code Here

Examples of org.hibernate.annotations.Fetch

    );
  }

  private void defineFetchingStrategy() {
    LazyCollection lazy = property.getAnnotation( LazyCollection.class );
    Fetch fetch = property.getAnnotation( Fetch.class );
    OneToMany oneToMany = property.getAnnotation( OneToMany.class );
    ManyToMany manyToMany = property.getAnnotation( ManyToMany.class );
    ElementCollection elementCollection = property.getAnnotation( ElementCollection.class ); //jpa 2
    ManyToAny manyToAny = property.getAnnotation( ManyToAny.class );
    FetchType fetchType;
    if ( oneToMany != null ) {
      fetchType = oneToMany.fetch();
    }
    else if ( manyToMany != null ) {
      fetchType = manyToMany.fetch();
    }
    else if ( elementCollection != null ) {
      fetchType = elementCollection.fetch();
    }
    else if ( manyToAny != null ) {
      fetchType = FetchType.LAZY;
    }
    else {
      throw new AssertionFailure(
          "Define fetch strategy on a property not annotated with @ManyToOne nor @OneToMany nor @CollectionOfElements"
      );
    }
    if ( lazy != null ) {
      collection.setLazy( !( lazy.value() == LazyCollectionOption.FALSE ) );
      collection.setExtraLazy( lazy.value() == LazyCollectionOption.EXTRA );
    }
    else {
      collection.setLazy( fetchType == FetchType.LAZY );
      collection.setExtraLazy( false );
    }
    if ( fetch != null ) {
      if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
        collection.setFetchMode( FetchMode.JOIN );
        collection.setLazy( false );
      }
      else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
        collection.setFetchMode( FetchMode.SELECT );
      }
      else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
        collection.setFetchMode( FetchMode.SELECT );
        collection.setSubselectLoadable( true );
        collection.getOwner().setSubselectLoadableCollections( true );
      }
      else {
        throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );
      }
    }
    else {
      collection.setFetchMode( AnnotationBinder.getFetchMode( fetchType ) );
    }
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.