mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.0 to HEAD
5425: AR-1309 5426: AR-1342 5427: AWC-1157 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5480 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -130,10 +130,13 @@ patch.linkNodeExtension.rewritten=Name ''{0}'' rewritten to ''{1}''
|
|||||||
|
|
||||||
patch.systemRegistryBootstrap.description=Bootstraps the node that will hold system registry metadata.
|
patch.systemRegistryBootstrap.description=Bootstraps the node that will hold system registry metadata.
|
||||||
|
|
||||||
patch.userAndPersonUserNamesAsIdentifiers.description=Reindex user:user and cm:person uids as identifiers
|
patch.userAndPersonUserNamesAsIdentifiers.description=Reindex usr:user and cm:person uids as identifiers
|
||||||
patch.userAndPersonUserNamesAsIdentifiers.result=Reindexed user:user and cm:person uids as identifiers
|
patch.userAndPersonUserNamesAsIdentifiers.result=Reindexed user:user and cm:person uids as identifiers
|
||||||
|
|
||||||
patch.contentFormFolderType.description=Update WCM Content Form folder type.
|
patch.contentFormFolderType.description=Update WCM Content Form folder type.
|
||||||
patch.contentFormFolderType.result=Updated {0} WCM Content Form objects to 'wcm:formfolder' type.
|
patch.contentFormFolderType.result=Updated {0} WCM Content Form objects to 'wcm:formfolder' type.
|
||||||
|
|
||||||
patch.webscripts.description=Adds Web Scripts to Data Dictionary.
|
patch.webscripts.description=Adds Web Scripts to Data Dictionary.
|
||||||
|
|
||||||
|
patch.groupNamesAsIdentifiers.description=Reindex usr:authorityContainer gids as identifiers
|
||||||
|
patch.groupNamesAsIdentifiers.result=Reindex usr:authorityContainer gids as identifiers
|
@@ -142,6 +142,8 @@
|
|||||||
<title>Person</title>
|
<title>Person</title>
|
||||||
<parent>sys:base</parent>
|
<parent>sys:base</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
<!-- The tokenisation set here is ignored - it is fixed for this type -->
|
||||||
|
<!-- This is so you can not break person lookup -->
|
||||||
<property name="cm:userName">
|
<property name="cm:userName">
|
||||||
<type>d:text</type>
|
<type>d:text</type>
|
||||||
<mandatory>true</mandatory>
|
<mandatory>true</mandatory>
|
||||||
|
@@ -669,6 +669,21 @@
|
|||||||
<value>classpath:alfresco/dbscripts/upgrade/2.0/${db.script.dialect}/AlfrescoSchemaUpdate-2.0-AVMFKIndexes.sql</value>
|
<value>classpath:alfresco/dbscripts/upgrade/2.0/${db.script.dialect}/AlfrescoSchemaUpdate-2.0-AVMFKIndexes.sql</value>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="patch.groupNamesAsIdentifiers" class="org.alfresco.repo.admin.patch.impl.GroupTokenisationPatch" parent="basePatch" >
|
||||||
|
<property name="id"><value>patch.groupNamesAsIdentifiers</value></property>
|
||||||
|
<property name="description"><value>patch.groupNamesAsIdentifiers.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>38</value></property>
|
||||||
|
<property name="targetSchema"><value>39</value></property>
|
||||||
|
<!-- bootstrap view -->
|
||||||
|
<property name="userImporterBootstrap">
|
||||||
|
<ref bean="userBootstrap" />
|
||||||
|
</property>
|
||||||
|
<property name="indexerAndSearcher">
|
||||||
|
<ref bean="indexerAndSearcherFactory" />
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="patch.webscripts" class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch" parent="basePatch" >
|
<bean id="patch.webscripts" class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch" parent="basePatch" >
|
||||||
<property name="id"><value>patch.webscripts</value></property>
|
<property name="id"><value>patch.webscripts</value></property>
|
||||||
|
@@ -32,6 +32,7 @@ import java.util.List;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.repo.node.integrity.IntegrityChecker;
|
import org.alfresco.repo.node.integrity.IntegrityChecker;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.transaction.TransactionUtil;
|
import org.alfresco.repo.transaction.TransactionUtil;
|
||||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||||
import org.alfresco.service.cmr.admin.PatchException;
|
import org.alfresco.service.cmr.admin.PatchException;
|
||||||
@@ -263,6 +264,7 @@ public abstract class AbstractPatch implements Patch
|
|||||||
{
|
{
|
||||||
return this.dependsOn;
|
return this.dependsOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all the dependencies for this patch. It should not be executed
|
* Set all the dependencies for this patch. It should not be executed
|
||||||
* before all the dependencies have been applied.
|
* before all the dependencies have been applied.
|
||||||
@@ -334,19 +336,28 @@ public abstract class AbstractPatch implements Patch
|
|||||||
// execute in a transaction
|
// execute in a transaction
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TransactionWork<String> patchWork = new TransactionWork<String>()
|
AuthenticationUtil.RunAsWork<String> authorisedPathWork = new AuthenticationUtil.RunAsWork<String>()
|
||||||
{
|
{
|
||||||
public String doWork() throws Exception
|
public String doWork() throws Exception
|
||||||
{
|
{
|
||||||
// downgrade integrity checking
|
TransactionWork<String> patchWork = new TransactionWork<String>()
|
||||||
IntegrityChecker.setWarnInTransaction();
|
{
|
||||||
|
public String doWork() throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
String report = applyInternal();
|
// downgrade integrity checking
|
||||||
// done
|
IntegrityChecker.setWarnInTransaction();
|
||||||
return report;
|
|
||||||
};
|
String report = applyInternal();
|
||||||
|
// done
|
||||||
|
return report;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, patchWork);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
String report = TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, patchWork);
|
String report = AuthenticationUtil.runAs(authorisedPathWork, AuthenticationUtil.getSystemUserName());
|
||||||
// the patch was successfully applied
|
// the patch was successfully applied
|
||||||
applied = true;
|
applied = true;
|
||||||
// done
|
// done
|
||||||
|
@@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import org.alfresco.i18n.I18NUtil;
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||||
|
import org.alfresco.repo.search.Indexer;
|
||||||
|
import org.alfresco.repo.search.IndexerAndSearcher;
|
||||||
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
|
import org.alfresco.service.cmr.search.ResultSet;
|
||||||
|
import org.alfresco.service.cmr.search.ResultSetRow;
|
||||||
|
import org.alfresco.service.cmr.search.SearchParameters;
|
||||||
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch usr:user and cm:person objects so that the user name properties are in the
|
||||||
|
* index in untokenized form. If not authentication may fail in mixed language use.
|
||||||
|
*
|
||||||
|
* @author andyh
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GroupTokenisationPatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private static final String MSG_SUCCESS = "patch.groupNamesAsIdentifiers.result";
|
||||||
|
|
||||||
|
private ImporterBootstrap userImporterBootstrap;
|
||||||
|
private IndexerAndSearcher indexerAndSearcher;
|
||||||
|
|
||||||
|
|
||||||
|
public GroupTokenisationPatch()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserImporterBootstrap(ImporterBootstrap userImporterBootstrap)
|
||||||
|
{
|
||||||
|
this.userImporterBootstrap = userImporterBootstrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexerAndSearcher(IndexerAndSearcher indexerAndSearcher)
|
||||||
|
{
|
||||||
|
this.indexerAndSearcher = indexerAndSearcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
reindex("TYPE:\"usr:authorityContainer\"", userImporterBootstrap.getStoreRef());
|
||||||
|
return I18NUtil.getMessage(MSG_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void reindex(String query, StoreRef store)
|
||||||
|
{
|
||||||
|
SearchParameters sp = new SearchParameters();
|
||||||
|
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
|
||||||
|
sp.setQuery(query);
|
||||||
|
sp.addStore(store);
|
||||||
|
ResultSet rs = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
rs = searchService.query(sp);
|
||||||
|
for(ResultSetRow row : rs)
|
||||||
|
{
|
||||||
|
Indexer indexer = indexerAndSearcher.getIndexer(row.getNodeRef().getStoreRef());
|
||||||
|
indexer.updateNode(row.getNodeRef());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(rs != null)
|
||||||
|
{
|
||||||
|
rs.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -236,17 +236,9 @@ public class RSSTemplatesFolderPatch extends AbstractPatch
|
|||||||
true);
|
true);
|
||||||
|
|
||||||
// import the content
|
// import the content
|
||||||
try
|
|
||||||
{
|
importContent();
|
||||||
authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
|
|
||||||
|
|
||||||
importContent();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
authenticationComponent.clearCurrentSecurityContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
msg = I18NUtil.getMessage(MSG_CREATED, rssFolderNodeRef);
|
msg = I18NUtil.getMessage(MSG_CREATED, rssFolderNodeRef);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -166,7 +166,8 @@ public class LuceneAnalyser extends Analyzer
|
|||||||
// Temporary fix for person and user uids
|
// Temporary fix for person and user uids
|
||||||
|
|
||||||
if (propertyQName.equals(ContentModel.PROP_USER_USERNAME)
|
if (propertyQName.equals(ContentModel.PROP_USER_USERNAME)
|
||||||
|| propertyQName.equals(ContentModel.PROP_USERNAME))
|
|| propertyQName.equals(ContentModel.PROP_USERNAME)
|
||||||
|
|| propertyQName.equals(ContentModel.PROP_AUTHORITY_NAME))
|
||||||
{
|
{
|
||||||
analyser = new VerbatimAnalyser(true);
|
analyser = new VerbatimAnalyser(true);
|
||||||
}
|
}
|
||||||
|
@@ -1745,8 +1745,8 @@ public class LuceneIndexerImpl2 extends LuceneBase2 implements LuceneIndexer2
|
|||||||
}
|
}
|
||||||
else if (isText)
|
else if (isText)
|
||||||
{
|
{
|
||||||
// Temporary special case for uids
|
// Temporary special case for uids and gids
|
||||||
if(propertyName.equals(ContentModel.PROP_USER_USERNAME) || propertyName.equals(ContentModel.PROP_USERNAME))
|
if(propertyName.equals(ContentModel.PROP_USER_USERNAME) || propertyName.equals(ContentModel.PROP_USERNAME) || propertyName.equals(ContentModel.PROP_AUTHORITY_NAME))
|
||||||
{
|
{
|
||||||
doc.add(new Field(attributeName, strValue, fieldStore, fieldIndex, Field.TermVector.NO));
|
doc.add(new Field(attributeName, strValue, fieldStore, fieldIndex, Field.TermVector.NO));
|
||||||
}
|
}
|
||||||
|
@@ -66,6 +66,8 @@ import org.apache.lucene.index.IndexReader;
|
|||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.MultiReader;
|
import org.apache.lucene.index.MultiReader;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
|
import org.apache.lucene.index.TermDocs;
|
||||||
|
import org.apache.lucene.index.TermEnum;
|
||||||
import org.apache.lucene.search.Hits;
|
import org.apache.lucene.search.Hits;
|
||||||
import org.apache.lucene.search.IndexSearcher;
|
import org.apache.lucene.search.IndexSearcher;
|
||||||
import org.apache.lucene.search.Searcher;
|
import org.apache.lucene.search.Searcher;
|
||||||
@@ -442,10 +444,15 @@ public class IndexInfo
|
|||||||
long docs = writer.docCount();
|
long docs = writer.docCount();
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
indexEntries.put(OLD_INDEX, new IndexEntry(IndexType.INDEX, OLD_INDEX, "",
|
IndexEntry entry = new IndexEntry(IndexType.INDEX, OLD_INDEX, "",
|
||||||
TransactionStatus.COMMITTED, "", docs, 0, false));
|
TransactionStatus.COMMITTED, "", docs, 0, false);
|
||||||
|
indexEntries.put(OLD_INDEX, entry);
|
||||||
|
|
||||||
writeStatus();
|
writeStatus();
|
||||||
|
|
||||||
|
// The index exists and we should initialise the single reader
|
||||||
|
registerReferenceCountingIndexReader(entry.getName(),
|
||||||
|
buildReferenceCountingIndexReader(entry.getName()));
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
@@ -2105,8 +2112,9 @@ public class IndexInfo
|
|||||||
* Helper to print out index information
|
* Helper to print out index information
|
||||||
*
|
*
|
||||||
* @param args
|
* @param args
|
||||||
|
* @throws Throwable
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args)
|
public static void main(String[] args) throws Throwable
|
||||||
{
|
{
|
||||||
|
|
||||||
String indexLocation = args[0];
|
String indexLocation = args[0];
|
||||||
@@ -2128,6 +2136,46 @@ public class IndexInfo
|
|||||||
{
|
{
|
||||||
ii.releaseWriteLock();
|
ii.releaseWriteLock();
|
||||||
}
|
}
|
||||||
|
IndexReader reader = ii.getMainIndexReferenceCountingReadOnlyIndexReader();
|
||||||
|
TermEnum terms = reader.terms(new Term("@{archiweb.model}instance", ""));
|
||||||
|
while(terms.next() && terms.term().field().equals("@{archiweb.model}instance"))
|
||||||
|
{
|
||||||
|
System.out.println("F = " +terms.term().field() + " V = "+terms.term().text() + " F = "+terms.docFreq());
|
||||||
|
}
|
||||||
|
terms.close();
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
TermDocs termDocs = reader.termDocs(new Term("@{archiweb.model}instance", "tfl"));
|
||||||
|
while(termDocs.next())
|
||||||
|
{
|
||||||
|
//System.out.println("Doc = " + termDocs.doc());
|
||||||
|
Document doc = reader.document(termDocs.doc());
|
||||||
|
doc.getField("ID");
|
||||||
|
//System.out.println("Ref = "+doc.getField("ID"));
|
||||||
|
}
|
||||||
|
termDocs.close();
|
||||||
|
System.out.println("Time = "+((System.currentTimeMillis() - start)/1000.0f));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
terms = reader.terms(new Term("TYPE", ""));
|
||||||
|
while(terms.next() && terms.term().field().equals("TYPE"))
|
||||||
|
{
|
||||||
|
System.out.println("F = " +terms.term().field() + " V = "+terms.term().text() + " F = "+terms.docFreq());
|
||||||
|
}
|
||||||
|
terms.close();
|
||||||
|
start = System.currentTimeMillis();
|
||||||
|
termDocs = reader.termDocs(new Term("TYPE","{archiweb.model}tfdoc"));
|
||||||
|
while(termDocs.next())
|
||||||
|
{
|
||||||
|
//System.out.println("Doc = " + termDocs.doc());
|
||||||
|
Document doc = reader.document(termDocs.doc());
|
||||||
|
doc.getField("ID");
|
||||||
|
//System.out.println("Ref = "+doc.getField("ID"));
|
||||||
|
}
|
||||||
|
termDocs.close();
|
||||||
|
System.out.println("Time = "+((System.currentTimeMillis() - start)/1000.0f));
|
||||||
|
|
||||||
|
//+@\{archiweb.model\}instance:TFL*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,6 +26,8 @@
|
|||||||
<title>Alfresco User Type</title>
|
<title>Alfresco User Type</title>
|
||||||
<parent>usr:authority</parent>
|
<parent>usr:authority</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
<!-- The tokenisation set here is ignored - it is fixed for this type -->
|
||||||
|
<!-- This is so you can not break person lookup -->
|
||||||
<property name="usr:username">
|
<property name="usr:username">
|
||||||
<type>d:text</type>
|
<type>d:text</type>
|
||||||
</property>
|
</property>
|
||||||
@@ -60,6 +62,8 @@
|
|||||||
<title>Alfresco Authority Type</title>
|
<title>Alfresco Authority Type</title>
|
||||||
<parent>usr:authority</parent>
|
<parent>usr:authority</parent>
|
||||||
<properties>
|
<properties>
|
||||||
|
<!-- The tokenisation set here is ignored - it is fixed for this type -->
|
||||||
|
<!-- This is so you can not break group lookup -->
|
||||||
<property name="usr:authorityName">
|
<property name="usr:authorityName">
|
||||||
<type>d:text</type>
|
<type>d:text</type>
|
||||||
</property>
|
</property>
|
||||||
|
Reference in New Issue
Block a user