Package com.agiletec.plugins.jpaddressbook.aps.system.services.addressbook.model

Examples of com.agiletec.plugins.jpaddressbook.aps.system.services.addressbook.model.IContact


  public void reloadEntitiesReferences(ReloadingEntitiesReferencesEvent event) {
    List<String> entitiesId = this.getAllEntityId();
    for (int i=0; i<entitiesId.size(); i++) {
      String entityId = (String) entitiesId.get(i);
      try {
        IContact entity = this.getContact(entityId);
        if (entity != null) {
          this.getAddressBookDAO().reloadEntitySearchRecords(entityId, entity.getContactInfo());
        }
        ApsSystemUtils.getLogger().info("Reloaded search references for entity " + entityId);
      } catch (Throwable t) {
        ApsSystemUtils.logThrowable(t, this, "reloadEntitySearchReferences", "Error on reloading search references entity : " + entityId);
      }
View Full Code Here


      IUserProfile profile1 = this._helper.createUserProfile(null,
          "name1 surname1", "indirizzoemail1@inesistente.itt", birthdate1, "it");
      Contact contact1 = this._helper.createContact(null, "editorCoach", true, profile1);
      // Aggiunta contatto1
      this._addressBookManager.addContact(contact1);
      IContact added1 = this._addressBookManager.getContact(contact1.getId());
      this.compareContacts(contact1, added1);
      assertNotNull(added1.getId());
      assertNotNull(added1.getContactInfo().getId());
     
      Date birthdate2 = this._helper.setBirthdate(1982, 10, 25);
      IUserProfile profile2 = this._helper.createUserProfile("pippo",
          "name2 surname2", "indirizzoemail2@inesistente.itt", birthdate2, "it");
      Contact contact2 = this._helper.createContact("pippo", "editorCoach", true, profile2);
      // Aggiunta contatto2
      this._addressBookManager.addContact(contact2);
      IContact added2 = this._addressBookManager.getContact(contact2.getId());
      this.compareContacts(contact2, added2);
      assertEquals("pippo", added2.getId());
      assertEquals("pippo", added2.getContactInfo().getId());
      assertEquals("pippo", profile2.getId());
    } catch (Throwable t) {
      throw t;
    } finally {
      this._helper.cleanAddressBook();
View Full Code Here

      IUserProfile profile = this._helper.createUserProfile(null,
          "name surname", "indirizzoemail@inesistente.itt", birthdate, "it");
      Contact contact = this._helper.createContact(null, "editorCoach", true, profile);
      // Aggiunta contatto
      this._addressBookManager.addContact(contact);
      IContact added = this._addressBookManager.getContact(contact.getId());
      this.compareContacts(contact, added);
     
      // Modifica contatto
      Date newBirthdate = this._helper.setBirthdate(1985, 12, 02);
      IUserProfile modifiedProfile = this._helper.createUserProfile(contact.getId(),
          "nameMOD surnameMOD", "indirizzoemailMOD@inesistente.itt", newBirthdate, "en");
      Contact modifiedContact = this._helper.createContact(contact.getId(), contact.getOwner(), false, modifiedProfile);
      this._addressBookManager.updateContact(contact.getOwner(), modifiedContact);
      IContact updated = this._addressBookManager.getContact(contact.getId());
      this.compareContacts(modifiedContact, updated);
     
      // Rimozione contatto
      this._addressBookManager.deleteContact(contact.getOwner(), contact.getId());
      IContact removed = this._addressBookManager.getContact(modifiedContact.getId());
      assertNull(removed);
    } catch (Throwable t) {
      throw t;
    } finally {
      this._helper.cleanAddressBook();
View Full Code Here

    return this.getUserProfileManager().getDefaultProfileType();
  }
 
  @Override
  protected IApsEntity getEntity(String entityId) {
    IContact contact = this.getContact(entityId);
    if (null != contact) {
      return contact.getContactInfo();
    }
    return null;
  }
View Full Code Here

  }
 
  protected String checkDeletingEntity() throws Throwable {
    String checkResult = super.checkDeletingEntity();
    if (null != checkResult) return checkResult;
    IContact contact = this.getAddressBookManager().getContact(this.getEntityId());
    if (!this.getCurrentUser().getUsername().equals(contact.getOwner())) {
      this.addFieldError("contactKey", this.getText("*CONTATTO NON PROPRIETARIO*"));//TODO LABEL DA MODIFICARE
      return INPUT;
    }
    return null;
  }
View Full Code Here

 
  @Override
  public String getVCard(String contactId) throws ApsSystemException {
    String vcard = null;
    try {
      IContact contact = this.getAddressBookManager().getContact(contactId);
      if (null != contact) {
        String vcardMapping = this.getVcardCreator().createVCard(contact, this.getVCardFields());
        StringBuffer vcardBuffer = new StringBuffer(vcardMapping);
        vcard = vcardBuffer.toString();
      }
View Full Code Here

  }
 
  @Override
  public String edit() {
    try {
      IContact contact = this.getAddressBookManager().getContact(this.getEntityId());
      if (null == contact) {
        this.addFieldError("contactKey", this.getText("*CONTATTO NULLO*"));//TODO LABEL DA MODIFICARE
        return INPUT;
      }
      if (!contact.isPublicContact() && !this.getCurrentUser().getUsername().equals(contact.getOwner())) {
        this.addFieldError("contactKey", this.getText("*CONTATTO NON PUBBLICO NON AUTORIZZATO*"));//TODO LABEL DA MODIFICARE
        return INPUT;
      }
      contact.getContactInfo().disableAttributes(JpaddressbookSystemConstants.ATTRIBUTE_DISABLING_CODE_ON_MANAGE_CONTACT);
      this.getRequest().getSession().setAttribute(SESSION_PARAM_NAME_CURRENT_CONTACT, contact);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "edit");
      return FAILURE;
    }
View Full Code Here

  }
 
  @Override
  public String save() {
    try {
      IContact contact = this.getContact();
      if (contact == null) {
        return FAILURE;
      }
      if (null == contact.getId()) {
        this.getAddressBookManager().addContact(contact);
      } else {
        this.getAddressBookManager().updateContact(this.getCurrentUser().getUsername(), contact);
      }
      this.getRequest().getSession().removeAttribute(SESSION_PARAM_NAME_CURRENT_CONTACT);
View Full Code Here

*/
public class ContactActionHelper extends EntityActionHelper {
 
  @Override
  public void updateEntity(IApsEntity currentEntity, HttpServletRequest request) {
    IContact contact = (IContact) request.getSession().getAttribute(IContactAction.SESSION_PARAM_NAME_CURRENT_CONTACT);
    IUserProfile profile = contact.getContactInfo();
    super.updateEntity(profile, request);
  }
View Full Code Here

 
  public void testNew() throws Throwable {
    try {
      String result = this.executeNew("editorCoach");
      assertEquals(Action.SUCCESS, result);
      IContact contact = ((ContactAction) this.getAction()).getContact();
      assertEquals("editorCoach", contact.getOwner());
     
      // Test entryContact
      this.executeEntryContact("editorCoach");
      assertEquals(Action.SUCCESS, result);
      IContact actionContact = ((ContactAction) this.getAction()).getContact();
      this.compareContacts(contact, actionContact);
    } catch (Throwable t) {
      throw t;
    } finally {
      this._helper.cleanAddressBook();
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpaddressbook.aps.system.services.addressbook.model.IContact

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.