Merged BRANCHES/V3.2 to HEAD:

19177: (RECORD ONLY) Updated record-only entries for V3.1 branch
   19321: (RECORD ONLY) Removed deep svn:mergeinfo
   19331: (RECORD ONLY) Merged HEAD to BRANCHES/V3.2:
        19324: Follow-up on ALF-765 by upgrading EHCache to 2.0.0Performing merge across the whole of the branch
   19526: Moved ContentServicePolicy static QNames onto policy classes
   19539: (RECORD ONLY) Merged HEAD to V3.2
         19538: Build fix - fix build speed
   19541: Added extraction of custom, mapped metadata from PDF documents
   19543: (RECORD ONLY) Removed deep svn:mergeinfo
   19598: (RECORD ONLY) Backported (merge not possible) HEAD rev 18790 for IndexInfo fixes
   19626: Fix for ALF-732:  Possible memory leak using the .getNodeRefs() method against a ResultSet ...
   19629: (RECORD ONLY) Merged HEAD to V3.2
        19625: Fix to allow Share logo to swapped out for a different one without having to modify the header CSS.
        19628: Corrected Share header component height.
   19649: ALF-885: Cannot retrieve cm:title from an AVM node in FreeMarker (if persisted with actual type set to MLText)
   19694: (RECORD ONLY) Merged V3.2 to HEAD: r19310 bad back merge - record-only
   19713: (RECORD ONLY) Removed svn:mergeinfo


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19719 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-04-01 01:05:03 +00:00
parent f11ce22967
commit f27434f2c6
10 changed files with 562 additions and 513 deletions

View File

@@ -32,9 +32,11 @@ import org.alfresco.service.namespace.QName;
*/
public interface ContentServicePolicies
{
/** The QName's of the policies */
/** @deprecated Use {@link OnContentUpdatePolicy#QNAME} */
public static final QName ON_CONTENT_UPDATE = QName.createQName(NamespaceService.ALFRESCO_URI, "onContentUpdate");
/** @deprecated Use {@link OnContentPropertyUpdatePolicy#QNAME} */
public static final QName ON_CONTENT_PROPERTY_UPDATE = QName.createQName(NamespaceService.ALFRESCO_URI, "onContentPropertyUpdate");
/** @deprecated Use {@link OnContentReadPolicy#QNAME} */
public static final QName ON_CONTENT_READ = QName.createQName(NamespaceService.ALFRESCO_URI, "onContentRead");
/**
@@ -44,6 +46,7 @@ public interface ContentServicePolicies
*/
public interface OnContentUpdatePolicy extends ClassPolicy
{
public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onContentUpdate");
/**
* @param nodeRef the node reference
*/
@@ -59,6 +62,7 @@ public interface ContentServicePolicies
*/
public interface OnContentPropertyUpdatePolicy extends ClassPolicy
{
public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onContentPropertyUpdate");
/**
* @param nodeRef the node reference
* @param propertyQName the name of the property that changed
@@ -86,6 +90,7 @@ public interface ContentServicePolicies
*/
public interface OnContentReadPolicy extends ClassPolicy
{
public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onContentRead");
/**
* @param nodeRef the node reference
*/

View File

@@ -42,6 +42,7 @@ import org.apache.pdfbox.pdmodel.PDDocumentInformation;
* <b>title:</b> -- cm:title
* <b>subject:</b> -- cm:description
* <b>created:</b> -- cm:created
* <b>Any custom property:</b> -- [not mapped]
* </pre>
*
* TIKA Note - all the fields (plus a few others) are present
@@ -125,6 +126,17 @@ public class PdfBoxMetadataExtracter extends AbstractMappingMetadataExtracter
putRawValue(KEY_CREATED, parsedDate, rawProperties);
}
}
// Extract remaining custom properties
for (String customProp : super.getMapping().keySet())
{
if (rawProperties.keySet().contains(customProp))
{
// Ignore it
continue;
}
String customValue = docInfo.getCustomMetadataValue(customProp);
putRawValue(customProp, customValue, rawProperties);
}
}
}
finally

View File

@@ -231,7 +231,7 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
{
// Register interest in the onContentUpdate policy for the dictionary model type
policyComponent.bindClassBehaviour(
ContentServicePolicies.ON_CONTENT_UPDATE,
ContentServicePolicies.OnContentUpdatePolicy.QNAME,
ContentModel.TYPE_DICTIONARY_MODEL,
new JavaBehaviour(this, "onContentUpdate"));

View File

@@ -44,6 +44,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.Path;
import org.alfresco.service.cmr.repository.Period;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.cmr.repository.datatype.TypeConverter.Converter;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.EqualsHelper;
import org.alfresco.util.VersionNumber;
@@ -268,12 +269,36 @@ public class PropertyValue implements Cloneable, Serializable
return ValueType.STRING;
}
}
else if (value instanceof String)
{
return ValueType.STRING;
}
return ValueType.DB_ATTRIBUTE;
}
@SuppressWarnings("unchecked")
@Override
Serializable convert(Serializable value)
{
// NOTE: since 2.2.1, PropertyValue is only used by AVM (which does not natively support MLText, other than single/default string)
if (value != null)
{
if (value instanceof String)
{
return value;
}
else if (value instanceof MLText)
{
if (((MLText)value).size() <= 1)
{
return (String)((Converter<MLText, String>)DefaultTypeConverter.INSTANCE.getConverter(MLText.class, String.class)).convert((MLText)value);
}
else
{
throw new UnsupportedOperationException("PropertyValue MLText is not supported for AVM");
}
}
}
return DefaultTypeConverter.INSTANCE.convert(MLText.class, value);
}
},

View File

@@ -37,7 +37,6 @@ import org.springframework.context.ApplicationContext;
*/
public class PropertyValueTest extends TestCase
{
@SuppressWarnings("unused")
private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
public void testMLText()
@@ -54,11 +53,21 @@ public class PropertyValueTest extends TestCase
PropertyValue propertyValue = new PropertyValue(DataTypeDefinition.MLTEXT, mlText);
assertNotNull("MLText not persisted as a string", propertyValue.getStringValue());
// multiple languages
mlText = new MLText(Locale.GERMAN, "hallo");
mlText.addValue(Locale.ITALIAN, "ciao");
propertyValue = new PropertyValue(DataTypeDefinition.MLTEXT, mlText);
assertNotNull("MLText not persisted as an attribute", propertyValue.getAttributeValue());
try
{
// multiple languages
mlText = new MLText(Locale.GERMAN, "hallo");
mlText.addValue(Locale.ITALIAN, "ciao");
propertyValue = new PropertyValue(DataTypeDefinition.MLTEXT, mlText);
assertNotNull("MLText not persisted as an attribute", propertyValue.getAttributeValue());
fail();
}
catch (UnsupportedOperationException uoe)
{
// expected
// NOTE: since 2.2.1, PropertyValue is only used by AVM (which does not natively support MLText, other than single/default string)
}
return null;
}

View File

@@ -76,7 +76,7 @@ public class OnContentUpdateRuleTrigger extends RuleTriggerAbstractBase
{
// Bind behaviour
this.policyComponent.bindClassBehaviour(
ContentServicePolicies.ON_CONTENT_UPDATE,
ContentServicePolicies.OnContentUpdatePolicy.QNAME,
this,
new JavaBehaviour(this, "onContentUpdate"));
}

View File

@@ -18,6 +18,7 @@
*/
package org.alfresco.repo.security.permissions.impl.acegi;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.ListIterator;
@@ -120,26 +121,20 @@ public class FilteringResultSet extends ACLEntryAfterInvocationProvider implemen
public List<NodeRef> getNodeRefs()
{
List<NodeRef> answer = unfiltered.getNodeRefs();
for (int i = unfiltered.length() - 1; i >= 0; i--)
ArrayList<NodeRef> answer = new ArrayList<NodeRef>(length());
for(ResultSetRow row : this)
{
if (!inclusionMask.get(i))
{
answer.remove(i);
}
answer.add(row.getNodeRef());
}
return answer;
}
public List<ChildAssociationRef> getChildAssocRefs()
{
List<ChildAssociationRef> answer = unfiltered.getChildAssocRefs();
for (int i = unfiltered.length() - 1; i >= 0; i--)
ArrayList<ChildAssociationRef> answer = new ArrayList<ChildAssociationRef>(length());
for(ResultSetRow row : this)
{
if (!inclusionMask.get(i))
{
answer.remove(i);
}
answer.add(row.getChildAssocRef());
}
return answer;
}

View File

@@ -81,6 +81,9 @@ public class FilteringResultSetTest extends TestCase
filtering.setIncluded(i, true);
assertEquals(1, filtering.length());
assertEquals("n"+i, filtering.getNodeRef(0).getId());
assertEquals(1, filtering.getNodeRefs().size());
assertEquals(1, filtering.getChildAssocRefs().size());
assertEquals("n"+i, filtering.getNodeRefs().get(0).getId());
filtering.setIncluded(i, false);
assertEquals(0, filtering.length());
}

View File

@@ -143,7 +143,7 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
new JavaBehaviour(this, "afterCreateVersion", Behaviour.NotificationFrequency.EVERY_EVENT));
this.policyComponent.bindClassBehaviour(
ContentServicePolicies.ON_CONTENT_UPDATE,
ContentServicePolicies.OnContentUpdatePolicy.QNAME,
ContentModel.ASPECT_VERSIONABLE,
new JavaBehaviour(this, "onContentUpdate", Behaviour.NotificationFrequency.TRANSACTION_COMMIT));

View File

@@ -71,7 +71,7 @@ public class WorkflowDefinitionType implements ContentServicePolicies.OnContentU
{
// Register interest in the onContentUpdate policy for the workflow definition type
policyComponent.bindClassBehaviour(
ContentServicePolicies.ON_CONTENT_UPDATE,
ContentServicePolicies.OnContentUpdatePolicy.QNAME,
WorkflowModel.TYPE_WORKFLOW_DEF,
new JavaBehaviour(this, "onContentUpdate"));