Package org.zanata.events

Examples of org.zanata.events.TextFlowTargetStateEvent


            // new DocumentId(document.getId(), document.getDocId()), hasError,
            // hTextFlowTarget.getLastChanged(),
            // hTextFlowTarget.getLastModifiedBy().getAccount().getUsername());
            Events.instance().raiseTransactionSuccessEvent(
                    TextFlowTargetStateEvent.EVENT_NAME,
                    new TextFlowTargetStateEvent(actorId, versionId,
                            documentId, textFlow.getId(), hTextFlowTarget
                                    .getLocale().getLocaleId(), hTextFlowTarget
                                    .getId(), hTextFlowTarget.getState(),
                            oldState));
        }
View Full Code Here


        when(translationStateCache.getDocumentStatistics(docId, localeId)).
                thenReturn(stats);
        when(textFlowDAO.getWordCount(tfId)).thenReturn(wordCount);

        TextFlowTargetStateEvent event =
                new TextFlowTargetStateEvent(null, versionId, docId, tfId,
                        localeId, 1L, newState, oldState);

        spyManager.textFlowStateUpdated(event);

        verify(translationStateCache).textFlowStateUpdated(event);
View Full Code Here

        activityService = seam.autowire(ActivityServiceImpl.class);
    }

    @Test
    public void testNewReviewActivityInserted() throws Exception {
        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId, null, new LocaleId("as"),
                textFlowTargetId, ContentState.Approved,
                ContentState.NeedReview));
        Activity activity =
                activityService.findActivity(personId,
View Full Code Here

        assertThat(activity.getEventCount(), equalTo(1));
    }

    @Test
    public void testNewReviewActivityUpdated() throws Exception {
        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId, null, new LocaleId("as"),
                textFlowTargetId, ContentState.Approved,
                ContentState.NeedReview));

        List<Activity> activities =
                activityService.findLatestActivitiesForContext(personId,
                        projectVersionId, 0, 10);
        assertThat(activities.size(), equalTo(1));

        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId, null, new LocaleId("as"),
                textFlowTargetId, ContentState.Rejected,
                ContentState.NeedReview));

        activities =
View Full Code Here

        assertThat(activity.getEventCount(), equalTo(2));
    }

    @Test
    public void testActivityInsertAndUpdate() throws Exception {
        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId, null, new LocaleId("as"),
                textFlowTargetId, ContentState.Translated,
                ContentState.NeedReview));

        Activity activity =
                activityService.findActivity(personId,
                        EntityType.HProjectIteration, projectVersionId,
                        ActivityType.UPDATE_TRANSLATION, new Date());
        assertThat(activity, not(nullValue()));

        Long id = activity.getId();

        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId, null, new LocaleId("as"),
                textFlowTargetId, ContentState.NeedReview, ContentState.New));

        activity =
                activityService.findActivity(personId,
View Full Code Here

        assertThat(activity.getId(), equalTo(id));
    }

    @Test
    public void testActivityInsertMultipleTypeActivities() throws Exception {
        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId, null, new LocaleId("as"),
                textFlowTargetId, ContentState.Translated,
                ContentState.NeedReview));

        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId, null, new LocaleId("as"),
                textFlowTargetId, ContentState.Approved,
                ContentState.NeedReview));

        activityService.onDocumentUploaded(new DocumentUploadedEvent(personId,
View Full Code Here

    @Test
    public void testGetAllPersonActivities() throws Exception {
        Long documentId2 = new Long(2L);

        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId2, null, LocaleId.EN_US,
                new Long(5), ContentState.Translated, ContentState.NeedReview));

        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId2, null, LocaleId.EN_US,
                new Long(5), ContentState.Approved, ContentState.NeedReview));

        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId2, null, LocaleId.EN_US,
                new Long(6), ContentState.Rejected, ContentState.Translated));

        activityService.logTextFlowStateUpdate(new TextFlowTargetStateEvent(
                personId, versionId, documentId2, null, LocaleId.EN_US,
                new Long(6), ContentState.NeedReview, ContentState.New));

        List<Activity> activities =
                activityService.findLatestActivitiesForContext(personId,
View Full Code Here

         * 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

TOP

Related Classes of org.zanata.events.TextFlowTargetStateEvent

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.