Package ch.tatool.app.data

Examples of ch.tatool.app.data.UserAccountImpl


    /**
     * Get a list of all available modules.
     */
    @SuppressWarnings("unchecked")
    public Set<Module.Info> getModules(UserAccount account) {
        final UserAccountImpl accountImpl = (UserAccountImpl) account;
        return (Set<Module.Info>) accountImpl.getTransactionTemplate().execute(
            new TransactionCallback<Object>() {
                public Object doInTransaction(TransactionStatus status) {
                    return accountImpl.getModuleDAO().getModules(accountImpl);
                }
            }
        );
    }
View Full Code Here


     * @param properties the properties to use for the module. These will overwrite properties set in the
     *        configuration
     * @param configuration module configuration, such as the element tree and session scheduler
     */
    public Module createModule(UserAccount account, Map<String, String> moduleProperties, Map<String, byte[]> binaryModuleProperties, Map<String, DataExporter> moduleExporters) {
        final UserAccountImpl accountImpl = (UserAccountImpl) account;
       
        // add the properties and save the object
        final ModuleImpl module = new ModuleImpl();
        module.setAccount(accountImpl);
        module.setAccountId(accountImpl.getId());
        if (moduleProperties != null) {
          module.setModuleProperties(moduleProperties);
        }
      if (binaryModuleProperties != null) {
        module.setBinaryModuleProperties(binaryModuleProperties);
      }
      if (moduleExporters != null) {
        module.setModuleExporters(moduleExporters);
      }
       
        // set the module name
      String moduleName = moduleProperties.get(Module.PROPERTY_MODULE_NAME);
      if (moduleName == null) {
        logger.warn("No module name defined.");
          moduleName = "Module " + System.currentTimeMillis();
          module.getModuleProperties().put(Module.PROPERTY_MODULE_NAME, moduleName);       
      }
      module.setName(moduleName);
       
        // save the module
        accountImpl.getTransactionTemplate().execute(
            new TransactionCallbackWithoutResult() {
                public void doInTransactionWithoutResult(TransactionStatus status) {
                    // save the module object
                    accountImpl.getModuleDAO().saveModule(module);
                }
            }
        );
       
        // initialize
View Full Code Here

    /**
     * Get a list of all available modules.
     */
    @SuppressWarnings("unchecked")
    public Set<Module.Info> getModules(UserAccount account) {
        final UserAccountImpl accountImpl = (UserAccountImpl) account;
        return (Set<Module.Info>) accountImpl.getTransactionTemplate().execute(
            new TransactionCallback<Object>() {
                public Object doInTransaction(TransactionStatus status) {
                    return accountImpl.getModuleDAO().getModules(accountImpl);
                }
            }
        );
    }
View Full Code Here

     * @param properties the properties to use for the module. These will overwrite properties set in the
     *        configuration
     * @param configuration module configuration, such as the element tree and session scheduler
     */
    public Module createModule(UserAccount account, Map<String, String> moduleProperties, Map<String, byte[]> binaryModuleProperties, Map<String, DataExporter> moduleExporters) {
        final UserAccountImpl accountImpl = (UserAccountImpl) account;
       
        // add the properties and save the object
        final ModuleImpl module = new ModuleImpl();
        module.setAccount(accountImpl);
        module.setAccountId(accountImpl.getId());
        if (moduleProperties != null) {
          module.setModuleProperties(moduleProperties);
        }
      if (binaryModuleProperties != null) {
        module.setBinaryModuleProperties(binaryModuleProperties);
      }
      if (moduleExporters != null) {
        module.setModuleExporters(moduleExporters);
      }
       
        // set the module name
      String moduleName = moduleProperties.get(Module.PROPERTY_MODULE_NAME);
      if (moduleName == null) {
        logger.warn("No module name defined.");
          moduleName = "Module " + System.currentTimeMillis();
          module.getModuleProperties().put(Module.PROPERTY_MODULE_NAME, moduleName);       
      }
      module.setName(moduleName);
       
        // save the module
        accountImpl.getTransactionTemplate().execute(
            new TransactionCallbackWithoutResult() {
                public void doInTransactionWithoutResult(TransactionStatus status) {
                    // save the module object
                    accountImpl.getModuleDAO().saveModule(module);
                }
            }
        );
       
        // initialize
View Full Code Here

    /**
     * Get a list of all available modules.
     */
    @SuppressWarnings("unchecked")
    public Set<Module.Info> getModules(UserAccount account) {
        final UserAccountImpl accountImpl = (UserAccountImpl) account;
        return (Set<Module.Info>) accountImpl.getTransactionTemplate().execute(
            new TransactionCallback() {
                public Object doInTransaction(TransactionStatus status) {
                    return accountImpl.getModuleDAO().getModules(accountImpl);
                }
            }
        );
    }
View Full Code Here

     * @param properties the properties to use for the module. These will overwrite properties set in the
     *        configuration
     * @param configuration module configuration, such as the element tree and session scheduler
     */
    public Module createModule(UserAccount account, Map<String, String> moduleProperties, Map<String, byte[]> binaryModuleProperties, Map<String, DataExporter> moduleExporters) {
        final UserAccountImpl accountImpl = (UserAccountImpl) account;
       
        // add the properties and save the object
        final ModuleImpl module = new ModuleImpl();
        module.setAccount(accountImpl);
        module.setAccountId(accountImpl.getId());
        if (moduleProperties != null) {
          module.setModuleProperties(moduleProperties);
        }
      if (binaryModuleProperties != null) {
        module.setBinaryModuleProperties(binaryModuleProperties);
      }
      if (moduleExporters != null) {
        module.setModuleExporters(moduleExporters);
      }
       
        // set the module name
      String moduleName = moduleProperties.get(Module.PROPERTY_MODULE_NAME);
      if (moduleName == null) {
        logger.warn("No module name defined.");
          moduleName = "Module " + System.currentTimeMillis();
          module.getModuleProperties().put(Module.PROPERTY_MODULE_NAME, moduleName);       
      }
      module.setName(moduleName);
       
        // save the module
        accountImpl.getTransactionTemplate().execute(
            new TransactionCallbackWithoutResult() {
                public void doInTransactionWithoutResult(TransactionStatus status) {
                    // save the module object
                    accountImpl.getModuleDAO().saveModule(module);
                }
            }
        );
       
        // initialize
View Full Code Here

      accountProperties.add("PROPERTY_VALUE");
      accountPropertiesSize = accountProperties.size();  
    }
   
    private String[] getBaseProperties(Module module) {
      UserAccountImpl account = (UserAccountImpl) module.getUserAccount();
      // account related
      String[] baseProps = new String[4];
      baseProps[0] = account.getId() + "";
      baseProps[1] = account.getName();
      baseProps[2] = account.getPassword();
      baseProps[3] = account.getFolder().toString();
      return baseProps;
    }
View Full Code Here

        info.setFolder(folder);
        info.setName(accountName);
        info.setPasswordProtected(password != null && password.length() > 0);
       
        // open the database layer with an empty password by default
        UserAccountImpl account = (UserAccountImpl) loadAccount(info, null);
       
        // write the description file
        info.setId(account.getId());
        writeAccountDescFile(info);
       
        // set the password of the account if provided
        if (password != null && password.length() > 0) {
            changePassword(account, password);
        }
       
        // set additional properties of the account
        for(String s : userProperties.keySet()) {
          account.getProperties().put(s, userProperties.get(s));
    }
       
        saveAccount(account);
       
        changeLocale(account);
View Full Code Here

        }

        BeanFactory beanFactory = ContextUtils.createBeanFactory(configurationFilePath, properties);
       
        // create an account object, and bind it to the database
        final UserAccountImpl userAccount = new UserAccountImpl();
        userAccount.setFolder(infoImpl.getFolder());
        userAccount.setBeanFactory(beanFactory);
        userAccount.setPassword(password);
        userAccount.setName(infoImpl.getName());
        userAccount.setId(infoImpl.getId());

        // initialize transaction management
        PlatformTransactionManager transactionManager = (PlatformTransactionManager) beanFactory.getBean("userAccountTxManager")
        TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
        userAccount.setTransactionTemplate(transactionTemplate);
       
        // load the account in a transaction
        try {
            transactionTemplate.execute(
                new TransactionCallbackWithoutResult() {
                    public void doInTransactionWithoutResult(TransactionStatus status) {
                        UserAccountDAO userAccountDAO = userAccount.getUserAccountDAO();
                        userAccountDAO.loadAccount(userAccount);
                    }
                }
            );
View Full Code Here

    /**
     * Saves an account.
     */
    public void saveAccount(UserAccount account) {
        // write the database
        final UserAccountImpl userAccount = (UserAccountImpl) account;
        userAccount.getTransactionTemplate().execute(
            new TransactionCallbackWithoutResult() {
                public void doInTransactionWithoutResult(TransactionStatus status) {
                    UserAccountDAO userAccountDAO = userAccount.getUserAccountDAO();
                    userAccountDAO.saveAccount(userAccount);
                }
            }
        );
        updateUserAccountInfo(userAccount);
View Full Code Here

TOP

Related Classes of ch.tatool.app.data.UserAccountImpl

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.