Examples of toApi()


Examples of com.ikanow.infinit.e.data_model.api.ResponsePojo.toApi()

       rp.getResponse().setTime(endTime.getTime() - startTime.getTime());
       if (!rp.getResponse().isSuccess()) {
         RESTTools.logRequest(this);
       }//TOTEST (TODO-2194)
     }
     return new StringRepresentation(rp.toApi(), MediaType.APPLICATION_JSON);
  }

}
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.api.ResponsePojo.toApi()

     if (!rp.getResponse().isSuccess()) {
       if (rp.getResponse().getMessage().contains("ermission")) { // likely to be a permissions error
         RESTTools.logRequest(this);
       }
     }//TOTEST (TODO-2194)
     return new StringRepresentation(rp.toApi(), MediaType.APPLICATION_JSON);
  }
}
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.api.ResponsePojo.toApi()

          else {
            rp.setData(toAdd, new DocumentPojoApiMap());
          }//TESTED
         
          //Test deserialization:
          rp.toApi();
        }
        catch (Exception e) {
          //e.printStackTrace();
          StringBuffer sb = new StringBuffer();
          Globals.populateStackTrace(sb, e);
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.api.ResponsePojo.toApi()

      if ((!action.equals("keepalive")) && ((null == user) || !user.equals("ping"))) {
        // (not a keepalive) and (user!=ping)
        RESTTools.logRequest(this);
      }
    }//TOTEST (TODO-2194)
    return new StringRepresentation(rp.toApi(), MediaType.APPLICATION_JSON);
  }   
}
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.api.ResponsePojo.toApi()

    ////////////////////////////////////////////////
    //CANONICAL EXAMPLE:
    Set<ObjectId> communities = new HashSet<ObjectId>();
    communities.add(new ObjectId("a0000000000000000000000a"));
    rp1.setData(sp, new SourcePojoApiMap(null, communities, communities));
    String sRPSingleObject = rp1.toApi();
    System.out.println("RPa=" + sRPSingleObject); // ("chris" removed, toApi handles RepsonsePojo specially)
    ////////////////////////////////////////////////
    System.out.println("RPb=" + ResponsePojo.toApi(rp1, rp1.getMapper())); // ("chris" removed because of mapper)
    System.out.println("RPc=" + ResponsePojo.toApi(rp1)); // ("chris" removed, toApi handles RepsonsePojo specially)
   
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.api.ResponsePojo.toApi()

    //CHECK THIS DOESN'T COMPILE
    //rp1.setData(list); // (Not allowed SourcePojo isn't a BaseApiPojo)

    sp2.addToCommunityIds(new ObjectId("a0000000000000000000000a")); // (alex will be allowed again)
    rp1.setData(list, new SourcePojoApiMap(null, communities, communities));
    String sRPList = rp1.toApi();
    sp2.setCommunityIds(null);
   
    //API:  And get as a list
    String listJson =  BaseApiPojo.getDefaultBuilder().create().toJson(rp1.getData());
    System.out.println("RP=" + listJson); // include "alex" and "chris" - no mapping applied
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.api.ResponsePojo.toApi()

        // (just has "alex")     
    }
   
    // And now in the other direction, ie deserializing....
    ResponsePojo rpRecreated = ResponsePojo.fromApi(sRPSingleObject, ResponsePojo.class, SourcePojo.class, new SourcePojoApiMap(null, communities, communities));
    System.out.println("RECREATED RP_SRC=" + rpRecreated.toApi());
    System.out.println("RECREATED SRC(RP_SRC)=" + ((BasicDBObject)((SourcePojo)rpRecreated.getData()).toDb()).toString());
    rpRecreated = ResponsePojo.listFromApi(sRPList, ResponsePojo.class, SourcePojo.listType(), new SourcePojoApiMap(null, communities, communities));
    System.out.println("RECREATED RP_LSRC=" + rpRecreated.toApi());
   
    rpRecreated = ResponsePojo.fromApi(sRPSingleObject, ResponsePojo.class);
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.api.ResponsePojo.toApi()

    // And now in the other direction, ie deserializing....
    ResponsePojo rpRecreated = ResponsePojo.fromApi(sRPSingleObject, ResponsePojo.class, SourcePojo.class, new SourcePojoApiMap(null, communities, communities));
    System.out.println("RECREATED RP_SRC=" + rpRecreated.toApi());
    System.out.println("RECREATED SRC(RP_SRC)=" + ((BasicDBObject)((SourcePojo)rpRecreated.getData()).toDb()).toString());
    rpRecreated = ResponsePojo.listFromApi(sRPList, ResponsePojo.class, SourcePojo.listType(), new SourcePojoApiMap(null, communities, communities));
    System.out.println("RECREATED RP_LSRC=" + rpRecreated.toApi());
   
    rpRecreated = ResponsePojo.fromApi(sRPSingleObject, ResponsePojo.class);
    System.out.println("RECREATED RAW(RP_SRC)=" + ((JsonElement)rpRecreated.getData()));
    sp = ApiManager.mapFromApi((JsonElement)rpRecreated.getData(), SourcePojo.class, new SourcePojoApiMap(null, communities, communities));
    System.out.println("RECREATED SRC(RAW(RP_SRC))=" + ((JsonElement)rpRecreated.getData()));
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.api.ResponsePojo.toApi()

   
    // Testing ResponsePojo code on serialization
    rp1.setData(aqp);
    sRPSingleObject = rp1.toApi();
    rpRecreated = ResponsePojo.fromApi(sRPSingleObject, ResponsePojo.class, AdvancedQueryPojo.class);
    System.out.println("RECREATED RP_AQP=" + rpRecreated.toApi());
    System.out.println("RECREATED AQP(RP_AQP)=" + ((AdvancedQueryPojo)(rpRecreated.getData())).toApi());
   
    //API: Get a list of objects   
    sQueryJson = "{ 'logic': 'chris' }";
    AdvancedQueryPojo aqp2 = AdvancedQueryPojo.fromApi(sQueryJson, AdvancedQueryPojo.class);
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.api.ResponsePojo.toApi()

    sRPList = rp1.toApi();
    System.out.println("RP=" + sRPList);
    // This won't compile because didn't write a listType() for AQP (since it's never actually used in this way)
    //rpRecreated = ResponsePojo.listFromApi(sRPList, ResponsePojo.class, AdvancedQueryPojo.listType());
    rpRecreated = ResponsePojo.listFromApi(sRPList, ResponsePojo.class, new TypeToken<List<AdvancedQueryPojo>>(){});
    System.out.println("RECREATED RP_AQP=" + rpRecreated.toApi());
   
    ////////////////////////////////////////////////
    //CANONICAL EXAMPLE:
    sQueryJson = " [ { 'logic': 'alex' } , { 'logic': 'chris' } ] ";
    list2 = AdvancedQueryPojo.listFromApi(sQueryJson, new TypeToken<List<AdvancedQueryPojo>>(){});
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.