Package org.zanata.dao

Examples of org.zanata.dao.PersonDAO


        return isUserAllowedAccess(project) && isUserTranslatorOfLanguage(lang);
    }

    public static boolean isUserTranslatorOfLanguage(HLocale lang) {
        Optional<HAccount> authenticatedAccount = getAuthenticatedAccount();
        PersonDAO personDAO =
                ServiceLocator.instance().getInstance(PersonDAO.class);

        if (authenticatedAccount.isPresent()) {
            return personDAO.isUserInLanguageTeamWithRoles(
                    authenticatedAccount.get().getPerson(), lang, true, null, null);
        }

        return false; // No authenticated user
    }
View Full Code Here


        return isUserAllowedAccess(project) && isUserReviewerOfLanguage(locale);
    }

    public static boolean isUserReviewerOfLanguage(HLocale lang) {
        Optional<HAccount> authenticatedAccount = getAuthenticatedAccount();
        PersonDAO personDAO =
                ServiceLocator.instance().getInstance(PersonDAO.class);

        if (authenticatedAccount.isPresent()) {
            return personDAO.isUserInLanguageTeamWithRoles(
                    authenticatedAccount.get().getPerson(), lang, null, true, null);
        } else {
            return false;
        }
View Full Code Here

        return account.isPresent() && account.get().getPerson().isMaintainer(projectIteration.getProject());
    }

    public static boolean isLanguageTeamMember(HLocale lang) {
        Optional<HAccount> authenticatedAccount = getAuthenticatedAccount();
        PersonDAO personDAO =
                ServiceLocator.instance().getInstance(PersonDAO.class);

        if (authenticatedAccount.isPresent()) {
            return personDAO.isUserInLanguageTeamWithRoles(
                    authenticatedAccount.get().getPerson(), lang, null, null, null);
        } else {
            return false;
        }
View Full Code Here

    /* 'team coordinator' can manage language teams */
    @GrantsPermission(actions = "manage-language-team")
    public static boolean isUserCoordinatorOfLanguage(HLocale lang) {
        Optional<HAccount> authenticatedAccount = getAuthenticatedAccount();
        PersonDAO personDAO =
                ServiceLocator.instance().getInstance(PersonDAO.class);

        if (authenticatedAccount.isPresent()) {
            return personDAO.isUserInLanguageTeamWithRoles(
                    authenticatedAccount.get().getPerson(), lang, null, null, true);
        } else {
            return false;
        }

View Full Code Here

    public boolean isValid(String string, ConstraintValidatorContext context) {
        if (string == null)
            return true;
        if (string.length() == 0)
            return true;
        PersonDAO personDAO =
                ServiceLocator.instance().getInstance(PersonDAO.class);
        return personDAO.findByEmail(string) == null;
    }
View Full Code Here

                "1.0", "admin", "2013-01-01..2014-06-01");
    }

    @Test
    public void getContribStatsSingleTarget() {
        PersonDAO personDAO = seam.autowire(PersonDAO.class);

        // Initial state = needReview
        HTextFlowTarget target = textFlowTargetDAO.findById(2L);

        int wordCount = target.getTextFlow().getWordCount().intValue();

        String todayDate = formatter.format(today);

        String username = "demo";
        HPerson demoPerson = personDAO.findByUsername(username);

        ContributionStatistics initialStats =
                statisticsService.getContributionStatistics(
                        "sample-project", "1.0", username, todayDate + ".."
                                + todayDate);
View Full Code Here

    }

    @Test
    public void getContribStatsSameLocaleMultiTargets() {
        PersonDAO personDAO = seam.autowire(PersonDAO.class);
        String username = "demo";
        HPerson demoPerson = personDAO.findByUsername(username);

        // Initial state = new (en-us)
        HTextFlowTarget target1 = textFlowTargetDAO.findById(5L);

        // Initial state = new (en-us)
View Full Code Here

                newState, demoPerson, expectedStats);
    }

    @Test
    public void getContributionStatisticsMultiLocale() {
        PersonDAO personDAO = seam.autowire(PersonDAO.class);
        String username = "demo";
        HPerson demoPerson = personDAO.findByUsername(username);

        // Initial state = needReview (AS)
        HTextFlowTarget target1 = textFlowTargetDAO.findById(1L);

        // Initial state = needReview (DE)
View Full Code Here

    }

    @Test
    public void getAllActiveAndMaintainedGroupsTest() {
        // personId = 1 is maintainers for group1 and group3(obsolote)
        PersonDAO personDAO = new PersonDAO(getSession());
        HPerson person = personDAO.findById(new Long(1));
        List<HIterationGroup> result =
                versionGroupServiceImpl.getAllActiveAndMaintainedGroups(person);

        assertThat(result.size(), equalTo(3));
    }
View Full Code Here

TOP

Related Classes of org.zanata.dao.PersonDAO

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.