本文整理汇总了Java中org.alfresco.service.cmr.repository.TransformationOptions.setUse方法的典型用法代码示例。如果您正苦于以下问题:Java TransformationOptions.setUse方法的具体用法?Java TransformationOptions.setUse怎么用?Java TransformationOptions.setUse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.repository.TransformationOptions
的用法示例。
在下文中一共展示了TransformationOptions.setUse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ThumbnailDefinition
import org.alfresco.service.cmr.repository.TransformationOptions; //导入方法依赖的package包/类
/**
* Constructor. Specify the name of the thumbnail.
*
* @param thumbnailName the name of the thumbnail, can be null
*/
public ThumbnailDefinition(String mimetype, TransformationOptions options, String thumbnailName)
{
this(mimetype, options);
this.name= thumbnailName;
options.setUse(thumbnailName);
}
示例2: getTransformOptionsImpl
import org.alfresco.service.cmr.repository.TransformationOptions; //导入方法依赖的package包/类
protected TransformationOptions getTransformOptionsImpl(TransformationOptions options, RenderingContext context)
{
Long timeoutMs = context.getCheckedParam(PARAM_TIMEOUT_MS, Long.class);
if (timeoutMs != null)
{
options.setTimeoutMs(timeoutMs);
}
Long readLimitTimeMs = context.getCheckedParam(PARAM_READ_LIMIT_TIME_MS, Long.class);
if (readLimitTimeMs != null)
{
options.setReadLimitTimeMs(readLimitTimeMs);
}
Long maxSourceSizeKBytes = context.getCheckedParam(PARAM_MAX_SOURCE_SIZE_K_BYTES, Long.class);
if (maxSourceSizeKBytes != null)
{
options.setMaxSourceSizeKBytes(maxSourceSizeKBytes);
}
Long readLimitKBytes = context.getCheckedParam(PARAM_READ_LIMIT_K_BYTES, Long.class);
if (readLimitKBytes != null)
{
options.setReadLimitKBytes(readLimitKBytes);
}
Integer maxPages = context.getCheckedParam(PARAM_MAX_PAGES, Integer.class);
if (maxPages != null)
{
options.setMaxPages(maxPages);
}
Integer pageLimit = context.getCheckedParam(PARAM_PAGE_LIMIT, Integer.class);
if (pageLimit != null)
{
options.setPageLimit(pageLimit);
}
String use = context.getCheckedParam(PARAM_USE, String.class);
if (use != null)
{
options.setUse(use);
}
if (getSourceOptionsSerializers() != null)
{
for (TransformationSourceOptionsSerializer sourceSerializer : getSourceOptionsSerializers())
{
TransformationSourceOptions sourceOptions = sourceSerializer.deserialize(context);
if (sourceOptions != null)
{
options.addSourceOptions(sourceOptions);
}
}
}
return options;
}
示例3: transformationsByTransformer
import org.alfresco.service.cmr.repository.TransformationOptions; //导入方法依赖的package包/类
/**
* Returns a String and /or debug that provides a list of supported transformations for each
* transformer.
* @param transformerName restricts the list to one transformer. Unrestricted if null.
* @param toString indicates that a String value should be returned in addition to any debug.
* @param format42 indicates the old 4.1.4 format should be used which did not order the transformers
* and only included top level transformers.
* @param use to which the transformation will be put (such as "Index", "Preview", null).
*/
public String transformationsByTransformer(String transformerName, boolean toString, boolean format42, String use)
{
// Do not generate this type of debug if already generating other debug to a StringBuilder
// (for example a test transform).
if (getStringBuilder() != null)
{
return null;
}
Collection<ContentTransformer> transformers = format42 || transformerName != null
? sortTransformersByName(transformerName)
: transformerRegistry.getTransformers();
Collection<String> sourceMimetypes = format42
? getSourceMimetypes(null)
: mimetypeService.getMimetypes();
Collection<String> targetMimetypes = format42
? sourceMimetypes
: mimetypeService.getMimetypes();
TransformationOptions options = new TransformationOptions();
options.setUse(use);
StringBuilder sb = null;
try
{
if (toString)
{
sb = new StringBuilder();
setStringBuilder(sb);
}
pushMisc();
for (ContentTransformer transformer: transformers)
{
try
{
pushMisc();
int mimetypePairCount = 0;
boolean first = true;
for (String sourceMimetype: sourceMimetypes)
{
for (String targetMimetype: targetMimetypes)
{
if (transformer.isTransformable(sourceMimetype, -1, targetMimetype, options))
{
long maxSourceSizeKBytes = transformer.getMaxSourceSizeKBytes(
sourceMimetype, targetMimetype, options);
activeTransformer(++mimetypePairCount, transformer,
sourceMimetype, targetMimetype, maxSourceSizeKBytes, first);
first = false;
}
}
}
if (first)
{
inactiveTransformer(transformer);
}
}
finally
{
popMisc();
}
}
}
finally
{
popMisc();
setStringBuilder(null);
}
stripFinishedLine(sb);
return stripLeadingNumber(sb);
}
示例4: run
import org.alfresco.service.cmr.repository.TransformationOptions; //导入方法依赖的package包/类
String run(String sourceExtension, String targetExtension, String use)
{
String debug;
String targetMimetype = getMimetype(targetExtension, false);
String sourceMimetype = getMimetype(sourceExtension, true);
URL sourceURL = loadQuickTestFile(sourceExtension);
if (sourceURL == null)
{
throw new IllegalArgumentException("There is no test file with a "+sourceExtension+" extension.");
}
// This URL may point to a file on the filesystem or to an entry in a jar.
// To use the transform method below, we need the content to be accessible from a ContentReader.
// This is possible for a File but not a (non-file) URL.
//
// Therefore, we'll always copy the URL content to a temporary local file.
final File sourceFile = TempFileProvider.createTempFile(TransformerDebug.class.getSimpleName() + "-tmp-", "");
try { FileUtils.copyURLToFile(sourceURL, sourceFile); }
catch (IOException shouldNeverHappen)
{
// The sourceURL should always be readable as we're reading data that Alfresco is distributing.
// But just in case...
throw new IllegalArgumentException("Cannot read content of test file with a " +
sourceExtension + " extension.", shouldNeverHappen);
}
ContentReader reader = new FileContentReader(sourceFile);
reader.setMimetype(sourceMimetype);
File tempFile = TempFileProvider.createTempFile(
"TestTransform_" + sourceExtension + "_", "." + targetExtension);
ContentWriter writer = new FileContentWriter(tempFile);
writer.setMimetype(targetMimetype);
long sourceSize = reader.getSize();
TransformationOptions options = new TransformationOptions();
options.setUse(use);
debug = isTransformable(sourceMimetype, sourceSize, targetMimetype, options);
if (debug == null)
{
StringBuilder sb = new StringBuilder();
try
{
setStringBuilder(sb);
transform(reader, writer, options);
}
catch (AlfrescoRuntimeException e)
{
sb.append(e.getMessage());
}
finally
{
setStringBuilder(null);
}
debug = sb.toString();
}
return debug;
}