Package org.zanata.model

Examples of org.zanata.model.HDocument


        return numCopied;
    }

    private String createComment(HTextFlowTarget target) {
        String author;
        HDocument document = target.getTextFlow().getDocument();
        String projectname =
                document.getProjectIteration().getProject().getName();
        String version = document.getProjectIteration().getSlug();
        String documentid = document.getDocId();
        if (target.getLastModifiedBy() != null) {
            author = ", author " + target.getLastModifiedBy().getName();
        } else {
            author = "";
        }
View Full Code Here


         * Using a direct method call instead of an event because it's easier to
         * read. Since these events are being called synchronously (as opposed
         * to an 'after Transaction' events), there is no big performance gain
         * and makes the code easier to read and navigate.
         */
        HDocument document = target.getTextFlow().getDocument();
        TextFlowTargetStateEvent updateEvent =
                new TextFlowTargetStateEvent(null, document
                        .getProjectIteration().getId(), document.getId(),
                        target.getTextFlow().getId(), target.getLocaleId(),
                        target.getId(), target.getState(), previousState);
        versionStateCacheImpl.textFlowStateUpdated(updateEvent);
    }
View Full Code Here

            lock.lock();
            try {
                HTextFlowTarget target =
                        textFlowTargetDAO.findById(event.getTextFlowTargetId(),
                                false);
                HDocument document = documentDAO.getById(event.getDocumentId());
                ActivityType activityType =
                        event.getNewState().isReviewed() ? ActivityType.REVIEWED_TRANSLATION
                                : ActivityType.UPDATE_TRANSLATION;

                logActivityAlreadyLocked(actorId,
                        document.getProjectIteration(), target, activityType,
                        target.getTextFlow().getWordCount().intValue());
            } finally {
                lock.unlock();
            }
        }
View Full Code Here

    @Transactional
    public void onDocumentUploaded(DocumentUploadedEvent event) {
        Lock lock = activityLockManager.getLock(event.getActorId());
        lock.lock();
        try {
            HDocument document = documentDAO.getById(event.getDocumentId());
            ActivityType activityType =
                    event.isSourceDocument() ? ActivityType.UPLOAD_SOURCE_DOCUMENT
                            : ActivityType.UPLOAD_TRANSLATION_DOCUMENT;
            HPerson actor = personDAO.findById(event.getActorId());
            logActivityAlreadyLocked(actor.getId(),
                    document.getProjectIteration(), document, activityType,
                    getDocumentWordCount(document));
        } finally {
            lock.unlock();
        }
    }
View Full Code Here

            if (target.getLastModifiedBy() != null) {
                lastTranslatedBy =
                        target.getLastModifiedBy().getAccount().getUsername();
            }
        }
        HDocument document = documentDAO.findById(documentId, false);
        documentStatus.update(
                new DocumentId(document.getId(), document.getDocId()),
                lastTranslatedDate, lastTranslatedBy);
        return documentStatus;
    }
View Full Code Here

    }

    @Override
    public HDocument copyDocument(HProjectIteration newVersion,
            HDocument document) throws Exception {
        HDocument copy =
                JPACopier.<HDocument> copyBean(document, "projectIteration",
                        "poHeader", "poTargetHeaders", "rawDocument",
                        "textFlows", "allTextFlows");
        copy.setProjectIteration(newVersion);

        if (document.getPoHeader() != null) {
            HPoHeader poHeader =
                    JPACopier.<HPoHeader> copyBean(document.getPoHeader());
            copy.setPoHeader(poHeader);
        }

        for (Map.Entry<HLocale, HPoTargetHeader> entry : document
                .getPoTargetHeaders().entrySet()) {
            HPoTargetHeader poTargetHeader =
                    JPACopier.<HPoTargetHeader> copyBean(entry.getValue(),
                            "document");
            poTargetHeader.setDocument(copy);
            copy.getPoTargetHeaders().put(entry.getKey(), poTargetHeader);
        }
        return copy;
    }
View Full Code Here

TOP

Related Classes of org.zanata.model.HDocument

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.