Examples of CommunityPojo


Examples of com.ikanow.infinit.e.data_model.store.social.community.CommunityPojo

  public void createSelfCommunity(PersonPojo person)
  {
    try
    {
      //create community
      CommunityPojo selfCommunity = new CommunityPojo();
      selfCommunity.setId(person.get_id()); //set to same as users
      selfCommunity.setName(person.getDisplayName() + "'s Personal Community");
      selfCommunity.setDescription(person.getDisplayName() + "'s Personal Community");
      selfCommunity.setCreated(new Date());
      selfCommunity.setModified(new Date());
      selfCommunity.setIsPersonalCommunity(true);   
      Map<String,CommunityAttributePojo> commAttributes = new HashMap<String,CommunityAttributePojo>();
      commAttributes.put("isPublic", new CommunityAttributePojo("boolean","false") );
      commAttributes.put("usersCanSelfRegister", new CommunityAttributePojo("boolean","false") );
      commAttributes.put("registrationRequiresApproval", new CommunityAttributePojo("boolean","false") );
      commAttributes.put("usersCanCreateSubCommunities", new CommunityAttributePojo("boolean","false") );
      selfCommunity.setCommunityAttributes(commAttributes);
      Map<String,CommunityUserAttributePojo> commUserAttributes = new HashMap<String,CommunityUserAttributePojo>();
      commUserAttributes.put("publishLoginToActivityFeed", new CommunityUserAttributePojo("boolean","true",true));
      commUserAttributes.put("publishCommentsToActivityFeed", new CommunityUserAttributePojo("boolean","true",true));
      commUserAttributes.put("publishSharingToActivityFeed", new CommunityUserAttributePojo("boolean","true",true));
      commUserAttributes.put("publishQueriesToActivityFeed", new CommunityUserAttributePojo("boolean","true",true));
      commUserAttributes.put("publishCommentsPublicly", new CommunityUserAttributePojo("boolean","false",true));
      selfCommunity.setCommunityUserAttribute(commUserAttributes);
      selfCommunity.setNumberOfMembers(0);
     
      // Create the index form of the community:
      try {
        GenericProcessingController.createCommunityDocIndex(selfCommunity.getId().toString(), null, true, false, false);
        //TESTED
      }
      catch (Exception e) {} // Do nothing, will have to update the user to stop bad things from happening on query though
     
      //write community to db
      DbManager.getSocial().getCommunity().insert(selfCommunity.toDb());
      //update user to be in this community
      PersonCommunityPojo pcpSelf = new PersonCommunityPojo(person.get_id(), selfCommunity.getName());
      person.getCommunities().add(pcpSelf);
      /////////////////////////////////////////////////////////////////////////////////////////////////
      // TODO (INF-1214): Make this code more robust to handle changes to the community that need to
      // Caleb: this means change update to $set
      /////////////////////////////////////////////////////////////////////////////////////////////////
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.store.social.community.CommunityPojo

      BasicDBObject query = new BasicDBObject(CustomMapReduceJobPojo._id_,inQuery);
      DBCursor dbc = DbManager.getSocial().getCommunity().find(query);
      while (dbc.hasNext())
      {
        DBObject dbo = dbc.next();       
        CommunityPojo cp = CommunityPojo.fromDb(dbo, CommunityPojo.class);
        //if this is not your self community AND you are not a member THEN you are not in all these communities
        if ( !((cp.getId().toString()).equals(userid)) && !(cp.isMember(new ObjectId(userid))) )
          return false;
      }
    }
    catch(Exception ex)
    {
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.store.social.community.CommunityPojo

    DBCollection communityDb = DbManager.getSocial().getCommunity();
   
    //DB: read/write community object
    ////////////////////////////////////////////////
    //CANONICAL EXAMPLE:
    CommunityPojo cp = CommunityPojo.fromDb(communityDb.findOne(), CommunityPojo.class);
    System.out.println("CP1=" + cp.toDb()); // (converts DBObject to string ie BSON->JSON - should have { $oid } and { $date } objectid/date formats)
    ////////////////////////////////////////////////
    System.out.println("CP2=" + new Gson().toJson(cp)); // (will have complex object id format and string dates)
    //DB: read/write list of community objects
    ////////////////////////////////////////////////
    //CANONICAL EXAMPLE:
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.