Package com.ikanow.infinit.e.data_model.api.social.sharing

Examples of com.ikanow.infinit.e.data_model.api.social.sharing.SharePojoApiMap


  public SharePojo getShare(String shareId, ResponseObject responseObject)
  {
    try{
      String getShareAddress = apiRoot + "social/share/get/" + URLEncoder.encode(shareId,"UTF-8");
      String getResult = sendRequest(getShareAddress, null);
      ResponsePojo internal_responsePojo = ResponsePojo.fromApi(getResult, ResponsePojo.class, SharePojo.class, new SharePojoApiMap(null));
      ResponseObject internal_ro = internal_responsePojo.getResponse();
      responseObject = shallowCopy(responseObject, internal_ro);

      return (SharePojo)internal_responsePojo.getData();
View Full Code Here


  {
    try
    {
      String addShareAddress = apiRoot + "social/share/add/json/" + URLEncoder.encode(type, "UTF-8") + "/" + URLEncoder.encode(title,"UTF-8") + "/" + URLEncoder.encode(description,"UTF-8");
      String addResult = sendRequest(addShareAddress, jsonString);
      ResponsePojo internal_responsePojo = ResponsePojo.fromApi(addResult, ResponsePojo.class, SharePojo.class, new SharePojoApiMap(null));
      ResponseObject internal_ro = internal_responsePojo.getResponse();
      responseObject = shallowCopy(responseObject, internal_ro);

      return (SharePojo)internal_responsePojo.getData();
View Full Code Here

        }
        else { // don't return content
          share.setShare(null);         
        }//TESTED
       
        rp.setData(share, new SharePojoApiMap(memberOf));               
        rp.setResponse(new ResponseObject("Share", true, "Share returned successfully"));
      }
      else {
        rp.setResponse(new ResponseObject("Get Share", false, "Unable to get share, not found or no access permission"));       
      }
View Full Code Here

              share.setShare("{}");
            }
          }
        }//TESTED
       
        rp.setData(shares, new SharePojoApiMap(memberOf));
        rp.setResponse(new ResponseObject("Share", true, "Shares returned successfully"));       
      }
      else {
        rp.setResponse(new ResponseObject("Share", true, "No shares matching search critera found."));       
      }
View Full Code Here

        share.setDescription(description);
        share.setShare(json);
       
        // Save the document to the share collection
        DbManager.getSocial().getShare().update(query, share.toDb());
        rp.setData(share, new SharePojoApiMap(null));
        rp.setResponse(new ResponseObject("Share", true, "Share updated successfully."));
      }
      // Create new share
      else
      {
        // Create a new SharePojo object
        share = new SharePojo();
        share.set_id(new ObjectId(shareIdStr));
        share.setCreated(new Date());
        share.setModified(new Date());
        share.setType(type);
        share.setTitle(title);
        share.setDescription(description);
        share.setShare(json);
       
        HashSet<ObjectId> endorsedSet = new HashSet<ObjectId>();
        share.setEndorsed(endorsedSet); // (you're always endorsed within your own community)
        endorsedSet.add(new ObjectId(ownerIdStr));       
       
        // Get ShareOwnerPojo object and personal community
        PersonPojo owner = getPerson(new ObjectId(ownerIdStr));
        share.setOwner(getOwner(owner));
        share.setCommunities(getPersonalCommunity(owner));

        // Serialize the ID and Dates in the object to MongoDB format
        // Save the document to the share collection
        DbManager.getSocial().getShare().save(share.toDb());
        rp.setData(share, new SharePojoApiMap(null));
        rp.setResponse(new ResponseObject("Share", true, "New share added successfully."));
      }
    }
    catch (Exception e)
    {
View Full Code Here

      share = new SharePojo();     
    }
    else if ( entity.getMediaType().equals(MediaType.TEXT_PLAIN))
    {
      //is just a regular json share, parse it
      share = ApiManager.mapFromApi(entity.getText(), SharePojo.class, new SharePojoApiMap(null));
    }
    else
    {
      //is binary, pull in the bytes
      share = new SharePojo();
View Full Code Here

    String share_string = updated_share.toDb().toString();
   
    Representation entity = new StringRepresentation(share_string);
    Representation rep = shareV2Interface.put(entity);
    ResponsePojo rp = ResponsePojo.fromApi( rep.getText(), null, ResponsePojo.class);
    SharePojo share = ApiManager.mapFromApi((JsonElement)rp.getData(), SharePojo.class, new SharePojoApiMap(null));
    return share;
 
View Full Code Here

    shareV2Interface.setRequest(request)
    shareV2Interface.setResponse(new Response(request));
    shareV2Interface.doInit();
    Representation rep = shareV2Interface.get();
    ResponsePojo rp = ResponsePojo.fromApi( rep.getText(), null, ResponsePojo.class);
    SharePojo share = ApiManager.mapFromApi((JsonObject)rp.getData(), SharePojo.class, new SharePojoApiMap(null));
    return share;
  }
View Full Code Here

    ResponsePojo rp = ResponsePojo.fromApi( rep.getText(), null, ResponsePojo.class);
    List<SharePojo> shares = null;
    try
    {
      //might be a list
      shares = ApiManager.mapListFromApi((JsonObject)rp.getData(), SharePojo.listType(), new SharePojoApiMap(null));
    }
    catch (Exception ex)
    {
      //might be a single item
      shares = new ArrayList<SharePojo>();
      SharePojo share = ApiManager.mapFromApi((JsonObject)rp.getData(), SharePojo.class, new SharePojoApiMap(null));
      shares.add(share);
    }
    return shares;
  }
View Full Code Here

    shareV2Interface.doInit();
   
    Representation entity = new StringRepresentation("{  \"title\":\"test\",\"description\":\"test desc\",\"type\":\"test1\",\"communities\":[{\"_id\":\"4c927585d591d31d7b37097a\"}],\"share\":\"{}\"}");
    Representation rep = shareV2Interface.post(entity);
    ResponsePojo rp = ResponsePojo.fromApi( rep.getText(), null, ResponsePojo.class);
    SharePojo share = ApiManager.mapFromApi((JsonElement)rp.getData(), SharePojo.class, new SharePojoApiMap(null));
    return share;
  }
View Full Code Here

TOP

Related Classes of com.ikanow.infinit.e.data_model.api.social.sharing.SharePojoApiMap

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.