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
|
||||
long before = System.currentTimeMillis();
|
||||
|
||||
// check the reliability
|
||||
checkReliability(reader, writer);
|
||||
|
||||
// check options map
|
||||
if (options == null)
|
||||
{
|
||||
@@ -242,6 +239,10 @@ public abstract class AbstractContentTransformer implements ContentTransformer
|
||||
|
||||
try
|
||||
{
|
||||
// Check the reliability
|
||||
checkReliability(reader, writer);
|
||||
|
||||
// Transform
|
||||
transformInternal(reader, writer, options);
|
||||
}
|
||||
catch (Throwable e)
|
||||
|
@@ -184,6 +184,14 @@ public class ContentTransformerRegistry
|
||||
ContentTransformer bestTransformer = null;
|
||||
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();
|
||||
// is it better?
|
||||
if (bestTransformer == null || transformationTime < bestTime)
|
||||
|
@@ -61,6 +61,8 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
|
||||
private static Log logger = LogFactory.getLog(OpenOfficeContentTransformer.class);
|
||||
|
||||
private OpenOfficeConnection connection;
|
||||
/** Keep track of the initial connection state */
|
||||
private boolean initiallyConnected;
|
||||
private OpenOfficeDocumentConverter converter;
|
||||
private String documentFormatsConfiguration;
|
||||
private DocumentFormatRegistry formatRegistry;
|
||||
@@ -89,23 +91,28 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
|
||||
return connection.isConnected();
|
||||
}
|
||||
|
||||
private synchronized void connect()
|
||||
private synchronized boolean connect()
|
||||
{
|
||||
boolean success = false;
|
||||
if (isConnected())
|
||||
{
|
||||
// just leave it
|
||||
success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
connection.connect();
|
||||
success = true;
|
||||
}
|
||||
catch (ConnectException e)
|
||||
{
|
||||
logger.warn(e.getMessage());
|
||||
}
|
||||
}
|
||||
// Done
|
||||
return success;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,12 +120,6 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
|
||||
{
|
||||
PropertyCheck.mandatory("OpenOfficeContentTransformer", "connection", connection);
|
||||
|
||||
// attempt to establish a connection
|
||||
connect();
|
||||
|
||||
// set up the converter
|
||||
converter = new OpenOfficeDocumentConverter(connection);
|
||||
|
||||
// load the document conversion configuration
|
||||
if (documentFormatsConfiguration != null)
|
||||
{
|
||||
@@ -139,7 +140,13 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
|
||||
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
|
||||
// just be wasting time trying to see if a connection is available all the time.
|
||||
@@ -154,7 +161,16 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
|
||||
{
|
||||
if (!isConnected())
|
||||
{
|
||||
return 0.0;
|
||||
if (!initiallyConnected)
|
||||
{
|
||||
// It wasn't there to start with, so we won't bother trying to connect
|
||||
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
|
||||
|
@@ -26,6 +26,7 @@
|
||||
package org.alfresco.repo.forum;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -179,7 +180,8 @@ public class DiscussableAspect
|
||||
ContentModel.PROP_VERSION_LABEL);
|
||||
if (labelProp == null)
|
||||
{
|
||||
topicName = childName + " - " + new Date();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss");
|
||||
topicName = childName + " - " + dateFormat.format(new Date());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user