本文整理汇总了Java中org.alfresco.service.cmr.repository.TransformationOptions类的典型用法代码示例。如果您正苦于以下问题:Java TransformationOptions类的具体用法?Java TransformationOptions怎么用?Java TransformationOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransformationOptions类属于org.alfresco.service.cmr.repository包,在下文中一共展示了TransformationOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: debugTransformations
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* Checks if the file just uploaded into Share is a special "debugTransformers.txt" file and
* if it is creates TransformerDebug that lists all the supported mimetype transformation for
* each transformer.
*/
private void debugTransformations(String sourceMimetype, String targetMimetype,
long sourceSize, TransformationOptions transformOptions)
{
// check the file name
if (MimetypeMap.MIMETYPE_TEXT_PLAIN.equals(sourceMimetype) &&
MimetypeMap.MIMETYPE_IMAGE_PNG.equals(targetMimetype))
{
String fileName = transformerDebug.getFileName(transformOptions, true, 0);
if (fileName != null && fileName.contains("debugTransformers.txt"))
{
transformerDebug.transformationsByTransformer(null, false, false, null);
transformerDebug.transformationsByExtension(null, null, false, false, false, null);
}
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:ContentServiceImpl.java
示例2: createThumbnailNode
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
private NodeRef createThumbnailNode(final NodeRef node, final QName contentProperty,
final String mimetype, final TransformationOptions transformationOptions, final String thumbnailName,
final ThumbnailParentAssociationDetails assocDetails)
{
// Get the name of the thumbnail and add to properties map
QName thumbnailQName = getThumbnailQName(thumbnailName);
RenditionDefinition definition = createRenditionDefinition(contentProperty, mimetype,
transformationOptions, thumbnailQName, assocDetails);
try
{
ChildAssociationRef thumbnailAssoc = renditionService.render(node, definition);
NodeRef thumbnail = getThumbnailNode(thumbnailAssoc);
setThumbnailNameProperty(thumbnail, thumbnailName);
return thumbnail;
} catch (RenditionServiceException rsx)
{
throw new ThumbnailException(rsx.getMessage(), rsx);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ThumbnailServiceImpl.java
示例3: isThumbnailDefinitionAvailable
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* Checks to see if at this moment in time, the specified {@link ThumbnailDefinition}
* is able to thumbnail the source mimetype. Typically used with Thumbnail Definitions
* retrieved by name, and/or when dealing with transient {@link ContentTransformer}s.
* @param sourceUrl The URL of the source (optional)
* @param sourceMimetype The source mimetype
* @param sourceSize the size (in bytes) of the source. Use -1 if unknown.
* @param sourceNodeRef which is set in a copy of the thumbnailDefinition transformation options,
* so that it may be used by transformers and debug.
* @param thumbnailDefinition The {@link ThumbnailDefinition} to check for
*/
public boolean isThumbnailDefinitionAvailable(String sourceUrl, String sourceMimetype, long sourceSize, NodeRef sourceNodeRef, ThumbnailDefinition thumbnailDefinition)
{
// Copy the thumbnail's TransformationOptions and set the sourceNodeRef, for use by transformers and debug.
TransformationOptions options = thumbnailDefinition.getTransformationOptions().deepCopy();
options.setSourceNodeRef(sourceNodeRef);
// Log the following getTransform() as trace so we can see the wood for the trees
boolean orig = TransformerDebug.setDebugOutput(false);
try
{
return this.contentService.getTransformer(
sourceUrl,
sourceMimetype,
sourceSize,
thumbnailDefinition.getMimetype(), options
) != null;
}
finally
{
TransformerDebug.setDebugOutput(orig);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:ThumbnailRegistry.java
示例4: testIsTransformable
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
public void testIsTransformable() throws Exception
{
assertFalse(transformer.isTransformable(MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING, -1, MimetypeMap.MIMETYPE_HTML, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING, -1, MimetypeMap.MIMETYPE_XML, new TransformationOptions()));
assertFalse(transformer.isTransformable(MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, MimetypeMap.MIMETYPE_OPENXML_PRESENTATION, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OPENXML_PRESENTATION, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OPENXML_PRESENTATION, -1, MimetypeMap.MIMETYPE_HTML, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OPENXML_PRESENTATION, -1, MimetypeMap.MIMETYPE_XML, new TransformationOptions()));
assertFalse(transformer.isTransformable(MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, MimetypeMap.MIMETYPE_OPENXML_SPREADSHEET, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OPENXML_SPREADSHEET, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OPENXML_SPREADSHEET, -1, MimetypeMap.MIMETYPE_HTML, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OPENXML_SPREADSHEET, -1, MimetypeMap.MIMETYPE_XML, new TransformationOptions()));
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:PoiOOXMLContentTransformerTest.java
示例5: transform
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
@Override
public void transform(ContentReader reader, ContentWriter writer, TransformationOptions options) throws Exception {
String sourceMimetype = getMimetype(reader);
String targetMimetype = getMimetype(writer);
String sourceExtension = getMimetypeService().getExtension(sourceMimetype);
String targetExtension = getMimetypeService().getExtension(targetMimetype);
if (sourceExtension == null || targetExtension == null)
{
throw new AlfrescoRuntimeException("Unknown extensions for mimetypes: \n" +
" source mimetype: " + sourceMimetype + "\n" +
" source extension: " + sourceExtension + "\n" +
" target mimetype: " + targetMimetype + "\n" +
" target extension: " + targetExtension);
}
File sourceFile = TempFileProvider.createTempFile(getClass().getSimpleName() + "_source_", "." + sourceExtension);
File targetFile = TempFileProvider.createTempFile(getClass().getSimpleName() + "_target_", "." + targetExtension);
reader.getContent(sourceFile);
convertToPDF(sourceFile, targetFile);
writer.putContent(targetFile);
}
开发者ID:keensoft,项目名称:alfresco-zip-previewer,代码行数:26,代码来源:CompressContentTransformerWorker.java
示例6: isTransformableSize
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* Indicates if this transformer is able to transform the given {@code sourceSize}.
* The {@code maxSourceSizeKBytes} property may indicate that only small source files
* may be transformed.
* @param sourceSize size in bytes of the source. If negative, the source size is unknown.
* @return {@code true} if the source is transformable.
*/
@Override
public boolean isTransformableSize(String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options)
{
boolean sizeOkay = true;
if (sourceSize >= 0)
{
// if maxSourceSizeKBytes == 0 this implies the transformation is disabled
long maxSourceSizeKBytes = getMaxSourceSizeKBytes(sourceMimetype, targetMimetype, options);
sizeOkay = maxSourceSizeKBytes < 0 || (maxSourceSizeKBytes > 0 && sourceSize <= maxSourceSizeKBytes*1024);
if (!sizeOkay && transformerDebug.isEnabled())
{
transformerDebug.unavailableTransformer(this, sourceMimetype, targetMimetype, maxSourceSizeKBytes);
}
}
return sizeOkay;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:AbstractContentTransformerLimits.java
示例7: getMaxSourceSizeKBytes
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* Returns the maximum source size (in KBytes) allowed given the supplied values.
* @return 0 if the the transformation is disabled, -1 if there is no limit, otherwise the size in KBytes.
*/
@Override
public long getMaxSourceSizeKBytes(String sourceMimetype, String targetMimetype, TransformationOptions options)
{
long maxSourceSizeKBytes = -1;
// The maxSourceSizeKbytes value is ignored if this transformer is able to use
// page limits and the limits include a pageLimit. Normally used in the creation
// of icons. Note the readLimitKBytes value is not checked as the combined limits
// only have the max or limit KBytes value set (the smaller value is returned).
TransformationOptionLimits limits = getLimits(sourceMimetype, targetMimetype, options);
if (!isPageLimitSupported(sourceMimetype, targetMimetype, options) || limits.getPageLimit() <= 0)
{
maxSourceSizeKBytes = limits.getMaxSourceSizeKBytes();
}
return maxSourceSizeKBytes;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:AbstractContentTransformerLimits.java
示例8: testIsTransformable
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
public void testIsTransformable() throws Exception
{
assertFalse(transformer.isTransformable(MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, MimetypeMap.MIMETYPE_WORD, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_WORD, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_WORD, -1, MimetypeMap.MIMETYPE_HTML, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_WORD, -1, MimetypeMap.MIMETYPE_XML, new TransformationOptions()));
assertFalse(transformer.isTransformable(MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, MimetypeMap.MIMETYPE_PPT, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_PPT, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_PPT, -1, MimetypeMap.MIMETYPE_HTML, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_PPT, -1, MimetypeMap.MIMETYPE_XML, new TransformationOptions()));
assertFalse(transformer.isTransformable(MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, MimetypeMap.MIMETYPE_OUTLOOK_MSG, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OUTLOOK_MSG, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OUTLOOK_MSG, -1, MimetypeMap.MIMETYPE_HTML, new TransformationOptions()));
assertTrue(transformer.isTransformable(MimetypeMap.MIMETYPE_OUTLOOK_MSG, -1, MimetypeMap.MIMETYPE_XML, new TransformationOptions()));
// Doesn't claim excel
assertFalse(transformer.isTransformable(MimetypeMap.MIMETYPE_EXCEL, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions()));
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:PoiContentTransformerTest.java
示例9: isSupportedTransformation
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* See {@link TransformerConfig#isSupportedTransformation(ContentTransformer, String, String, TransformationOptions)}.
*/
public boolean isSupportedTransformation(ContentTransformer transformer, String sourceMimetype,
String targetMimetype, TransformationOptions options)
{
if (sourceMimetype == null)
{
sourceMimetype = ANY;
}
if (targetMimetype == null)
{
targetMimetype = ANY;
}
boolean isSupported = true;
String name = transformer.getName();
SupportedAndUnsupportedTransformations supportedBytransformer = supported.get(name);
if (supportedBytransformer != null)
{
isSupported = supportedBytransformer.isSupported(sourceMimetype, targetMimetype);
}
return isSupported;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:TransformerConfigSupported.java
示例10: isTransformableMimetype
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* Can we do the requested transformation via Tika?
* We support transforming to HTML, XML or Text
*/
@Override
public boolean isTransformableMimetype(String sourceMimetype, String targetMimetype, TransformationOptions options)
{
if(! sourceMimeTypes.contains(sourceMimetype))
{
// The source isn't one of ours
return false;
}
if (TARGET_MIMETYPES.contains(targetMimetype))
{
// We can output to this
return true;
}
else
{
// We support the source, but not the target
return false;
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:TikaPoweredContentTransformer.java
示例11: findTransformers
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* Returns the list of possible transformers for the transformation.
*/
private List<TransformerSortData> findTransformers(List<ContentTransformer> allTransformers, String sourceMimetype,
long sourceSize, String targetMimetype, TransformationOptions options)
{
List<TransformerSortData> transformers = new ArrayList<TransformerSortData>(8);
for (ContentTransformer transformer : allTransformers)
{
int priority = transformerConfig.getPriority(transformer, sourceMimetype, targetMimetype);
if (priority > 0 &&
transformer.isTransformable(sourceMimetype, sourceSize, targetMimetype, options) == true)
{
transformers.add(new TransformerSortData(transformer, sourceMimetype, targetMimetype, priority));
}
}
return transformers;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:TransformerSelectorImpl.java
示例12: isExplicitTransformation
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* @see org.alfresco.repo.content.transform.ContentTransformer#isTransformable(java.lang.String, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions)
*/
@SuppressWarnings("deprecation")
public boolean isExplicitTransformation(String sourceMimetype, String targetMimetype, TransformationOptions options)
{
boolean result = false;
if (this.explicitTransformations != null)
{
for (ContentTransformerRegistry.TransformationKey transformationKey : this.explicitTransformations)
{
if (transformationKey.getSourceMimetype().equals(sourceMimetype) == true &&
transformationKey.getTargetMimetype().equals(targetMimetype) == true)
{
result = true;
break;
}
}
}
return result;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:AbstractContentTransformer.java
示例13: isTransformableMimetype
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* Only supports Text to PDF
*/
@Override
public boolean isTransformableMimetype(String sourceMimetype, String targetMimetype, TransformationOptions options)
{
if ( (!MimetypeMap.MIMETYPE_TEXT_PLAIN.equals(sourceMimetype) &&
!MimetypeMap.MIMETYPE_TEXT_CSV.equals(sourceMimetype) &&
!MimetypeMap.MIMETYPE_DITA.equals(sourceMimetype) &&
!MimetypeMap.MIMETYPE_XML.equals(sourceMimetype) ) ||
!MimetypeMap.MIMETYPE_PDF.equals(targetMimetype))
{
// only support (text/plain OR text/csv OR text/xml) to (application/pdf)
return false;
}
else
{
return true;
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:TextToPdfContentTransformer.java
示例14: transformInternal
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
public void transformInternal(ContentReader reader, ContentWriter writer, TransformationOptions options)
throws Exception
{
// We can only work from a file
File htmlFile = TempFileProvider.createTempFile("HtmlParserContentTransformer_", ".html");
reader.getContent(htmlFile);
// Fetch the encoding of the HTML, as set in the ContentReader
// This will default to 'UTF-8' if not specifically set
String encoding = reader.getEncoding();
// Create the extractor
EncodingAwareStringBean extractor = new EncodingAwareStringBean();
extractor.setCollapse(false);
extractor.setLinks(false);
extractor.setReplaceNonBreakingSpaces(false);
extractor.setURL(htmlFile, encoding);
// get the text
String text = extractor.getStrings();
// write it to the writer
writer.putContent(text);
// Tidy up
htmlFile.delete();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:HtmlParserContentTransformer.java
示例15: isTransformableMimetype
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
public boolean isTransformableMimetype(String sourceMimetype, String targetMimetype, TransformationOptions options)
{
if (disable) {
return false;
}
if (this.sourceMimetype.equals(sourceMimetype)
&& this.targetMimetype.equals(targetMimetype))
{
return true;
}
else
{
return false;
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:ContentTransformerRegistryTest.java
示例16: 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);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:ThumbnailDefinition.java
示例17: testReliability
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
public void testReliability() throws Exception
{
transformer.setPageLimit(-1);
transformer.register();
boolean reliability = transformer.isTransformable(MimetypeMap.MIMETYPE_PDF, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions());
assertEquals("Mimetype should not be supported", false, reliability);
reliability = transformer.isTransformable(MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, MimetypeMap.MIMETYPE_PDF, new TransformationOptions());
assertEquals("Mimetype should be supported", true, reliability);
reliability = transformer.isTransformable(MimetypeMap.MIMETYPE_XML, -1, MimetypeMap.MIMETYPE_PDF, new TransformationOptions());
assertEquals("Mimetype should be supported", true, reliability);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:TextToPdfContentTransformerTest.java
示例18: newTransformationOptions
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
@Override
protected TransformationOptions newTransformationOptions(Action ruleAction, NodeRef sourceNodeRef)
{
ImageTransformationOptions options = new ImageTransformationOptions();
options.setSourceNodeRef(sourceNodeRef);
options.setSourceContentProperty(ContentModel.PROP_NAME);
options.setTargetContentProperty(ContentModel.PROP_NAME);
String convertCommand = (String) ruleAction.getParameterValue(PARAM_CONVERT_COMMAND);
options.setCommandOptions(convertCommand);
return options;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:ImageTransformActionExecuter.java
示例19: isTransformable
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* {@inheritDoc}<p>
*
* Implementation calls the deprecated overloaded method without the sourceSize parameter.
* Note: source size checked has not been added to this deprecated class.
*/
@Override
public boolean isTransformable(String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options)
{
return
isTransformableMimetype(sourceMimetype, targetMimetype, options) &&
isTransformableSize(sourceMimetype, sourceSize, targetMimetype, options);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:AbstractContentTransformer.java
示例20: matchMimetypeOptions
import org.alfresco.service.cmr.repository.TransformationOptions; //导入依赖的package包/类
/**
* Determine whether the thumbnail meta-data matches the given mimetype and options
*
* If mimetype and transformation options are null then match is guarenteed
*
* @param thumbnail thumbnail node reference
* @param mimetype mimetype
* @param options transformation options
* @return boolean true if the mimetype and options match the thumbnail metadata, false otherwise
*/
private boolean matchMimetypeOptions(NodeRef thumbnail, String mimetype, TransformationOptions options)
{
boolean result = true;
if (mimetype != null)
{
// Check the mimetype
String thumbnailMimetype = ((ContentData) this.nodeService.getProperty(thumbnail, ContentModel.PROP_CONTENT)).getMimetype();
if (mimetype.endsWith(SUBTYPES_POSTFIX))
{
String baseMimetype = mimetype.substring(0, mimetype.length() - SUBTYPES_POSTFIX.length());
if (thumbnailMimetype == null || thumbnailMimetype.startsWith(baseMimetype) == false)
{
result = false;
}
}
else
{
if (mimetype.equals(thumbnailMimetype) == false)
{
result = false;
}
}
}
if (result != false && options != null)
{
// TODO .. check for matching options here ...
}
return result;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:44,代码来源:ThumbnailServiceImpl.java
注:本文中的org.alfresco.service.cmr.repository.TransformationOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论