Package com.ikanow.infinit.e.data_model.store.social.community

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


    {
      // Email address or addresses to send to
      // Extract email addresses for owners and moderators from list of community members
      StringBuffer sendTo = new StringBuffer();
      Set<CommunityMemberPojo> members = c.getMembers();
      CommunityMemberPojo owner = null;
      for (CommunityMemberPojo member : members)
      {
        if (member.getUserType().equalsIgnoreCase("owner") || member.getUserType().equalsIgnoreCase("moderator"))
        {
          owner = member;
          if (sendTo.length() > 0) sendTo.append(";");
          sendTo.append(member.getEmail());
        }
      }
      if (0 == sendTo.length()) {
        throw new RuntimeException("community " + c.getName() + " / " + c.getId() + " has no owner/moderator");
      }
     
      //create a community request and post to db
      CommunityApprovePojo cap = new CommunityApprovePojo();
      cap.set_id(new ObjectId());
      cap.setCommunityId( c.getId().toString() );
      cap.setIssueDate(new Date());
      cap.setPersonId(owner.get_id().toString());
      cap.setRequesterId(p.get_id().toString());
      cap.setType("source");
      cap.setSourceId(source.getId().toString());
      DbManager.getSocial().getCommunityApprove().insert(cap.toDb());   
     
View Full Code Here


              community.setOwnerId(new ObjectId(personIdStr));
              community.setOwnerDisplayName(displayName);
            }

            // Create the new member object
            CommunityMemberPojo cmp = new CommunityMemberPojo();
            cmp.set_id(new ObjectId(personIdStr));
            cmp.setEmail(email);
            cmp.setDisplayName(displayName);
            cmp.setUserStatus(userStatus);
            cmp.setUserType(userType);

            // Set the userAttributes based on default
            Set<CommunityMemberUserAttributePojo> cmua = new HashSet<CommunityMemberUserAttributePojo>();
            Map<String,CommunityUserAttributePojo> cua = community.getCommunityUserAttribute();

            Iterator<Map.Entry<String,CommunityUserAttributePojo>> it = cua.entrySet().iterator();
            while (it.hasNext())
            {
              CommunityMemberUserAttributePojo c = new CommunityMemberUserAttributePojo();
              Map.Entry<String,CommunityUserAttributePojo> pair = it.next();
              c.setType(pair.getKey().toString());
              CommunityUserAttributePojo v = (CommunityUserAttributePojo)pair.getValue();
              c.setValue(v.getDefaultValue());
              cmua.add(c);
            }
            cmp.setUserAttributes(cmua);

            // 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();
                c.setTitle(pair.getKey().toString());
                PersonLinkPojo v = (PersonLinkPojo)pair.getValue();
                c.setUrl(v.getUrl());
                links.add(c);
              }
              cmp.setLinks(links);
            }

            // Add new member object to the set
            cmps.add(cmp);
View Full Code Here

          CommunityPojo community = CommunityPojo.fromDb(dbo, CommunityPojo.class);

          Boolean isMember = false;

          Set<CommunityMemberPojo> cmps = null;
          CommunityMemberPojo cmp = null;
          if (community.getMembers() != null)
          {
            cmps = community.getMembers();
            for (CommunityMemberPojo c : cmps)
            {
View Full Code Here

    //TESTED
   
    // Remove from all (other) communities
    try {
      BasicDBObject query = new BasicDBObject("members._id", pp.get_id());
      CommunityMemberPojo cmp = new CommunityMemberPojo();
      cmp.set_id(pp.get_id());
      BasicDBObject actions = new BasicDBObject();
      actions.put("$pull", new BasicDBObject("members", new BasicDBObject("_id", pp.get_id())));
        // ie for communities for which he's a member...remove...any elements of the list members...with his _id
      actions.put("$inc", new BasicDBObject("numberOfMembers", -1));
        // ie decrement number of members
View Full Code Here

TOP

Related Classes of com.ikanow.infinit.e.data_model.store.social.community.CommunityMemberPojo

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.