Merged V4.0-BUG-FIX to HEAD

33858: Fix for ALF-12674 CMIS LOWER fails with SOLR
   - also fixed ranges 
   - UPPER/LOWER only matches upper/lower case - they were doing a generic match
   33859: GERMAN: L10N updates based on EN rev 33523. Fixes:
      - ALF-12510, ALF-12498, ALF-12496
      - ALF-12495, ALF-12483, ALF-12477 
      - ALF-12472, ALF-12471, ALF-12470
   33860: FRENCH: L10N updates based on EN rev 33523. Fixes:
      - ALF-12510, ALF-12498, ALF-12496
      - ALF-12495, ALF-12483, ALF-12477 
      - ALF-12472, ALF-12471, ALF-12470
   33861: JAPANESE: L10N updates based on EN rev 33523. Fixes:
      - ALF-12510, ALF-12498, ALF-12496
      - ALF-12495, ALF-12483, ALF-12477 
      - ALF-12472, ALF-12471, ALF-12470
   33862: DUTCH: L10N updates based on EN rev 33523. Fixes:
      - ALF-12510, ALF-12498, ALF-12496
      - ALF-12495, ALF-12483, ALF-12477 
      - ALF-12472, ALF-12471, ALF-12470
   33892: ALF-11746 Tweak mimetype description sorting to be explicitly by description, case insensitive
   33897: Fix for ALF-12789 XAM clean JOB fails with SOLR search
   - HTTPClient as used by SOLR now includes connection stale check
   33902: Changed FileInfo to use flags value for pseudo file and delete on close, so values are copied by copyFrom().
   33904: Fixes: ALF-12794; Unescaped content error in delete event dialogue.
   33910: ALF-12701: Ensure that all action labels are encoded to prevent XSS attacks
   33913: Strip oplock request bits for pseudo files in the NTCreateAndX CIFS processing, so oplocks never granted to pseudo files.
   33920: A better fix for ALF-12794.
   33929: Merged V3.4-BUG-FIX to V4.0-BUG-FIX
      33871: ALF-12557: WCM - Webform file picker path doesn't take account of the current Webapp
      - Fix by Pavel
      33901: ALF-12815: Not possible to set versionType property when adding the aspect through nodeService.addAspect
      33909: Fix for NFS 'node does not exist' error when editing using vi. ALF-12712.
      33911: Merged V3.4 to V3.4-BUG-FIX
         33867: ALF-9899: Site creation time was still increasing linearly due to avm_child_entries queries not being able to use an index
         - Added new lc_name column - lower case version of the name which can be included in the primary key and queries
         - Added DB upgrade scripts
         33870: ALF-9899: Fixed indexing performance regression (e.g. during creation of 60,000 sites)
         - Apply more scoped cache invalidation for properties and aspects of a node in the current transaction, in line with parent associations
         - E.g. if I am querying aspects on a node already given a new parent association in the current transaction, there is no need to invalidate the parent assocs again when I find the aspects out of date!
         - This plus previous checkin means create site through Share UI back to 1 second (rather than 1 minute) with 30,000 sites
      33914: Merged V3.4 to V3.4-BUG-FIX
         33872: Merged V3.4-BUG-FIX to V3.4
            33843: Fix for ALF-12775
         33895: ALF-12816: Merged V4.0-BUG-FIX to 3.4
            33357: When installing a module the tool reads the war's version.properties file and will not install if the war version is outside the repoVersionMin or repoVersionMax
         33900: MMT fix: When the war has no version.properties file  (e.g. share) it does not error.
            Added a test case and empty.war
      33915: Merged V3.4 to V3.4-BUG-FIX (RECORD ONLY)
         33462: Merged V3.4-BUG-FIX to V3.4 (3.4.8)
         33896: ALF-9899: Reversed revisions 33867 and 33870 and rescheduled for 3.4 HF


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@33931 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-02-15 17:22:40 +00:00
parent ffb5aa8f40
commit a32ec35333
35 changed files with 280 additions and 121 deletions

View File

@@ -30,6 +30,7 @@ public class AVMChildEntryEntity
{
private Long parentNodeId;
private String name;
private String lowerName; // Derived from name for case insensitive lookups
private Long childNodeId;
public AVMChildEntryEntity()
@@ -41,6 +42,7 @@ public class AVMChildEntryEntity
{
this.parentNodeId = parentNodeId;
this.name = name;
this.lowerName = name == null ? null : name.toLowerCase();
this.childNodeId = childNodeId;
}
@@ -48,6 +50,7 @@ public class AVMChildEntryEntity
{
this.parentNodeId = parentNodeId;
this.name = name;
this.lowerName = name == null ? null : name.toLowerCase();
}
public AVMChildEntryEntity(long parentNodeId, long childNodeId)
@@ -74,8 +77,19 @@ public class AVMChildEntryEntity
public void setName(String name)
{
this.name = name;
this.lowerName = name == null ? null : name.toLowerCase();
}
public String getLowerName()
{
return lowerName;
}
public void setLowerName(String lowerName)
{
this.lowerName = lowerName;
}
public Long getChildId()
{
return childNodeId;

View File

@@ -37,16 +37,13 @@ import org.mybatis.spring.SqlSessionTemplate;
public class AVMNodeLinksDAOImpl extends AbstractAVMNodeLinksDAOImpl
{
private static final String SELECT_AVM_NODE_CHILD_ENTRY ="alfresco.avm.select_AVMChildEntry"; // parent + name + child
private static final String SELECT_AVM_NODE_CHILD_ENTRY_L ="alfresco.avm.select_AVMChildEntryL"; // parent + lower(name) + child
private static final String SELECT_AVM_NODE_CHILD_ENTRY_BY_PARENT_AND_NAME ="alfresco.avm.select_AVMChildEntryByParentAndName"; // parent + name
private static final String SELECT_AVM_NODE_CHILD_ENTRY_BY_PARENT_AND_NAME_L ="alfresco.avm.select_AVMChildEntryByParentAndNameL"; // parent + lower(name)
private static final String SELECT_AVM_NODE_CHILD_ENTRY_BY_PARENT_AND_CHILD ="alfresco.avm.select_AVMChildEntryByParentAndChild"; // parent + child
private static final String SELECT_AVM_NODE_CHILD_ENTRIES_BY_PARENT ="alfresco.avm.select_AVMNodeChildEntriesByParent"; // parent
private static final String SELECT_AVM_NODE_CHILD_ENTRIES_BY_PARENT_AND_NAME_PATTERN ="alfresco.avm.select_AVMNodeChildEntriesByParentAndNamePattern"; // parent + name pattern
private static final String SELECT_AVM_NODE_CHILD_ENTRIES_BY_PARENT_AND_NAME_PATTERN_L ="alfresco.avm.select_AVMNodeChildEntriesByParentAndNamePatternL"; // parent + lower(name pattern)
private static final String SELECT_AVM_NODE_CHILD_ENTRIES_BY_CHILD ="alfresco.avm.select_AVMNodeChildEntriesByChild"; // child
@@ -55,7 +52,6 @@ public class AVMNodeLinksDAOImpl extends AbstractAVMNodeLinksDAOImpl
private static final String UPDATE_AVM_NODE_CHILD_ENTRY ="alfresco.avm.update_AVMChildEntry"; // parent + child (update name)
private static final String DELETE_AVM_NODE_CHILD_ENTRY_BY_PARENT_AND_NAME ="alfresco.avm.delete_AVMChildEntryByParentAndName"; // parent + name
private static final String DELETE_AVM_NODE_CHILD_ENTRY_BY_PARENT_AND_NAME_L ="alfresco.avm.delete_AVMChildEntryByParentAndNameL"; // parent + lower(name)
private static final String DELETE_AVM_NODE_CHILD_ENTRY_BY_PARENT_AND_CHILD ="alfresco.avm.delete_AVMChildEntryByParentAndChild"; // parent + child
private static final String DELETE_AVM_NODE_CHILD_ENTRIES_BY_PARENT ="alfresco.avm.delete_AVMNodeChildEntriesByParent"; // parent
@@ -75,29 +71,15 @@ public class AVMNodeLinksDAOImpl extends AbstractAVMNodeLinksDAOImpl
private SqlSessionTemplate template;
public final void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate)
{
this.template = sqlSessionTemplate;
}
// Initial generic fix for ALF-1940 (pending SAIL-349)
// Note: in order to override to false DB must be setup to be case-insensitive (at least on column avm_child_entries.name)
private boolean toLower = true;
public void setToLower(boolean toLower)
{
this.toLower = toLower;
}
@Override
protected AVMChildEntryEntity getChildEntryEntity(AVMChildEntryEntity childEntryEntity)
{
if (toLower)
{
return (AVMChildEntryEntity) template.selectOne(SELECT_AVM_NODE_CHILD_ENTRY_L, childEntryEntity);
}
return (AVMChildEntryEntity) template.selectOne(SELECT_AVM_NODE_CHILD_ENTRY, childEntryEntity);
}
@@ -106,10 +88,6 @@ public class AVMNodeLinksDAOImpl extends AbstractAVMNodeLinksDAOImpl
{
AVMChildEntryEntity childEntryEntity = new AVMChildEntryEntity(parentNodeId, name);
if (toLower)
{
return (AVMChildEntryEntity) template.selectOne(SELECT_AVM_NODE_CHILD_ENTRY_BY_PARENT_AND_NAME_L, childEntryEntity);
}
return (AVMChildEntryEntity) template.selectOne(SELECT_AVM_NODE_CHILD_ENTRY_BY_PARENT_AND_NAME, childEntryEntity);
}
@@ -135,12 +113,8 @@ public class AVMNodeLinksDAOImpl extends AbstractAVMNodeLinksDAOImpl
{
Map<String, Object> params = new HashMap<String, Object>(1);
params.put("id", parentNodeId);
params.put("pattern", childNamePattern);
params.put("pattern", childNamePattern.toLowerCase());
if (toLower)
{
return (List<AVMChildEntryEntity>) template.selectList(SELECT_AVM_NODE_CHILD_ENTRIES_BY_PARENT_AND_NAME_PATTERN_L, params);
}
return (List<AVMChildEntryEntity>) template.selectList(SELECT_AVM_NODE_CHILD_ENTRIES_BY_PARENT_AND_NAME_PATTERN, params);
}
@@ -172,11 +146,6 @@ public class AVMNodeLinksDAOImpl extends AbstractAVMNodeLinksDAOImpl
protected int deleteChildEntryEntity(long parentNodeId, String name)
{
AVMChildEntryEntity childEntryEntity = new AVMChildEntryEntity(parentNodeId, name);
if (toLower)
{
return template.delete(DELETE_AVM_NODE_CHILD_ENTRY_BY_PARENT_AND_NAME_L, childEntryEntity);
}
return template.delete(DELETE_AVM_NODE_CHILD_ENTRY_BY_PARENT_AND_NAME, childEntryEntity);
}

View File

@@ -1076,6 +1076,73 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
}
public void testAddVersionableAspectWithNoVersionType()
{
// No version-type specified when adding the aspect
NodeRef nodeRef = createNodeWithVersionType(null);
setComplete();
endTransaction();
assertCorrectVersionLabel(nodeRef, "0.1");
}
public void testAddVersionableAspectWithMinorVersionType()
{
// MINOR version-type specified when adding the aspect
NodeRef nodeRef = createNodeWithVersionType(VersionType.MINOR);
setComplete();
endTransaction();
assertCorrectVersionLabel(nodeRef, "0.1");
}
public void testAddVersionableAspectWithMajorVersionType()
{
// MAJOR version-type specified when adding the aspect
NodeRef nodeRef = createNodeWithVersionType(VersionType.MAJOR);
setComplete();
endTransaction();
assertCorrectVersionLabel(nodeRef, "1.0");
}
private void assertCorrectVersionLabel(final NodeRef nodeRef, final String versionLabel)
{
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
{
public Object execute() throws Exception
{
// Check that the version history has been created
VersionHistory versionHistory = versionService.getVersionHistory(nodeRef);
assertNotNull(versionHistory);
assertEquals(1, versionHistory.getAllVersions().size());
Version version = versionService.getCurrentVersion(nodeRef);
assertEquals("Wrong version label", versionLabel, version.getVersionLabel());
return null;
}
});
}
private NodeRef createNodeWithVersionType(VersionType versionType)
{
HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, "test.txt");
final NodeRef nodeRef = dbNodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}MyVersionableNode"),
TEST_TYPE_QNAME,
props).getChildRef();
HashMap<QName, Serializable> aspectProps = new HashMap<QName, Serializable>();
if (versionType != null)
{
aspectProps.put(ContentModel.PROP_VERSION_TYPE, versionType);
}
dbNodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, aspectProps);
return nodeRef;
}
public void testAddRemoveVersionableAspect()
{
HashMap<QName, Serializable> props2 = new HashMap<QName, Serializable>();

View File

@@ -361,6 +361,14 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
{
// Create the initial-version
Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(1);
// If a major version is requested, indicate it in the versionProperties map
String versionType = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_VERSION_TYPE);
if (versionType != null && versionType.equals(VersionType.MAJOR.toString()))
{
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
}
versionProperties.put(Version.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_INITIAL_VERSION));
createVersionImpl(nodeRef, versionProperties);