Examples of PersonPojo


Examples of com.ikanow.infinit.e.data_model.store.social.person.PersonPojo

        CommunityPojo cp = CommunityPojo.fromDb(dboComm, CommunityPojo.class);
        if ( !cp.getIsPersonalCommunity() )
        {
          BasicDBObject queryPerson = new BasicDBObject("_id",new ObjectId(personIdStr));
          DBObject dboPerson = DbManager.getSocial().getPerson().findOne(queryPerson);
          PersonPojo pp = PersonPojo.fromDb(dboPerson,PersonPojo.class);
          boolean isPending = isMemberPending(cp, pp);
         
          if ( !cp.isMember(new ObjectId(personIdStr)) || isPending )
          {
            Map<String,CommunityAttributePojo> commatt = cp.getCommunityAttributes();
            if ( isSysAdmin || (commatt.containsKey("usersCanSelfRegister") && commatt.get("usersCanSelfRegister").getValue().equals("true") ))
            {   
              boolean requiresApproval = false;
              if ( !isSysAdmin && commatt.containsKey("registrationRequiresApproval") )
                requiresApproval = commatt.get("registrationRequiresApproval").getValue().equals("true");
              //if approval is required, add user to comm, wait for owner to approve
              //otherwise go ahead and add as a member
              if ( requiresApproval )
              {
                cp.addMember(pp,true);
                //write both objects back to db now
                /////////////////////////////////////////////////////////////////////////////////////////////////
                // TODO (INF-1214): Make this code more robust to handle changes to the community that need to
                // Caleb: this means change update to $set
                /////////////////////////////////////////////////////////////////////////////////////////////////
                DbManager.getSocial().getCommunity().update(query, cp.toDb());
                             
                //send email out to owner for approval
                CommunityApprovePojo cap = cp.createCommunityApprove(personIdStr,communityIdStr,"join",personIdStr);
                DbManager.getSocial().getCommunityApprove().insert(cap.toDb());
               
                // Get to addresses for Owner and Moderators
                String toAddresses = getToAddressesFromCommunity(cp);
               
                PropertiesManager propManager = new PropertiesManager();
                String rootUrl = propManager.getUrlRoot();
               
                String subject = pp.getDisplayName() + " is trying to join infinit.e community: " + cp.getName();
                String body = pp.getDisplayName() + " is trying to join infinit.e community: " + cp.getName() + "<br/>Do you want to accept this request?" +
                "<br/><a href=\"" + rootUrl + "social/community/requestresponse/"+cap.get_id().toString() + "/true\">Accept</a> " +
                "<a href=\"" + rootUrl + "social/community/requestresponse/"+cap.get_id().toString() + "/false\">Deny</a>";
               
                SendMail mail = new SendMail(new PropertiesManager().getAdminEmailAddress(), toAddresses, subject, body);
               
                if (mail.send("text/html"))
                {
                  rp.setResponse(new ResponseObject("Join Community",true,"Joined community successfully, awaiting owner approval"));
                  rp.setData(new CommunityApprovalPojo(false));
                }
                else
                {
                  rp.setResponse(new ResponseObject("Join Community",false,"The system was uable to send an email to the owner"));               
                }
              }
              else
              {
                cp.addMember(pp);
                pp.addCommunity(cp);
                //write both objects back to db now
                /////////////////////////////////////////////////////////////////////////////////////////////////
                // TODO (INF-1214): Make this code more robust to handle changes to the community that need to
                // Caleb: this means change update to $set
                /////////////////////////////////////////////////////////////////////////////////////////////////
                DbManager.getSocial().getCommunity().update(query, cp.toDb());
                DbManager.getSocial().getPerson().update(queryPerson, pp.toDb());
                rp.setResponse(new ResponseObject("Join Community",true,"Joined community successfully"));
                rp.setData(new CommunityApprovalPojo(true));
              }           
            }
            else
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.store.social.person.PersonPojo

        CommunityPojo cp = CommunityPojo.fromDb(dboComm, CommunityPojo.class);
        if ( !cp.getIsPersonalCommunity())
        {
          BasicDBObject queryPerson = new BasicDBObject("_id",new ObjectId(personIdStr));
          DBObject dboPerson = DbManager.getSocial().getPerson().findOne(queryPerson);
          PersonPojo pp = PersonPojo.fromDb(dboPerson,PersonPojo.class);
          cp.removeMember(new ObjectId(personIdStr));
          pp.removeCommunity(cp);         
          //write both objects back to db now
          /////////////////////////////////////////////////////////////////////////////////////////////////
          // TODO (INF-1214): Make this code more robust to handle changes to the community that need to
          // Caleb: this means change update to $set
          /////////////////////////////////////////////////////////////////////////////////////////////////
          DbManager.getSocial().getCommunity().update(query, cp.toDb());
          DbManager.getSocial().getPerson().update(queryPerson, pp.toDb());
          rp.setResponse(new ResponseObject("Leave Community",true,"Left community successfully"));
        }
        else
        {
          rp.setResponse(new ResponseObject("Leave Community",false,"Cannot leave personal community"));
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.store.social.person.PersonPojo

            }
            // OK from here on, personId is the object Id...
           
            if ( dboPerson != null )
            {
              PersonPojo pp = PersonPojo.fromDb(dboPerson,PersonPojo.class);             
              //need to check for if a person is pending, and skipInvite and isSysAdmin, otherwise
              //they would just get sent an email again, so leave it be
              boolean isPending = false;
              if ( isSysAdmin && skipInvite )
              {
                isPending = isMemberPending(cp, pp);
              }
             
              if ( selfRegister )
              {
                //If the comm allows for self registering, just call join community
                //instead of invite, it will handle registration
                return this.joinCommunity(pp.get_id().toString(), communityIdStr, isSysAdmin);
              }
              else if ( !cp.isMember(pp.get_id()) || isPending )
              {
                if (isSysAdmin && skipInvite) // Can only skip invite if user is Admin
                {
                  // Update community with new member
                  cp.addMember(pp, false); // Member status set to Active
                  cp.setNumberOfMembers(cp.getNumberOfMembers() + 1); // Increment number of members
                  /////////////////////////////////////////////////////////////////////////////////////////////////
                  // TODO (INF-1214): Make this code more robust to handle changes to the community that need to
                  // Caleb: this means change update to $set
                  /////////////////////////////////////////////////////////////////////////////////////////////////
                  DbManager.getSocial().getCommunity().update(query, cp.toDb());
                 
                  // Add community to persons object and save to db
                  pp.addCommunity(cp);
                  /////////////////////////////////////////////////////////////////////////////////////////////////
                  // TODO (INF-1214): Make this code more robust to handle changes to the community that need to
                  // Caleb: this means change update to $set
                  /////////////////////////////////////////////////////////////////////////////////////////////////
                  DbManager.getSocial().getPerson().update(new BasicDBObject("_id", pp.get_id()), pp.toDb());
                 
                  rp.setResponse(new ResponseObject("Invite Community",true,"User added to community successfully."));
                }
                else
                {
                  cp.addMember(pp, true); // Member status set to Pending
                  /////////////////////////////////////////////////////////////////////////////////////////////////
                  // TODO (INF-1214): Make this code more robust to handle changes to the community that need to
                  // Caleb: this means change update to $set
                  /////////////////////////////////////////////////////////////////////////////////////////////////
                  DbManager.getSocial().getCommunity().update(query, cp.toDb());
                 
                  //send email out inviting user
                  CommunityApprovePojo cap = cp.createCommunityApprove(personIdStr,communityIdStr,"invite",userIdStr);
                  DbManager.getSocial().getCommunityApprove().insert(cap.toDb());
                 
                  PropertiesManager propManager = new PropertiesManager();
                  String rootUrl = propManager.getUrlRoot();
                 
                  if (null == rootUrl) {
                    rp.setResponse(new ResponseObject("Invite Community",false,"The system was unable to email the invite because an invite was required and root.url is not set up."));
                    return rp;
                  }
                 
                  String subject = "Invite to join infinit.e community: " + cp.getName();
                  String body = "You have been invited to join the community " + cp.getName() +
                    "<br/><a href=\"" + rootUrl + "social/community/requestresponse/"+cap.get_id().toString() + "/true\">Accept</a> " +
                    "<a href=\"" + rootUrl + "social/community/requestresponse/"+cap.get_id().toString() + "/false\">Deny</a>";
                 
                  SendMail mail = new SendMail(new PropertiesManager().getAdminEmailAddress(), pp.getEmail(), subject, body);
                 
                  if (mail.send("text/html"))
                  {
                    if (isSysAdmin) {
                      rp.setResponse(new ResponseObject("Invite Community",true,"Invited user to community successfully: " + cap.get_id().toString()));
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.store.social.person.PersonPojo

            DBObject dboComm = DbManager.getSocial().getCommunity().findOne(query);
           
            //get user
            BasicDBObject queryPerson = new BasicDBObject("_id",new ObjectId(cap.getPersonId()));
            DBObject dboperson = DbManager.getSocial().getPerson().findOne(queryPerson);
            PersonPojo pp = PersonPojo.fromDb(dboperson, PersonPojo.class);
           
            if ( dboComm != null )
            {
              CommunityPojo cp = CommunityPojo.fromDb(dboComm, CommunityPojo.class);
              boolean isStillPending = isMemberPending(cp, pp);
              //make sure the user is still waiting to join the community, otherwise remove this request and return
              if ( isStillPending )
              {
                if ( resp.equals("false"))
                {
                  //if response is false (deny), always just remove user from community             
                  cp.removeMember(new ObjectId(cap.getPersonId()));
                  /////////////////////////////////////////////////////////////////////////////////////////////////
                  // TODO (INF-1214): Make this code more robust to handle changes to the community that need to
                  // Caleb: this means change update to $set
                  /////////////////////////////////////////////////////////////////////////////////////////////////
                  DbManager.getSocial().getCommunity().update(query, cp.toDb());
                }
                else
                {
                  //if response is true (allow), always just add community info to user, and change status to active
                 
                  if ( dboperson != null)
                  {
                    cp.updateMemberStatus(cap.getPersonId(), "active");
                    cp.setNumberOfMembers(cp.getNumberOfMembers()+1);
                    /////////////////////////////////////////////////////////////////////////////////////////////////
                    // TODO (INF-1214): Make this code more robust to handle changes to the community that need to
                    // Caleb: this means change update to $set
                    /////////////////////////////////////////////////////////////////////////////////////////////////
                    DbManager.getSocial().getCommunity().update(query, cp.toDb());
                    pp.addCommunity(cp);
                    /////////////////////////////////////////////////////////////////////////////////////////////////
                    // TODO (INF-1214): Make this code more robust to handle changes to the community that need to
                    // Caleb: this means change update to $set
                    /////////////////////////////////////////////////////////////////////////////////////////////////
                    DbManager.getSocial().getPerson().update(queryPerson, pp.toDb());
                  }
                  else
                  {
                    rp.setResponse(new ResponseObject("Request Response",false,"The person does not exist."));
                  }
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.store.social.person.PersonPojo

            // Get Person data to added to member record
            BasicDBObject query2 = new BasicDBObject();
            query2.put("_id", new ObjectId(personIdStr));
            DBObject dbo2 = DbManager.getSocial().getPerson().findOne(query2);
            PersonPojo p = PersonPojo.fromDb(dbo2, PersonPojo.class);

            if (p.getContacts() != null)
            {
              // Set contacts from person record
              Set<CommunityMemberContactPojo> contacts = new HashSet<CommunityMemberContactPojo>();
              Map<String, PersonContactPojo> pcp = p.getContacts();
              Iterator<Map.Entry<String, PersonContactPojo>> it2 = pcp.entrySet().iterator();
              while (it2.hasNext())
              {
                CommunityMemberContactPojo c = new CommunityMemberContactPojo();
                Map.Entry<String, PersonContactPojo> pair = it2.next();
                c.setType(pair.getKey().toString());
                PersonContactPojo v = (PersonContactPojo)pair.getValue();
                c.setValue(v.getValue());
                contacts.add(c);
              }
              cmp.setContacts(contacts);
            }

            // Set links from person record
            if (p.getLinks() != null)
            {
              // Set contacts from person record
              Set<CommunityMemberLinkPojo> links = new HashSet<CommunityMemberLinkPojo>();
              Map<String, PersonLinkPojo> plp = p.getLinks();
              Iterator<Map.Entry<String, PersonLinkPojo>> it3 = plp.entrySet().iterator();
              while (it.hasNext())
              {
                CommunityMemberLinkPojo c = new CommunityMemberLinkPojo();
                Map.Entry<String, PersonLinkPojo> pair = it3.next();
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.store.social.person.PersonPojo

    {
      DBObject dbo = DbManager.getSocial().getPerson().findOne(new BasicDBObject(CustomMapReduceJobPojo._id_,
                                    new ObjectId(userid)));
      if (dbo != null )
      {
        PersonPojo pp = PersonPojo.fromDb(dbo, PersonPojo.class);
        HashSet<ObjectId> communities = new HashSet<ObjectId>();
        for ( PersonCommunityPojo pcp : pp.getCommunities())
          communities.add(pcp.get_id());
        BasicDBObject commquery = new BasicDBObject(
            CustomMapReduceJobPojo.communityIds_, new BasicDBObject(MongoDbManager.in_,communities));
        if (null != jobIdOrTitle) {
          try {
View Full Code Here

Examples of com.ikanow.infinit.e.data_model.store.social.person.PersonPojo

    //_driver = new InfiniteDriver("http://localhost:8184/");
    //_driver = new InfiniteDriver("http://URL/api/", "APIKEY");
   
    _driver.useExistingCookie(_cookie);
    ResponseObject response = new ResponseObject();
    PersonPojo me = _driver.getPerson(null, response);
    if (!response.isSuccess() || (null == me)) {
      return returnError("Cookie Lookup", "Cookie session expired or never existed, please login first or use valid key or user/pass");     
    }
   
    // OK some basic access controls:
    // 1] if it's an admin command then must be nodes:
    if (null == _indexCommand) { // 1]
      if (!_indexOrAdminCommand.equals("_nodes")) {
        return returnError("Record", "Admin command error - " + _proxyUrl);       
      }
    }//TESTED (1)
    else { // Indexes specified, need to check vs person's communities (2-5)
     
      // Mode: stashed/live (/neither)
      String mode = this._queryOptions.get("mode");
      if (null != mode) {
        if (!mode.equalsIgnoreCase("live") && !mode.equalsIgnoreCase("stashed")) { // only allowed values
          mode = null;
        }
      }
     
      // Do we have a community override set?
      String commIdStrList = this._queryOptions.get("cids");
      HashSet<String> commIdOverrideSet = null;
      HashSet<String> dashboardOnly_fullCommunitySet = null;
      if (null != commIdStrList) {
        String[] commIdStrArray = commIdStrList.split("\\s*,\\s*");
        if ((commIdStrArray.length > 1) || !commIdStrArray[0].isEmpty()) {
          commIdOverrideSet = new HashSet<String>(Arrays.asList(commIdStrArray));
          if (commIdOverrideSet.isEmpty()) { // not specified - all communities
            commIdOverrideSet = null;
          }
        }
      }
      // Complication: for viewing dashboards, not allowed to ignore while adding new dashboard
      // (for any other type, the CIDs aren't present)
     
      boolean isDashboard = _indexOrAdminCommand.equals("kibana-int") && (null != mode);
      if (!isDashboard) { // dashboard specific processing
        if (null != commIdOverrideSet) {
          String applyCommFilter = this._queryOptions.get("commFilter");
          if ((null != applyCommFilter) && (applyCommFilter.equals("0") || applyCommFilter.equalsIgnoreCase("false"))) {
            commIdOverrideSet = null;
          }
        }
       
      }//TESTED (by hand)
      else if (null != commIdOverrideSet) { // dashboard-specific processing
        String applyCommFilter = this._queryOptions.get("commFilter");
        if ((null != applyCommFilter) && (applyCommFilter.equals("0") || applyCommFilter.equalsIgnoreCase("false"))) {
          dashboardOnly_fullCommunitySet = new HashSet<String>();
        }       
      }//TESTED (by hand)

      // Which stores are we examining
      boolean showRecords = true;
      boolean showCustom = false;
      boolean showDocs = false; // (this one is a bit more complex)     
      String showRecordsVal = this._queryOptions.get("records");
      if ((null != showRecordsVal) && (showRecordsVal.equals("0") || showRecordsVal.equalsIgnoreCase("false"))) {
        showRecords = false;
      }
      String showCustomVal = this._queryOptions.get("custom");
      if ((null != showCustomVal) && (showCustomVal.equals("1") || showCustomVal.equalsIgnoreCase("true"))) {
        showCustom = true;
      }
      String showDocsVal = this._queryOptions.get("docs");
      if ((null != showDocsVal) && (showDocsVal.equals("1") || showDocsVal.equalsIgnoreCase("true"))) {
        showDocs = true;
      }
      if (!showRecords && !showCustom && !showDocs) {
        return returnError("Record", "Command error - must show at least one of records, custom, docs");                     
      }
      //(TESTED: records, custom)
     
      communityIds = new HashSet<String>();
      for (PersonCommunityPojo myComm: me.getCommunities()) {
        String commIdStr =  myComm.get_id().toString();
        if (null != commIdOverrideSet) {
          if (commIdOverrideSet.contains(commIdStr)) { // community override but included
            communityIds.add(commIdStr);           
          }
View Full Code Here

Examples of org.wicketstuff.rest.domain.PersonPojo

    }

    @Test
    public void testCreatePerson()
    {
  String jsonObj = gson.toJson(new PersonPojo("James Smith",
    "james@smith.com", "changeit"));

  mockRequest.setTextAsRequestBody(jsonObj);

  tester.setRequest(mockRequest);
View Full Code Here

Examples of org.wicketstuff.rest.domain.PersonPojo

    }

    @Test
    public void testValidatorBundle()
    {
  String jsonObj = gson.toJson(new PersonPojo("James Smith",
    "notValidMail", "changeit"));

  mockRequest.setTextAsRequestBody(jsonObj);

  tester.setRequest(mockRequest);
View Full Code Here

Examples of org.wicketstuff.rest.domain.PersonPojo

    private final List<PersonPojo> persons = new ArrayList<PersonPojo>();

    public PersonsRestResource() {
  super(new JsonWebSerialDeserial(new GsonObjectSerialDeserial()));
 
        persons.add(new PersonPojo("Freddie Mercury", "fmercury@queen.com", "Eeehooo!"));
        persons.add(new PersonPojo("John Deacon", "jdeacon@queen.com", "bass"));
        persons.add(new PersonPojo("Brian May", "bmay@queen.com", "guitar"));
        persons.add(new PersonPojo("Roger Taylor", "rtaylor@queen.com", "drum"));
    }
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.