Search in sources :

Example 1 with AbstractTransformRegistry

use of org.alfresco.transform.client.registry.AbstractTransformRegistry in project alfresco-repository by Alfresco.

the class AbstractRenditionTest method logSourceTarget.

private void logSourceTarget(StringBuilder sourceTargetList, StringBuilder sourceTargetPriorityList, AtomicInteger count, String sourceMimetype, String targetMimetype) {
    count.incrementAndGet();
    String sourceExtension = mimetypeService.getExtension(sourceMimetype);
    String targetExtension = mimetypeService.getExtension(targetMimetype);
    String line = String.format("%4d %4s %4s\n", count.get(), sourceExtension, targetExtension);
    sourceTargetList.append(line);
    if (sourceTargetPriorityList != null) {
        AbstractTransformRegistry registry = getAbstractTransformRegistry();
        if (registry != null) {
            Map<String, List<SupportedTransform>> supportedTransformsByTargetMimetype = registry.getData().retrieveTransforms(sourceMimetype);
            List<SupportedTransform> supportedTransforms = new ArrayList<>(supportedTransformsByTargetMimetype.get(targetMimetype));
            supportedTransforms.sort((t1, t2) -> t1.getPriority() - t2.getPriority());
            char a = 'a';
            int prevPriority = Integer.MAX_VALUE;
            for (SupportedTransform supportedTransform : supportedTransforms) {
                int priority = supportedTransform.getPriority();
                long maxSourceSizeBytes = supportedTransform.getMaxSourceSizeBytes();
                String priorityUnchanged = prevPriority == priority ? "*" : "";
                String transformName = supportedTransform.getName();
                line = String.format("%4d %4s %4s %c) [%d%s] %s %d\n", count.get(), sourceExtension, targetExtension, a++, priority, priorityUnchanged, transformName, maxSourceSizeBytes);
                sourceTargetPriorityList.append(line);
                prevPriority = priority;
            }
        }
    }
}
Also used : AbstractTransformRegistry(org.alfresco.transform.client.registry.AbstractTransformRegistry) SupportedTransform(org.alfresco.transform.client.registry.SupportedTransform) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 AbstractTransformRegistry (org.alfresco.transform.client.registry.AbstractTransformRegistry)1 SupportedTransform (org.alfresco.transform.client.registry.SupportedTransform)1