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

org.incode.example.communications.dom.mixins.DocumentPredicates Maven / Gradle / Ivy

package org.incode.example.communications.dom.mixins;

import com.google.common.base.Predicate;
import com.google.common.base.Predicates;

import org.incode.example.document.dom.impl.docs.Document;
import org.incode.example.document.dom.impl.docs.DocumentSort;

public class DocumentPredicates {
    private DocumentPredicates() {
    }

    public static Predicate isPdfAndBlob() {
        return Predicates.and(isPdf(), isBlobSort());
    }

    public static Predicate isPdf() {
        return document -> DocumentConstants.MIME_TYPE_APPLICATION_PDF.equals(document.getMimeType());
    }

    public static Predicate isBlobSort() {
        return document -> {
            final DocumentSort documentSort = document.getSort();
            return !(documentSort != DocumentSort.BLOB && documentSort != DocumentSort.EXTERNAL_BLOB);
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy