Class FileValueDescriptorIntersector
java.lang.Object
de.xima.fc.workflow.FileValueDescriptorIntersector
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontentTypeMatches(Set<String> contentTypes, String contentType) Check if a given content type matches the constraints imposed by thecontent typesrestriction of afile list descriptor.static booleanextensionMatches(Set<String> extensions, String extension) Check if a given file extension matches the constraints imposed by theextensionsrestriction of afile list descriptor.static StringintersectContentTypes(String lhs, String rhs) Intersects twocontent type restrictionsfrom afile list descriptor.intersectContentTypes(Set<String> lhs, Set<String> rhs) Intersects two sets of content type restrictions.static StringintersectExtensions(String lhs, String rhs) Intersects twoextension restrictionsfrom afile list descriptor.intersectExtensions(Set<String> lhs, Set<String> rhs) Intersects two sets of extension restrictions.static IFileListDescriptorIntersects two file list descriptors.static IFileValueDescriptorIntersects two file value descriptors.static StringintersectMimeTypes(String lhs, String rhs) Deprecated.
-
Method Details
-
contentTypeMatches
Check if a given content type matches the constraints imposed by thecontent typesrestriction of afile list descriptor.- Parameters:
contentTypes- The content type restriction of a file list descriptor.contentType- The content type to check.- Returns:
- True if the content type matches the restriction, false otherwise.
-
extensionMatches
Check if a given file extension matches the constraints imposed by theextensionsrestriction of afile list descriptor.- Parameters:
extensions- The extensions restriction of a file list descriptor.extension- The file extension to check.- Returns:
- True if the file extension matches the restriction, false otherwise.
-
intersectContentTypes
Intersects two sets of content type restrictions. The intersection of two sets of content type restrictions is a new set of content type restrictions that matches every input matched by both restrictions. When the input sets are incompatible, the intersection is an empty set.Examples:
intersectContentTypes(Set.of("text/plain"), Set.of("text/plain")) = Set.of("text/plain") intersectContentTypes(Set.of("text/plain"), Set.of("application/json")) = Set.of() intersectContentTypes(Set.of("text/plain"), Set.of("text/*")) = Set.of("text/plain") intersectContentTypes(Set.of("text/*"), Set.of("application/*")) = Set.of() intersectContentTypes(Set.of("text/*"), Set.of("text/*")) = Set.of("text/*") intersectContentTypes(Set.of("text/plain", "image/*"), Set.of("text/plain", "image/jpeg")) = Set.of("text/plain", "image/png) intersectContentTypes(Set.of("*/*"), Set.of("text/*")) = Set.of("text/*") intersectContentTypes(Set.of("*/*"), Set.of("text/plain")) = Set.of("text/plain")- Parameters:
lhs- The left hand side set of content type restrictions.rhs- The right hand side set of content type restrictions.- Returns:
- The intersected set of content type restrictions.
-
intersectContentTypes
Intersects twocontent type restrictionsfrom afile list descriptor. The intersection of two content type restrictions is a new content type restriction that matches those content types that are matched by both given restrictions. When the input content type restrictions are incompatible, the intersection is null.- Parameters:
lhs- The left hand side content type restriction.rhs- The right hand side content type restriction.- Returns:
- The intersected content type restriction, or null if the content type restrictions are incompatible.
-
intersectExtensions
Intersects two sets of extension restrictions. The intersection of two sets of extension restrictions is a new set of extension restrictions that matches every input matched by both restrictions. When the input sets are incompatible, the intersection is an empty set.Examples:
intersectExtensions(Set.of("pdf"), Set.of("pdf")) = Set.of("pdf") intersectExtensions(Set.of("pdf"), Set.of("png")) = Set.of() intersectExtensions(Set.of("pdf"), Set.of("*")) = Set.of("pdf") intersectExtensions(Set.of("*"), Set.of("*")) = Set.of("*") intersectExtensions(Set.of("pdf", "*"), Set.of("*")) = Set.of("*")- Parameters:
lhs- The left hand side set of extension restrictions.rhs- The right hand side set of extension restrictions.- Returns:
- The intersected set of content type restrictions.
-
intersectExtensions
Intersects twoextension restrictionsfrom afile list descriptor. The intersection of two extension restriction is a new extension restriction that matches those content types that are matched by both given restrictions. When the input extension restrictions are incompatible, the intersection is null.- Parameters:
lhs- The left hand side extension restriction.rhs- The right hand side extension restriction.- Returns:
- The intersected extension restriction, or null if the extension restrictions are incompatible.
-
intersectFileListDescriptors
public static IFileListDescriptor intersectFileListDescriptors(IFileListDescriptor lhs, IFileListDescriptor rhs) Intersects two file list descriptors. The intersection of two file list descriptors is a new file list descriptor that allows only files that is allowed by both input descriptors, but no other files. When the input descriptors are incompatible, the intersection is an empty file list descriptor.This operation is, for the most part, symmetric / commutative. The only exception is the
attribute mapof thefiles. When both input descriptors have an attribute with the same key but different values, the value from the right hand side is used.- Parameters:
lhs- The left hand side file list descriptor.rhs- The right hand side file list descriptor.- Returns:
- The intersected file list descriptor.
-
intersectFileValueDescriptors
public static IFileValueDescriptor intersectFileValueDescriptors(IFileValueDescriptor lhs, IFileValueDescriptor rhs) Intersects two file value descriptors. The intersection of two file value descriptors is a new file value descriptor that allows only files that is allowed by both input descriptors, but no other files. When the input descriptors are incompatible, the intersection is an empty file value descriptor.If the left hand side is null, the right hand side is returned. If the right hand side is null, the left hand side is returned. If both are null, an empty file value descriptor is returned. Effectively, this means that null is treated as a wildcard that matches any file.
- Parameters:
lhs- The left hand side file value descriptor.rhs- The right hand side file value descriptor.- Returns:
- The intersected file value descriptor.
-
intersectMimeTypes
Deprecated.UseintersectContentTypes(String, String)instead.Intersects two mime types. The intersection of two mime types is a new mime type that matches both input mime types. When the input mime types are incompatible, the intersection is null.- Parameters:
lhs- The left hand side mime type.rhs- The right hand side mime type.- Returns:
- The intersected mime type or null if the mime types are incompatible.
-
intersectContentTypes(String, String)instead.