Examples of HPerson


Examples of org.zanata.model.HPerson

    private Response createUser(HAccount account) {
        if (account == null) {
            return Response.status(Response.Status.NOT_FOUND).build();
        }

        HPerson person = account.getPerson();
        User user =
            new User(account.getUsername(), person.getEmail(),
                person.getName(),
                gravatarServiceImpl.getGravatarHash(person.getEmail()));
        return Response.ok(user).build();
    }
View Full Code Here

Examples of org.zanata.model.HPerson

                    @Override
                    public LocaleId apply(String input) {
                        return new LocaleId(input);
                    }
                });
        final HPerson hPerson = entityManager
            .createQuery("from HPerson p where p.account.username = :username",
                HPerson.class).setParameter("username", username).getSingleResult();
        final List<HLocale> hLocales = entityManager
            .createQuery("from HLocale where localeId in (:locales)",
                HLocale.class).setParameter("locales", locales).getResultList();
View Full Code Here

Examples of org.zanata.model.HPerson

        return languageTeamServiceImpl.isUserReviewer(
                authenticatedAccount.getPerson().getId());
    }

    public String getLastTranslatorMessage(HProject project) {
        HPerson lastTrans = projectDAO.getLastTranslator(project);
        if( lastTrans != null ) {
            String username = lastTrans.getName();
            if(username == null || username.trim().isEmpty()) {
                if( lastTrans.getAccount() != null ) {
                    username = lastTrans.getAccount().getUsername();
                }
            }
            else {
                username = lastTrans.getName();
            }
            return msgs
                    .format("jsf.dashboard.activity.lastTranslatedBy.message",
                            username);
        }
View Full Code Here

Examples of org.zanata.model.HPerson

            // creating
            operation = "insert";
            response = Response.created(uri.getAbsolutePath());

            hAccount = new HAccount();
            HPerson person = new HPerson();
            person.setAccount(hAccount);
            hAccount.setPerson(person);
        } else {
            // updating
            operation = "update";
            response = Response.ok();
View Full Code Here

Examples of org.zanata.model.HPerson

    private void transfer(Account from, HAccount to) {
        to.setApiKey(from.getApiKey());
        to.setEnabled(from.isEnabled());
        to.setPasswordHash(from.getPasswordHash());

        HPerson hPerson = to.getPerson();
        hPerson.setEmail(from.getEmail());
        hPerson.setName(from.getName());

        to.getRoles().clear();
        for (String role : from.getRoles()) {
            HAccountRole hAccountRole = accountRoleDAO.findByName(role);
            if (hAccountRole == null) {
                // generate error for missing role
                log.debug("Invalid role '{}'", role);
                throw new NoLogWebApplicationException(Response
                        .status(Status.BAD_REQUEST)
                        .entity("Invalid role '" + role + "'").build());
            }
            to.getRoles().add(hAccountRole);
        }

        hPerson.getLanguageMemberships().clear();
        for (String tribe : from.getTribes()) {
            HLocale hTribe = localeDAO.findByLocaleId(new LocaleId(tribe));
            if (hTribe == null)
                // generate error for missing tribe
                throw new NoLogWebApplicationException(Response
                        .status(Status.BAD_REQUEST)
                        .entity("Invalid tribe '" + tribe + "'").build());
            hPerson.getLanguageMemberships().add(hTribe);
        }

        to.setUsername(from.getUsername());
    }
View Full Code Here

Examples of org.zanata.model.HPerson

    private void transfer(HAccount from, Account to) {
        to.setApiKey(from.getApiKey());
        to.setEnabled(from.isEnabled());
        to.setPasswordHash(from.getPasswordHash());

        HPerson hPerson = from.getPerson();
        to.setEmail(hPerson.getEmail());
        to.setName(hPerson.getName());

        Set<String> roles = new HashSet<String>();

        for (HAccountRole role : from.getRoles()) {
            roles.add(role.getName());
View Full Code Here

Examples of org.zanata.model.HPerson

            }

            String checkResult = checkExpiryDate(entry.getCreationDate());

            if (StringUtils.isEmpty(checkResult)) {
                HPerson person = entry.getPerson();
                HAccount account = person.getAccount();
                if (!account.getUsername().equals(
                        identity.getCredentials().getUsername())) {
                    throw new LoginException();
                }

                person.setEmail(entry.getEmail());
                account.setEnabled(true);
                personDAO.makePersistent(person);
                personDAO.flush();
                emailChangeService.removeEntry(entry);
                FacesMessages.instance().add(
View Full Code Here

Examples of org.zanata.model.HPerson

            final List<HeaderEntry> headerEntries) {
        Date headerRevisionDate = this.getHeaderRevisionDate(headerEntries);
        String lastTranslator = this.getHeaderLastTranslator(headerEntries);

        if (lastTranslated != null) {
            HPerson lastModifiedBy = lastTranslated.getLastModifiedBy();
            Date lastModifiedDate = lastTranslated.getLastChanged();

            // Last translated target is more recent than the Revision Date on
            // the
            // Header
            if (lastModifiedBy != null && lastModifiedDate != null
                    && lastModifiedDate.after(headerRevisionDate)) {
                lastTranslator =
                        lastModifiedBy.getName() + " <"
                                + lastModifiedBy.getEmail() + ">";
            } else if (lastModifiedBy != null && lastModifiedDate == null) {
                lastTranslator =
                        lastModifiedBy.getName() + " <"
                                + lastModifiedBy.getEmail() + ">";
            }
        }

        return lastTranslator;
    }
View Full Code Here

Examples of org.zanata.model.HPerson

        }
        // generate #zanata credit comments
        // order by year, then alphabetically
        Set<TranslatorCredit> zanataCredits = new TreeSet<TranslatorCredit>();
        for (HTextFlowTarget tft : hTargets) {
            HPerson person = tft.getLastModifiedBy();
            if (person != null) {
                Calendar lastChanged = Calendar.getInstance();
                lastChanged.setTime(tft.getLastChanged());
                int year = lastChanged.get(Calendar.YEAR);
                TranslatorCredit credit = new TranslatorCredit();
                credit.setEmail(person.getEmail());
                credit.setName(person.getName());
                credit.setYear(year);
                zanataCredits.add(credit);
            }
        }
        for (TranslatorCredit credit : zanataCredits) {
View Full Code Here

Examples of org.zanata.model.HPerson

        // TODO rhbz953734 - at the moment we will map review state into old
        // state for compatibility
        to.setState(mapContentState(apiVersion, from.getState()));
        to.setRevision(from.getVersionNum());
        to.setTextFlowRevision(from.getTextFlowRevision());
        HPerson translator = from.getLastModifiedBy();
        if (translator != null) {
            to.setTranslator(new Person(translator.getEmail(), translator
                    .getName()));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.