Package de.circleofcontacts.server.model

Examples of de.circleofcontacts.server.model.ContactGroup


  public ContactGroup createContactGroup(String userEmail, String label) {
    List<String> ownersList = new LinkedList<String>();
    if (userEmail != null && userEmail.length() > 0)
      ownersList.add(userEmail);
   
    ContactGroup cg = new ContactGroup();
    cg.setLabel(label);
    cg.setDeleted(false);
    cg.setOwners(ownersList);
   
    persistenceManager.makePersistent(cg);
    return cg;
  }
View Full Code Here


   * @param userEmail initial owner for new groups; may be null
   * @return
   */
  public String saveContactGroup(ContactGroupSummaryView contactGroup, String userEmail) {
    if (contactGroup.getIdentifier() == null || contactGroup.getIdentifier().length() == 0) {
      ContactGroup cg = createContactGroup(userEmail, contactGroup.getLabel());
      return KeyFactory.keyToString(cg.getGroupId()); // o je, ist noch null
    } else {
      ContactGroup group = getContactGroup(contactGroup.getIdentifier());
      group.setLabel(contactGroup.getLabel());
      persistenceManager.makePersistent(group);
      return contactGroup.getIdentifier();
    }
  }
View Full Code Here

  /**
   * Marks a contact group as deleted.
   * @param groupId group ID
   */
  public void deleteContactGroup(String groupId) {
    ContactGroup group = getContactGroup(groupId);
    group.setDeleted(true);
    persistenceManager.makePersistent(group);
  }
View Full Code Here

   * @param groupId contact group ID
   * @return contact summary view objects
   */
    @SuppressWarnings("unchecked")
  public List<ContactSummaryView> getContactViewsByGroup(String groupId) {
      ContactGroup cg = getContactGroup(groupId);

      List<ContactSummaryView> result = new ArrayList<ContactSummaryView>();
      Query q = persistenceManager.newQuery(Contact.class);
      q.setFilter("groups.contains(:groupId)");
      q.setResult("mainContactId, firstName, lastName, title, suffix, gender");
      Collection<Object[]> summaries = (Collection<Object[]>)q.execute(cg.getGroupId());
     
      for (Object[] summary : summaries) {
        ContactSummaryView co = new ContactSummaryView();
        co.setIdentifier(KeyFactory.keyToString((Key)summary[0]));
        co.setFirstName((String)summary[1]);
View Full Code Here

   * Loads both the contact and the group.
   * @param contactId contact ID
   * @param groupId group ID
   */
  public void addContactToGroup(String contactId, String groupId) {
    ContactGroup contactGroup = getContactGroup(groupId);
    Contact contact = (Contact)persistenceManager.getObjectById(Contact.class, KeyFactory.stringToKey(contactId));
    addContactToGroup(contact, contactGroup);
  }
View Full Code Here

   * Removes the given contact from the given group.
   * @param contactId contact ID
   * @param groupId group ID
   */
  public void removeContactFromGroup(String contactId, String groupId) {
    ContactGroup contactGroup = getContactGroup(groupId);
    Contact contact = getContact(contactId);
    removeContactFromGroup(contact, contactGroup);
  }
View Full Code Here

TOP

Related Classes of de.circleofcontacts.server.model.ContactGroup

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.