mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.0 to HEAD
5110: AR-1166 5111: AR-729 5112: AR-1217 5113: RM email propery extraction git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5313 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -231,9 +231,6 @@ public abstract class AbstractContentTransformer implements ContentTransformer
|
|||||||
// begin timing
|
// begin timing
|
||||||
long before = System.currentTimeMillis();
|
long before = System.currentTimeMillis();
|
||||||
|
|
||||||
// check the reliability
|
|
||||||
checkReliability(reader, writer);
|
|
||||||
|
|
||||||
// check options map
|
// check options map
|
||||||
if (options == null)
|
if (options == null)
|
||||||
{
|
{
|
||||||
@@ -242,6 +239,10 @@ public abstract class AbstractContentTransformer implements ContentTransformer
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Check the reliability
|
||||||
|
checkReliability(reader, writer);
|
||||||
|
|
||||||
|
// Transform
|
||||||
transformInternal(reader, writer, options);
|
transformInternal(reader, writer, options);
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
|
@@ -184,6 +184,14 @@ public class ContentTransformerRegistry
|
|||||||
ContentTransformer bestTransformer = null;
|
ContentTransformer bestTransformer = null;
|
||||||
for (ContentTransformer transformer : transformers)
|
for (ContentTransformer transformer : transformers)
|
||||||
{
|
{
|
||||||
|
// Reliability can be dynamic, i.e. it may have become unreliable
|
||||||
|
double reliability = transformer.getReliability(sourceMimetype, targetMimetype);
|
||||||
|
if (reliability == 0.0)
|
||||||
|
{
|
||||||
|
// It is unreliable now.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
long transformationTime = transformer.getTransformationTime();
|
long transformationTime = transformer.getTransformationTime();
|
||||||
// is it better?
|
// is it better?
|
||||||
if (bestTransformer == null || transformationTime < bestTime)
|
if (bestTransformer == null || transformationTime < bestTime)
|
||||||
|
@@ -61,6 +61,8 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
|
|||||||
private static Log logger = LogFactory.getLog(OpenOfficeContentTransformer.class);
|
private static Log logger = LogFactory.getLog(OpenOfficeContentTransformer.class);
|
||||||
|
|
||||||
private OpenOfficeConnection connection;
|
private OpenOfficeConnection connection;
|
||||||
|
/** Keep track of the initial connection state */
|
||||||
|
private boolean initiallyConnected;
|
||||||
private OpenOfficeDocumentConverter converter;
|
private OpenOfficeDocumentConverter converter;
|
||||||
private String documentFormatsConfiguration;
|
private String documentFormatsConfiguration;
|
||||||
private DocumentFormatRegistry formatRegistry;
|
private DocumentFormatRegistry formatRegistry;
|
||||||
@@ -89,23 +91,28 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
|
|||||||
return connection.isConnected();
|
return connection.isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void connect()
|
private synchronized boolean connect()
|
||||||
{
|
{
|
||||||
|
boolean success = false;
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
{
|
{
|
||||||
// just leave it
|
// just leave it
|
||||||
|
success = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connection.connect();
|
connection.connect();
|
||||||
|
success = true;
|
||||||
}
|
}
|
||||||
catch (ConnectException e)
|
catch (ConnectException e)
|
||||||
{
|
{
|
||||||
logger.warn(e.getMessage());
|
logger.warn(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Done
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -113,12 +120,6 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
|
|||||||
{
|
{
|
||||||
PropertyCheck.mandatory("OpenOfficeContentTransformer", "connection", connection);
|
PropertyCheck.mandatory("OpenOfficeContentTransformer", "connection", connection);
|
||||||
|
|
||||||
// attempt to establish a connection
|
|
||||||
connect();
|
|
||||||
|
|
||||||
// set up the converter
|
|
||||||
converter = new OpenOfficeDocumentConverter(connection);
|
|
||||||
|
|
||||||
// load the document conversion configuration
|
// load the document conversion configuration
|
||||||
if (documentFormatsConfiguration != null)
|
if (documentFormatsConfiguration != null)
|
||||||
{
|
{
|
||||||
@@ -139,7 +140,13 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
|
|||||||
formatRegistry = new XmlDocumentFormatRegistry();
|
formatRegistry = new XmlDocumentFormatRegistry();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isConnected())
|
// attempt to establish a connection
|
||||||
|
initiallyConnected = connect();
|
||||||
|
|
||||||
|
// set up the converter
|
||||||
|
converter = new OpenOfficeDocumentConverter(connection);
|
||||||
|
|
||||||
|
if (initiallyConnected)
|
||||||
{
|
{
|
||||||
// If the server starts with OO running, then it will attempt reconnections. Otherwise it will
|
// If the server starts with OO running, then it will attempt reconnections. Otherwise it will
|
||||||
// just be wasting time trying to see if a connection is available all the time.
|
// just be wasting time trying to see if a connection is available all the time.
|
||||||
@@ -154,8 +161,17 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
|
|||||||
{
|
{
|
||||||
if (!isConnected())
|
if (!isConnected())
|
||||||
{
|
{
|
||||||
|
if (!initiallyConnected)
|
||||||
|
{
|
||||||
|
// It wasn't there to start with, so we won't bother trying to connect
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
// The connection may have gone away, so attempt to get it again
|
||||||
|
if (!connect())
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// there are some conversions that fail, despite the converter believing them possible
|
// there are some conversions that fail, despite the converter believing them possible
|
||||||
if (targetMimetype.equals(MimetypeMap.MIMETYPE_XHTML))
|
if (targetMimetype.equals(MimetypeMap.MIMETYPE_XHTML))
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
package org.alfresco.repo.forum;
|
package org.alfresco.repo.forum;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -179,7 +180,8 @@ public class DiscussableAspect
|
|||||||
ContentModel.PROP_VERSION_LABEL);
|
ContentModel.PROP_VERSION_LABEL);
|
||||||
if (labelProp == null)
|
if (labelProp == null)
|
||||||
{
|
{
|
||||||
topicName = childName + " - " + new Date();
|
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss");
|
||||||
|
topicName = childName + " - " + dateFormat.format(new Date());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user