Package org.zanata.webtrans.shared.util

Examples of org.zanata.webtrans.shared.util.FindByTransUnitIdPredicate


    private List<EventWrapper> eventQueue = Lists.newArrayList();

    public void push(TransUnitSaveEvent event) {
        EventWrapper comingEvent = new EventWrapper(event);
        Optional<EventWrapper> previousEvent =
                Iterables.tryFind(eventQueue, new FindByTransUnitIdPredicate(
                        comingEvent.getId()));
        if (!previousEvent.isPresent()) {
            eventQueue.add(comingEvent);
            Log.info("pushed into queue:" + comingEvent);
            return;
View Full Code Here


    }

    public TransUnitSaveEvent getNextPendingForSaving(TransUnitId idToSave) {
        Optional<EventWrapper> pendingEvents =
                Iterables.tryFind(eventQueue, Predicates.and(
                        new FindByTransUnitIdPredicate(idToSave),
                        NotSavingPredicate.INSTANCE));
        if (!pendingEvents.isPresent()) {
            return null;
        } else {
            EventWrapper wrapper = pendingEvents.get();
View Full Code Here

    public void removeSaved(TransUnitSaveEvent saveEvent, int savedVersion) {
        EventWrapper saved = new EventWrapper(saveEvent);
        Collection<EventWrapper> sameIdEvents =
                filter(eventQueue,
                        new FindByTransUnitIdPredicate(saved.getId()));
        if (sameIdEvents.size() == 2) {
            EventWrapper pending =
                    Iterables.find(sameIdEvents, NotSavingPredicate.INSTANCE);
            Log.info("found pending save:" + pending);
            pending.setVerNumber(savedVersion);
View Full Code Here

    }

    public void removeAllPending(TransUnitId id) {
        Log.info("remove all pending for " + id);
        Collection<EventWrapper> pending =
                filter(eventQueue, new FindByTransUnitIdPredicate(id));
        eventQueue.removeAll(pending);
    }
View Full Code Here

    }

    public boolean isSaving(TransUnitId transUnitId) {
        Optional<EventWrapper> saving =
                Iterables.tryFind(eventQueue, Predicates.and(
                        new FindByTransUnitIdPredicate(transUnitId),
                        HasSavingPredicate.INSTANCE));
        return saving.isPresent();
    }
View Full Code Here

                        hLocale, transUnitTransformer));

        int gotoRow = 0;
        if (action.getTargetTransUnitId() != null) {
            int row =
                    Iterables.indexOf(units, new FindByTransUnitIdPredicate(
                            action.getTargetTransUnitId()));
            if (row != -1) {
                gotoRow = row;
            }
        }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.util.FindByTransUnitIdPredicate

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.