本文整理汇总了Java中org.alfresco.service.cmr.repository.TransformationOptions.getTimeoutMs方法的典型用法代码示例。如果您正苦于以下问题:Java TransformationOptions.getTimeoutMs方法的具体用法?Java TransformationOptions.getTimeoutMs怎么用?Java TransformationOptions.getTimeoutMs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.repository.TransformationOptions
的用法示例。
在下文中一共展示了TransformationOptions.getTimeoutMs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transformInternal
import org.alfresco.service.cmr.repository.TransformationOptions; //导入方法依赖的package包/类
/**
* Transform the image content from the source file to the target file
*/
@Override
protected void transformInternal(File sourceFile, String sourceMimetype,
File targetFile, String targetMimetype, TransformationOptions options) throws Exception
{
Map<String, String> properties = new HashMap<String, String>(5);
// set properties
if (options instanceof ImageTransformationOptions)
{
ImageTransformationOptions imageOptions = (ImageTransformationOptions)options;
CropSourceOptions cropOptions = imageOptions.getSourceOptions(CropSourceOptions.class);
ImageResizeOptions resizeOptions = imageOptions.getResizeOptions();
String commandOptions = imageOptions.getCommandOptions();
if (commandOptions == null)
{
commandOptions = "";
}
// MNT-10882 : JPEG File Format, does not save the alpha (transparency) channel.
if (MimetypeMap.MIMETYPE_IMAGE_JPEG.equalsIgnoreCase(targetMimetype) && isAlphaOptionSupported())
{
commandOptions += " -alpha remove";
}
if (imageOptions.isAutoOrient())
{
commandOptions = commandOptions + " -auto-orient";
}
if (cropOptions != null)
{
commandOptions = commandOptions + " " + getImageCropCommandOptions(cropOptions);
}
if (resizeOptions != null)
{
commandOptions = commandOptions + " " + getImageResizeCommandOptions(resizeOptions);
}
properties.put(KEY_OPTIONS, commandOptions);
}
properties.put(VAR_SOURCE, sourceFile.getAbsolutePath() +
getSourcePageRange(options, sourceMimetype, targetMimetype));
properties.put(VAR_TARGET, targetFile.getAbsolutePath());
// execute the statement
long timeoutMs = options.getTimeoutMs();
RuntimeExec.ExecutionResult result = executer.execute(properties, timeoutMs);
if (result.getExitValue() != 0 && result.getStdErr() != null && result.getStdErr().length() > 0)
{
throw new ContentIOException("Failed to perform ImageMagick transformation: \n" + result);
}
// success
if (logger.isDebugEnabled())
{
logger.debug("ImageMagick executed successfully: \n" + executer);
}
}
示例2: transformInternal
import org.alfresco.service.cmr.repository.TransformationOptions; //导入方法依赖的package包/类
/**
* Transform the pdf content from the source file to the target file
*/
private void transformInternal(File sourceFile, String sourceMimetype, File targetFile, String targetMimetype, TransformationOptions options) throws Exception
{
Map<String, String> properties = new HashMap<String, String>(5);
// set properties
if (options instanceof ImageTransformationOptions)
{
ImageTransformationOptions imageOptions = (ImageTransformationOptions) options;
ImageResizeOptions resizeOptions = imageOptions.getResizeOptions();
String commandOptions = imageOptions.getCommandOptions();
if (commandOptions == null)
{
commandOptions = "";
}
if(resizeOptions != null)
{
if (resizeOptions.getHeight() > -1)
{
commandOptions += " --height=" + resizeOptions.getHeight();
}
if (resizeOptions.getWidth() > -1)
{
commandOptions += " --width=" + resizeOptions.getHeight();
}
if (resizeOptions.getAllowEnlargement())
{
commandOptions += " --allow-enlargement";
}
if (resizeOptions.isMaintainAspectRatio())
{
commandOptions += " --maintain-aspect-ratio";
}
}
commandOptions += " --page=" + getSourcePageRange(imageOptions, sourceMimetype, targetMimetype);
properties.put(KEY_OPTIONS, commandOptions);
}
properties.put(VAR_SOURCE, sourceFile.getAbsolutePath());
properties.put(VAR_TARGET, targetFile.getAbsolutePath());
// execute the statement
long timeoutMs = options.getTimeoutMs();
RuntimeExec.ExecutionResult result = executer.execute(properties, timeoutMs);
if (result.getExitValue() != 0 && result.getStdErr() != null && result.getStdErr().length() > 0)
{
throw new ContentIOException("Failed to perform alfresco-pdf-renderer transformation: \n" + result);
}
// success
if (logger.isDebugEnabled())
{
logger.debug("alfresco-pdf-renderer executed successfully: \n" + executer);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:58,代码来源:AlfrescoPdfRendererContentTransformerWorker.java