mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2026-04-23 22:30:28 +00:00
ACS-10505 registrymodifications.xcu is predefined
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<oor:items xmlns:oor="http://openoffice.org/2001/registry"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<item oor:path="/org.openoffice.Office.Common/Security/Scripting">
|
||||
<prop oor:name="BlockUntrustedRefererLinks" oor:op="fuse">
|
||||
<value>true</value>
|
||||
</prop>
|
||||
</item>
|
||||
</oor:items>
|
||||
@@ -28,15 +28,18 @@
|
||||
package org.alfresco.transform.libreoffice.patch;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
|
||||
/**
|
||||
* Manages LibreOffice user profile templates for transformations.
|
||||
@@ -75,10 +78,37 @@ public class LibreOfficeProfileManager
|
||||
{
|
||||
try
|
||||
{
|
||||
File resourceDir = ResourceUtils.getFile(classpathTemplateDir);
|
||||
|
||||
String baseDir = classpathTemplateDir.replace("classpath:", ""); // root folder on classpath
|
||||
|
||||
Path tempDir = Files.createTempDirectory(DEFAULT_LO_TEMPLATE_PROFILE);
|
||||
FileUtils.copyDirectory(resourceDir, tempDir.toFile());
|
||||
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
Resource[] resources = resolver.getResources(classpathTemplateDir + "/**");
|
||||
|
||||
for (Resource resource : resources)
|
||||
{
|
||||
|
||||
// skip directories or empty resources
|
||||
if (!resource.isReadable() || resource.contentLength() == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// get the path relative to the base folder
|
||||
String url = resource.getURL().toString();
|
||||
String relative = url.substring(url.indexOf(baseDir) + baseDir.length() + 1);
|
||||
|
||||
Path target = tempDir.resolve(relative);
|
||||
Files.createDirectories(target.getParent());
|
||||
|
||||
try (InputStream in = resource.getInputStream())
|
||||
{
|
||||
Files.copy(in, target, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
|
||||
this.classPathRegistryFile = tempDir.toString();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user