All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zanata.common.ContentState Maven / Gradle / Ivy

There is a newer version: 4.6.2
Show newest version
/**
 *
 */
package org.zanata.common;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import javax.xml.bind.annotation.XmlType;

@XmlType(name = "contentStateType")
public enum ContentState {
    // translation life cycle order:
    // New -> NeedReview || Rejected -> Translated -> Approved (Translated in
    // non-review project will automatically go to Approved)
    New, NeedReview, Translated, Approved, Rejected;

    public static final Collection DRAFT_STATES = Collections
            .unmodifiableCollection(new HashSet(Arrays.asList(
                    NeedReview, Rejected)));
    public static final Collection TRANSLATED_STATES =
            Collections.unmodifiableCollection(new HashSet(Arrays
                    .asList(Approved, Translated)));
    public static final Collection REVIEWED_STATES = Collections
            .unmodifiableCollection(new HashSet(Arrays.asList(
                    Approved, Rejected)));

    public boolean isTranslated() {
        return TRANSLATED_STATES.contains(this);
    }

    public boolean isRejectedOrFuzzy() {
        return DRAFT_STATES.contains(this);
    }

    public boolean isReviewed() {
        return REVIEWED_STATES.contains(this);
    }

    public boolean isUntranslated() {
        return this == New;
    }

    public boolean isApproved() {
        return this == Approved;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy