Package com.cubusmail.gwtui.domain

Examples of com.cubusmail.gwtui.domain.UserAccount


  @Before
  public void initDB() {

    this.userAccountDao = (UserAccountDao) this.context.getBean( "userAccountDao" );
    UserAccount userAccount = (UserAccount) this.context.getBean( "testUserAccount" );

    this.userAccountDao.saveUserAccount( userAccount );
  }
View Full Code Here


   * Compare test user account with the persistent one.
   */
  @Test
  public void testGetUserAccountByUsername() {

    UserAccount userAccount = (UserAccount) this.context.getBean( "testUserAccount" );
    UserAccount savedUserAccount = this.userAccountDao.getUserAccountByUsername( userAccount.getUsername() );
    Assert.assertNotNull( savedUserAccount );

    List<ContactFolder> contactFolders = this.userAccountDao.retrieveContactFolders( userAccount );

    Assert.assertNotNull( contactFolders );
View Full Code Here

   * Test moveContacts().
   */
  // @Test
  public void testMoveContacts() {

    UserAccount userAccount = (UserAccount) this.context.getBean( "testUserAccount" );
    UserAccount savedUserAccount = this.userAccountDao.getUserAccountByUsername( userAccount.getUsername() );
    Assert.assertNotNull( savedUserAccount );
    List<ContactFolder> contactFolders = this.userAccountDao.retrieveContactFolders( userAccount );

    ContactFolder targetFolder = contactFolders.get( 0 );
    ContactFolder sourceFolder = contactFolders.get( 1 );
View Full Code Here

  /**
   *
   */
  private void postValidateChanges() {

    UserAccount oldAccount = GWTSessionManager.get().getUserAccount();

    boolean reload = !oldAccount.getPreferences().getLanguage().equals(
        this.userAccountCopy.getPreferences().getLanguage() )
        || (oldAccount.getPreferences().getReadingPane() != this.userAccountCopy.getPreferences()
            .getReadingPane());

    if ( reload ) {
      MessageBox.alert( TextProvider.get().dialog_preferences_header(), TextProvider.get()
          .dialog_preferences_alert(), new MessageBox.AlertCallback() {
View Full Code Here

  /**
   *
   */
  private void executeChanges() {

    UserAccount oldAccount = GWTSessionManager.get().getUserAccount();

    if ( !this.userAccountCopy.getPreferences().getTheme().equals( oldAccount.getPreferences().getTheme() ) ) {
      CSS.swapStyleSheet( "theme", this.userAccountCopy.getPreferences().getTheme() );
    }

    GWTSessionManager.get().setUserAccount( this.userAccountCopy );
    EventBroker.get().firePreferencesChanged( this.userAccountCopy.getPreferences() );
View Full Code Here

      // if no exception thrown, login was successful
      SessionManager.createSession( context.getSubject() );

      IMailbox mailbox = SessionManager.get().getMailbox();

      UserAccount account = getUserAccountDao().getUserAccountByUsername( username );
      // create useraccount
      if ( account == null ) {
        account = createUserAccount( mailbox );
        if ( getThreadLocalRequest().getLocale() != null ) {
          String lang = getThreadLocalRequest().getLocale().getLanguage();
          account.getPreferences().setLanguage( lang );
        }
      }
      else {
        if ( account.getIdentities() == null || account.getIdentities().size() == 0 ) {
          account.addIdentity( createDefaultIdentity( mailbox ) );
        }
        account.setLastLogin( new Date() );
      }
      getUserAccountDao().saveUserAccount( account );
      mailbox.setUserAccount( account );

      GWTMailbox gwtMailbox = ConvertUtil.convert( mailbox );
View Full Code Here

   * @param account
   * @param mailbox
   */
  private UserAccount createUserAccount( IMailbox mailbox ) {

    UserAccount account = (UserAccount) BeanFactory.getBean( "userAccount" );
    account.setUsername( mailbox.getUserName() );
    account.setCreated( new Date() );
    account.setLastLogin( new Date() );

    // check Identities
    Identity defaultIdentity = createDefaultIdentity( mailbox );
    account.addIdentity( defaultIdentity );

    ContactFolder folder = new ContactFolder( ContactFolderType.STANDARD );
    folder.setFolderName( "Standard" );
    folder.setUserAccount( account );
    account.addContactFolder( folder );

    folder = new ContactFolder( ContactFolderType.RECIPIENTS );
    folder.setFolderName( "Recipients" );
    folder.setUserAccount( account );
    account.addContactFolder( folder );

    return account;
  }
View Full Code Here

  private UserAccountDao userAccountDao;

  public void testWriteRead() {

    UserAccount account = this.userAccountDao.getUserAccountByUsername( "schlierf3" );
    account.setCreated( new Date() );
    account.setLastLogin( new Date() );
    account.setUsername( "schlierf3" );

    Identity identity = new Identity();
    identity.setDisplayName( "Juergen Schlierf" );
    identity.setEmail( "test@test.de" );
    account.addIdentity( identity );

    Long id = this.userAccountDao.saveUserAccount( account );
    assertNotNull( id );
    assertTrue( id.intValue() > 0 );

    UserAccount readAccount = this.userAccountDao.getUserAccountByUsername( "schlierf3" );
    assertNotNull( readAccount );
    assertEquals( "schlierf3", readAccount.getUsername() );
  }
View Full Code Here

   * @param id
   * @return
   */
  public UserAccount getUserAccountById( Integer id ) {

    UserAccount account = (UserAccount) getHibernateTemplate().get( UserAccount.class, id );
    prepareAccount( account );
    return account;
  }
View Full Code Here

    List<UserAccount> list = getHibernateTemplate().find( "from UserAccount u where u.username = ?", username );
    if ( list.size() == 0 ) {
      return null;
    }
    else if ( list.size() == 1 ) {
      UserAccount account = list.get( 0 );
      if ( account.getPreferences() == null ) {
        account.setPreferences( (Preferences) this.applicationContext.getBean( BeanIds.PREFERENCES_BEAN ) );
      }
      if ( !StringUtils.isEmpty( account.getPreferencesJson() ) ) {
        json2Preferences( account.getPreferencesJson(), account.getPreferences() );
      }
      prepareAccount( account );
      return account;
    }
    else {
View Full Code Here

TOP

Related Classes of com.cubusmail.gwtui.domain.UserAccount

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.