Package org.zanata.dao

Examples of org.zanata.dao.AccountDAO


    public boolean isNewUser(String username) {
        Object user = lookupUser(username);
        // also look in the credentials table
        if (user == null) {
            AccountDAO accountDAO =
                    ServiceLocator.instance().getInstance(AccountDAO.class);
            user = accountDAO.getByCredentialsId(username);
        }
        return user == null;
    }
View Full Code Here


        @Setter
        private String filter;

        @Override
        public DataPage<String> fetchPage(int startRow, int pageSize) {
            AccountDAO accountDAO =
                    (AccountDAO) Component.getInstance(AccountDAO.class,
                            ScopeType.STATELESS);

            List<String> userList =
                    accountDAO.getUserNames(filter, startRow, pageSize);

            int listSize = accountDAO.getUserCount(filter);

            return new DataPage<String>(listSize, startRow, userList);
        }
View Full Code Here

        private static final long serialVersionUID = 1L;

        @Override
        public void afterOpenIdAuth(OpenIdAuthenticationResult result) {
            if (result.isAuthenticated()) {
                AccountDAO accountDAO =
                        ServiceLocator.instance().getInstance(AccountDAO.class);
                HAccount account =
                        accountDAO.getByCredentialsId(result
                                .getAuthenticatedId());
                if (account == null) {
                    account = new HAccount(); // In case an account is not found
                }
                Contexts.getSessionContext().set("obsoleteAccount", account); // Outject
View Full Code Here

         * caller's context
         */
        if (username != null) {
            // Only if it's an authenticated task should it try and do this
            // injection
            AccountDAO accountDAO =
                    ServiceLocator.instance().getInstance(AccountDAO.class);
            ZanataJpaIdentityStore idStore =
                    ServiceLocator.instance().getInstance(
                            ZanataJpaIdentityStore.class);
            AuthenticationEvents authEvts =
                    ServiceLocator.instance().getInstance(
                            AuthenticationEvents.class);
            HAccount authenticatedAccount = accountDAO.getByUsername(username);
            idStore.setAuthenticateUser(authenticatedAccount);
        }
    }
View Full Code Here

                DatabaseOperation.DELETE_ALL));
    }

    @BeforeMethod
    public void setUp() throws Exception {
        AccountDAO accountDAO = new AccountDAO(getSession());
        HAccount authenticatedAccount = getEm().find(HAccount.class, 1L);
        // @formatter:off
        handler = SeamAutowire.instance()
            .reset()
            .use(JpaIdentityStore.AUTHENTICATED_USER, authenticatedAccount)
View Full Code Here

        super.newSession();
        this.prepareResources(); // Reset Seam as part of new transaction
                                 // simulation

        AccountDAO accountDAO = getSeamAutowire().autowire(AccountDAO.class);

        // Translator
        HAccount translator = accountDAO.getByUsername("demo");

        // Translate using the web editor
        this.simulateWebEditorTranslation("sample-project", "1.0", "my.txt",
                "tf1", translator, de_de, "Translated", ContentState.Approved);
View Full Code Here

                DatabaseOperation.DELETE_ALL));
    }

    @BeforeMethod
    public void beforeMethod() {
        AccountDAO accountDAO = new AccountDAO(getSession());
        authenticatedAccount = getEm().find(HAccount.class, 1L);
        // @formatter:off
      handler = SeamAutowire.instance()
            .reset()
            .use(JpaIdentityStore.AUTHENTICATED_USER, authenticatedAccount)
View Full Code Here

TOP

Related Classes of org.zanata.dao.AccountDAO

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.