Merged V4.0-BUG-FIX to HEAD

36311: BDE-69: filter long tests if minimal.testing property is defined
   36314: Merged V4.0 to V4.0-BUG-FIX (RECORD ONLY)
      36247: ALF-11027: temporarily remove import of maven.xml, since it makes ant calls fail from enterpriseprojects
   36331: ALF-12447: Further changes required to fix lower case meta-inf folder name
   36333: Revert ALF-12447.
   36334: ALF-14115: Merged V3.4-BUG-FIX to V4.0-BUG-FIX
      36318: ALF-12447: Fix case on META-INF folder for SDK
      36332: ALF-12447: Further changes required to fix lower case meta-inf folder name
   36337: ALF-14115: Merged V3.4-BUG-FIX to V4.0-BUG-FIX
      36332: ALF-12447: Yet more meta-inf case changes needed.
   36342: ALF-14120: fix only completed tasks returned
   36343: ALF-13898: starting workflow from IMAP now using workflowDefs with engine name included, fallback to appending $jbpm when not present, to preserve backwards compatibility.
   36345: Fix for ALF-12730 - Email Space Users fails if template is used
   36346: Fix for ALF-9466 - We can search contents sorted by categories in Advanced search in Share, but saved search will not be shown in UI.
   36364: Switch version to 4.0.3
   36375: Merged BRANCHES/DEV/CLOUDSYNCLOCAL2 to BRANCHES/DEV/V4.0-BUG-FIX:
      36366: Tweak to implementation to ensure that on-authentication-failed, the status is updated within a r/w transaction.
      36374: Provide more specific exceptions from the Remote Connector Service for client and server errors
   36376: Fix ALF-14121 - Alfresco fails to start if using "replicating-content-services-context.xml"
   36393: Final part of ALF-13723 SOLR does not include the same query unit tests as lucene
   - CMIS typed query and ordering tests
   36432: ALF-14133: Merged V3.4-BUG-FIX (3.4.10) to V4.0-BUG-FIX (4.0.3)
      << 4.0.x specific change: Changed transformer.complex.OOXML.Image into transformer.complex.Any.Image >>
      << allowing any transformer to be selected for the conversion to JPEG >>
      36427: ALF-14131 Complex transformers fail if a lower level transformer fails even though there is another transformer that could do the transformation
         - Added a base spring bean for all complex transformers
      36362: ALF-14131 Complex transformers fail if a lower level transformer fails even though there is another transformer that could do the transformation
   36434: Test fix for ALF-13723 SOLR does not include the same query unit tests as lucene
   - CMIS test data change broke AFTS ID ordering
   36503: Removed thousands of compiler warnings (CMIS query test code)
   36518: Fix for ALF-13778 - Links on Share Repository search page show incorrect link name; do not work when root-node is defined.
   Fix now means that Share search correctly handles overridden Repository root node setting. Original work by Vasily Olhin.
   36520: BDE-69: filter all repo tests if minimal.testing property is defined
   36534: ALF-14116: Latest Surf libs (r1075) - ensure that i18n extensions can process browser sent short locales
   36563: Merged V3.4-BUG-FIX to V4.0-BUG-FIX
      36336: ALF-12447: Yet more meta-inf case changes needed.
      36347: Fix for ALF-13920 - Error occurred when try to edit/delete category
      36352: Fix for ALF-13123 - Invalid JSON format from Get Node Tags Webscript - strings not double-quoted. Also fixed POST webscript with same issue.
      36399: ALL LANG: translation updates based on EN r36392
      36421: Fix for Mac Lion versioning issue. ALF-12792 (Part 1 of 2)
      Enable the InfoPassthru and Level2Oplocks server capability flags, InfoPassthru is the flag that fixes the Mac Lion versioning error.
      Added support for filesystems that do not implement the NTFS streams interface in the CIFS transact rename processing, for the Alfresco repo filesystem.
      36422: Fix for Mac Lion versioning issue. ALF-12792 (Part 2 of 2)
      Enable the InfoPassthru and Level2Oplocks server capability flags, InfoPassthru is the flag that fixes the Mac Lion versioning error.
      36423: Add support for file size tracking in the file state. ALF-13616 (Part 1 of 2)
      36424: Fix for Mac MS Word file save issue. ALF-13616 (Part 2 of 2)
      Added live file size tracking to file writing/folder searches so the correct file size is returned before the file is closed.
      36444: Merged DEV to V3.4-BUG-FIX
         36419: ALF-12666 Search against simple-search-additional-attributes doesn't work properly
            SearchContext.buildQuery(int) method was changed.
      36446: Fix for ALF-13404 - Performance: 'Content I'm Editing' dashlet is slow to render when there is lots of data/sites
       - Effectively removed all PATH based queries using the pattern /companyhome/sites/*/container//* as they are a non-optimized case
       - Replaced the "all sites" doclist query using the above pattern with /companyhome/sites//* plus post query resultset processing based on documentLibrary container matching regex
       - Optimized favorite document query to remove need for a PATH
       - Optimized Content I'm Editing discussion PATH query to use /*/* instead of /*//*
       - Fixed issue where Content I'm Editing discussion results would not always show the root topics that a user has edited
       - Added some addition doclist.get.js query scriptlogger debugging output
      36449: ALF-13404 - Fix for issue where favoriates for all sites would be shown in each site document library in the My Favorites filter.
      36475: ALF-14131 Complex transformers fail if a lower level transformer fails even though there is another transformer that could do the transformation
         - Change base spring bean on example config file
      36480: 36453: ALF-3881 : ldap sync deletion behaviour not flexible enough
         - synchronization.allowDeletions parameter introduced
         - default value is true (existing behaviour)
         - when false, no missing users or groups are deleted from the repository
         - instead they are cleared of their zones and missing groups are cleared of all their members
         - colliding users and groups from different zones are also 'moved' rather than recreated
         - unit test added
      36491: Added CIFS transact2 NT passthru levels for set end of file/set allocation size. ALF-13616.
      Also updated FileInfoLevel with the latest list of NT passthru information levels.
      36497: Fixed ALF-14163: JavaScript Behaviour broken: Node properties cannot be cast to java.io.Serializable
       - Fallout from ALF-12855
       - Made class Serializable (like HashMap would have been)
       - Fixed line endings, too
      36531: ALF-13769: Merged BELARUS/V3.4-BUG-FIX-2012_04_05 to V3.4-BUG-FIX (3.4.10)
         35150: ALF-2645 : 3.2+ ldap sync debug information is too scarce 
            - Improved LDAP logging.
      36532: ALF-13769: BRANCHES/DEV/BELARUS/V3.4-BUG-FIX-2012_01_26 to V3.4-BUG-FIX (3.4.10)
         36461: ALF-237: WCM: File conflicts cause file order not to be consistent
            - It is reasonable set values for checkboxes using the indexes from the list, which are not changed. So when we submit the window, the getSelectedNodes method is invoked and 
              it takes selected nodes by checkbox values from "paths" list. 
      36535: Merged DEV to V3.4-BUG-FIX
         36479: ALF-8918 : Cannot "edit offline" a web quick start publication
            A check in TaggableAspect.onUpdatePropertiesOnCommit() was extended to skip the update, if no tags were changed.
      36555: Merged V3.4 to V3.4-BUG-FIX
         36294: ALF-14039: Merged HEAD to V3.4
            31732: ALF-10934: Prevent potential start/stop ping-pong of subsystems across a cluster
               - When a cluster boots up or receives a reinit message it shouldn't be sending out any start messages
   36566: Merged V3.4-BUG-FIX to V4.0-BUG-FIX (RECORD ONLY)
      36172: Merged BRANCHES/DEV/V4.0-BUG-FIX to BRANCHES/DEV/V3.4-BUG-FIX:
         36169: ALF-8755: After renaming content / space by Contributor via WebDAV new items are created
   36572: Merged V4.0 to V4.0-BUG-FIX
      36388: ALF-14025: Updated Surf libs (1071). Fixes to checksum-disabled dependency handling
      36392: ALF-14129 Failed to do upgrade from 3.4.8 to 4.0.2
         << Committed change for Frederik Heremans >>
         - Moved actual activiti-tables creation to before the upgrade
      36409: Fix for ALF-14124 Solr is not working - Errors occur during the startup
      36466: Fix for ALF-12770 - Infinite loop popup alert in TinyMCE after XSS injection in Alfresco Explorer online edit.
      36501: Merged DEV to V4.0
         36496: ALF-14063 : CLONE - Internet Explorer hangs when using the object picker with a larger number of documents
            YUI 2.9.0 library was modified to use chunked unloading of listeners via a series of setTimeout() functions in event.js for IE 6,7,8.
      36502: ALF-14105: Share Advanced search issue with the form values
      - Fix by David We
      36538: ALF-13986: Updated web.xml and index.jsp redirect to ensure that SSO works with proper surf site-configuration customization
      36539: Fix for ALF-14167 Filtering by Tags/Categories doen't findes any content in Repository/DocumentLibrary
      - fix default namespace back to "" -> "" and fix the specific SOLR tests that require otherwise.
      36541: ALF-14082: Input stream leaks in thumbnail rendering webscripts
      36560: Correctly size content length header after HTML stripping process (ALF-9365)
   36574: Merged V4.0 to V4.0-BUG-FIX (RECORD ONLY)
      36316: Merged V4.0-BUG-FIX to V4.0 (4.0.2)
      36391: Merged V4.0-BUG-FIX to V4.0
         36376: Fix ALF-14121 - Alfresco fails to start if using "replicating-content-services-context.xml"


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@36576 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-05-18 17:00:53 +00:00
parent 36ed2b0785
commit 6a37c8a8c3
9 changed files with 189 additions and 125 deletions

View File

@@ -94,6 +94,27 @@ public final class UIContextService implements Serializable
this.registeredBeans.remove(bean);
}
/**
* Returns a registered bean or null
*
* @param className (fully qualified name)
*
* @return IContextListener
*/
public IContextListener getRegisteredBean(String className)
{
IContextListener bean = null;
for (Class clazz : this.registeredBeans.keySet())
{
if (clazz.getName().equals(className))
{
bean = this.registeredBeans.get(clazz);
break;
}
}
return bean;
}
/**
* Call to notify all register beans that the UI context has changed and they should
* refresh themselves as appropriate.

View File

@@ -34,6 +34,7 @@ import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.util.UrlUtil;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.BaseTemplateContentServlet;
import org.alfresco.web.app.servlet.FacesHelper;
@@ -154,6 +155,7 @@ public class TemplateMailHelperBean implements Serializable
}
model.put("space", parentNodeRef);
}
model.put("shareUrl", UrlUtil.getShareUrl(services.getSysAdminParams()));
body = services.getTemplateService().processTemplate("freemarker", templateRef.toString(), model);
}

View File

@@ -64,9 +64,12 @@ public class CategoriesDialog extends BaseDialogBean implements IContextListener
private static final long serialVersionUID = -1254971127977205987L;
public static final String KEY_CATEGORY = "category";
public static final String KEY_CATEGORY_FLAG = "categoryFlag";
public static final String PARAM_CATEGORY_REF = "categoryRef";
public static final String CATEGORIES_DIALOG_CLASS_NAME = "org.alfresco.web.bean.categories.CategoriesDialog";
private static final String VIEW_ICONS = "icons";
private static final String VIEW_DETAILS = "details";
@@ -460,19 +463,20 @@ public class CategoriesDialog extends BaseDialogBean implements IContextListener
}
/**
* If category.equals(handler.label) then the breadcrumb reverts one step back
* (needed for deleting)
* Else current breadcrumb is updated accordingly to the current category
* (needed for editing)
* If category.equals(handler.label) then the breadcrumb reverts one step back<br>
* (for deleting)
* <p>
* Else current breadcrumb is updated accordingly to the current category<br>
* (for editing)
*/
protected void removeFromBreadcrumb(String category)
protected void removeFromBreadcrumb(String categoryToRemove, String categoryFlag)
{
// remove this node from the breadcrumb if required
List<IBreadcrumbHandler> location = getLocation();
CategoryBreadcrumbHandler handler = (CategoryBreadcrumbHandler) location.get(location.size() - 1);
// see if the current breadcrumb location is our Category
if (category.equals(handler.label))
if (categoryToRemove.equals(handler.label))
{
location.remove(location.size() - 1);
@@ -483,14 +487,20 @@ public class CategoriesDialog extends BaseDialogBean implements IContextListener
this.setCurrentCategory(handler.nodeRef);
}
}
else if (categoryFlag.equals("true"))
{
// We don't need to modify the breadcrumb, as editing/deleting is made through an icon.
// the dialog should get back to the original location.
this.setCurrentCategory(handler.nodeRef);
}
else
{
if (getCategory() != null)
{
handler = new CategoryBreadcrumbHandler(
getCategory().getNodeRef(), Repository.getNameForNode(getNodeService(), getCategory().getNodeRef()));
location.set(location.size() - 1, handler);
this.setCurrentCategory(handler.nodeRef);
location.set(location.size() - 1, handler);
this.setCurrentCategory(handler.nodeRef);
}
}
}
@@ -628,16 +638,22 @@ public class CategoriesDialog extends BaseDialogBean implements IContextListener
@Override
public void restored()
{
Object categoryToRemove = FacesContext.getCurrentInstance().getExternalContext().
getRequestMap().get(KEY_CATEGORY);
if (categoryToRemove != null)
{
if (logger.isDebugEnabled())
logger.debug("Removing group '" + categoryToRemove + "' from breadcrumb");
removeFromBreadcrumb((String)categoryToRemove);
}
contextUpdated();
Object categoryToRemove = FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(KEY_CATEGORY);
Object categoryFlag = FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(KEY_CATEGORY_FLAG);
if (categoryToRemove != null)
{
if (logger.isDebugEnabled())
logger.debug("Removing group '" + categoryToRemove + "' from breadcrumb");
if (categoryFlag != null)
{
removeFromBreadcrumb((String)categoryToRemove, (String)categoryFlag);
}
else
{
removeFromBreadcrumb((String)categoryToRemove, Boolean.FALSE.toString());
}
}
contextUpdated();
}
public String getViewMode()

View File

@@ -36,8 +36,9 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.CategoryService;
import org.alfresco.service.cmr.search.CategoryService.Depth;
import org.alfresco.service.cmr.search.CategoryService.Mode;
import org.springframework.extensions.surf.util.ParameterCheck;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.UIContextService;
import org.alfresco.web.bean.categories.CategoriesDialog.CategoryBreadcrumbHandler;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
@@ -45,14 +46,16 @@ import org.alfresco.web.ui.common.ReportedException;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.IBreadcrumbHandler;
import org.alfresco.web.ui.common.component.data.UIRichList;
import org.alfresco.web.ui.repo.component.IRepoBreadcrumbHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.surf.util.ParameterCheck;
public class DeleteCategoryDialog extends BaseDialogBean
{
private static final long serialVersionUID = -8929785826091612856L;
private static Log logger = LogFactory.getLog(DeleteCategoryDialog.class);
private static final String DEFAULT_OUTCOME = "finish";
private final static String MSG_DELETE_CATEGORY = "delete_category";
private final static String MSG_DELETE = "delete";
@@ -84,12 +87,14 @@ public class DeleteCategoryDialog extends BaseDialogBean
/** Currently visible category Node */
private Node category = null;
private static Log logger = LogFactory.getLog(DeleteCategoryDialog.class);
private Boolean categoryFlag = false;
@Override
public void init(Map<String, String> parameters)
{
this.isFinished = false;
this.categoryFlag = false;
// retrieve parameters
String categoryRef = parameters.get(CategoriesDialog.PARAM_CATEGORY_REF);
@@ -109,7 +114,9 @@ public class DeleteCategoryDialog extends BaseDialogBean
// add the category to the request object so it gets picked up by
// category dialog, this will allow it to be removed from the breadcrumb
context.getExternalContext().getRequestMap().put(
CategoriesDialog.KEY_CATEGORY, this.category.getName());
CategoriesDialog.KEY_CATEGORY, this.category.getName());
context.getExternalContext().getRequestMap().put(
CategoriesDialog.KEY_CATEGORY_FLAG, this.categoryFlag.toString());
return outcome;
}
@@ -187,6 +194,16 @@ public class DeleteCategoryDialog extends BaseDialogBean
this.category = category;
}
public Boolean getCategoryFlag()
{
return categoryFlag;
}
public void setCategoryFlag(Boolean categoryFlag)
{
this.categoryFlag = categoryFlag;
}
/**
* @param node Set the Node to be used for the current category screen action.
*/
@@ -226,14 +243,6 @@ public class DeleteCategoryDialog extends BaseDialogBean
*/
public List<IBreadcrumbHandler> getLocation()
{
if (this.location == null)
{
List<IBreadcrumbHandler> loc = new ArrayList<IBreadcrumbHandler>(8);
CategoriesDialog categoriesDialog = new CategoriesDialog();
loc.add(categoriesDialog.new CategoryBreadcrumbHandler(null, Application.getMessage(FacesContext.getCurrentInstance(), MSG_CATEGORIES)));
setLocation(loc);
}
return this.location;
}
@@ -378,24 +387,15 @@ public class DeleteCategoryDialog extends BaseDialogBean
}
};
NodeRef categoryNodeRef = txnHelper.doInTransaction(callback);
// remove this node from the breadcrumb if required
// Figure out if the deletion is made by an icon or by a list of actions
CategoriesDialog categoriesDialog = (CategoriesDialog) UIContextService.getInstance(FacesContext.getCurrentInstance())
.getRegisteredBean(CategoriesDialog.CATEGORIES_DIALOG_CLASS_NAME);
setLocation(categoriesDialog.getLocation());
List<IBreadcrumbHandler> location = getLocation();
IBreadcrumbHandler handler = location.get(location.size() - 1);
// see if the current breadcrumb location is our node
if (categoryNodeRef.equals(((IRepoBreadcrumbHandler) handler).getNodeRef()))
{
location.remove(location.size() - 1);
// now work out which node to set the list to refresh against
if (location.size() != 0)
{
handler = location.get(location.size() - 1);
this.setCurrentCategory(((IRepoBreadcrumbHandler) handler).getNodeRef());
}
}
CategoryBreadcrumbHandler handler = (CategoryBreadcrumbHandler) location.get(location.size() - 1);
setCategoryFlag(!handler.toString().equals(getCategory().getName()));
// clear action context
setActionCategory(null);
}

View File

@@ -38,6 +38,8 @@ import org.alfresco.service.cmr.search.CategoryService.Mode;
import org.alfresco.service.namespace.QName;
import org.springframework.extensions.surf.util.ParameterCheck;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.UIContextService;
import org.alfresco.web.bean.categories.CategoriesDialog.CategoryBreadcrumbHandler;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
@@ -66,6 +68,8 @@ public class EditCategoryDialog extends BaseDialogBean
/** Currently visible category Node */
private Node category = null;
private Boolean categoryFlag = false;
String categoryRef = null;
/** Category path breadcrumb location */
@@ -85,6 +89,7 @@ public class EditCategoryDialog extends BaseDialogBean
public void init(Map<String, String> parameters)
{
this.isFinished = false;
this.categoryFlag = false;
// retrieve parameters
categoryRef = parameters.get(CategoriesDialog.PARAM_CATEGORY_REF);
@@ -105,6 +110,8 @@ public class EditCategoryDialog extends BaseDialogBean
// category dialog, this will allow it to be edited in the breadcrumb
context.getExternalContext().getRequestMap().put(
CategoriesDialog.KEY_CATEGORY, this.category.getName());
context.getExternalContext().getRequestMap().put(
CategoriesDialog.KEY_CATEGORY_FLAG, this.categoryFlag.toString());
return outcome;
}
@@ -167,6 +174,16 @@ public class EditCategoryDialog extends BaseDialogBean
this.category = category;
}
public Boolean getCategoryFlag()
{
return categoryFlag;
}
public void setCategoryFlag(Boolean categoryFlag)
{
this.categoryFlag = categoryFlag;
}
public Collection<ChildAssociationRef> getMembers()
{
return members;
@@ -242,14 +259,6 @@ public class EditCategoryDialog extends BaseDialogBean
*/
public List<IBreadcrumbHandler> getLocation()
{
if (this.location == null)
{
List<IBreadcrumbHandler> loc = new ArrayList<IBreadcrumbHandler>(8);
CategoriesDialog categoriesDialog = new CategoriesDialog();
loc.add(categoriesDialog.new CategoryBreadcrumbHandler(null, Application.getMessage(FacesContext.getCurrentInstance(), MSG_CATEGORIES)));
setLocation(loc);
}
return this.location;
}
@@ -287,12 +296,22 @@ public class EditCategoryDialog extends BaseDialogBean
getNodeService().setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, getDescription());
}
// edit the node in the breadcrumb if required
CategoriesDialog categoriesDialog = new CategoriesDialog();
//Figure out if the editing is made by an icon or by a list of actions
CategoriesDialog categoriesDialog = (CategoriesDialog) UIContextService.getInstance(FacesContext.getCurrentInstance())
.getRegisteredBean(CategoriesDialog.CATEGORIES_DIALOG_CLASS_NAME);
setLocation(categoriesDialog.getLocation());
List<IBreadcrumbHandler> location = getLocation();
IBreadcrumbHandler handler = categoriesDialog.new CategoryBreadcrumbHandler(nodeRef, Repository.getNameForNode(getNodeService(), nodeRef));
location.set(location.size() - 1, handler);
setCategory(new Node(nodeRef));
CategoryBreadcrumbHandler handler = (CategoryBreadcrumbHandler) location.get(location.size() - 1);
if (!handler.toString().equals(getCategory().getName()))
{
setCategoryFlag(true);
}
else
{
setCategoryFlag(false);
}
Node categoryNode = new Node(nodeRef);
setCategory(categoryNode);
}
catch (Throwable err)
{

View File

@@ -33,6 +33,7 @@ import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;
import org.springframework.extensions.webscripts.ui.common.StringUtils;
/**
* This base dialog class provides methods for online editing. It does
@@ -132,7 +133,7 @@ public class EditOnlineDialog extends CCCheckoutFileDialog
else
{
// make content available to the html editing screen
property.setDocumentContent(reader.getContentString());
property.setDocumentContent(StringUtils.stripUnsafeHTMLTags(reader.getContentString(), false));
property.setEditorOutput(null);
// navigate to appropriate screen

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
* Copyright (C) 2005-2012 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -153,13 +153,12 @@ public class SearchContext implements Serializable
// the QName for the well known "name" attribute
String nameAttr = Repository.escapeQName(QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, ELEMENT_NAME));
StringBuilder plBuf = new StringBuilder("(");
StringBuilder mnBuf = new StringBuilder("-(");
// match against content text
String text = this.text.trim();
StringBuilder fullTextBuf = new StringBuilder(64);
StringBuilder nameAttrBuf = new StringBuilder(128);
StringBuilder additionalAttrsBuf = new StringBuilder(128);
if (text.length() != 0 && text.length() >= minimum)
{
if (text.indexOf(' ') == -1 && text.charAt(0) != '"')
@@ -178,15 +177,16 @@ public class SearchContext implements Serializable
// prepend NOT operator if supplied
if (operatorNOT)
{
fullTextBuf.append(OP_NOT);
nameAttrBuf.append(OP_NOT);
processSearchTextAttribute(nameAttr, text, mode == SEARCH_FILE_NAMES_CONTENTS || mode == SEARCH_ALL, mnBuf);
}
processSearchTextAttribute(nameAttr, text, nameAttrBuf, fullTextBuf);
for (QName qname : this.simpleSearchAdditionalAttrs)
// prepend AND operator if supplied
if (operatorAND)
{
processSearchAttribute(qname, text, additionalAttrsBuf, false, operatorNOT);
processSearchTextAttribute(nameAttr, text, mode == SEARCH_FILE_NAMES_CONTENTS || mode == SEARCH_ALL, plBuf);
}
processSearchAdditionalAttribute(text, operatorNOT, operatorAND, mnBuf, plBuf, this.simpleSearchAdditionalAttrs);
}
}
else
@@ -196,11 +196,11 @@ public class SearchContext implements Serializable
{
// as a single quoted phrase
String quotedSafeText = '"' + QueryParser.escape(text.substring(1, text.length() - 1)) + '"';
fullTextBuf.append("TEXT:").append(quotedSafeText);
nameAttrBuf.append("@").append(nameAttr).append(":").append(quotedSafeText);
plBuf.append("TEXT:").append(quotedSafeText);
plBuf.append(" @").append(nameAttr).append(":").append(quotedSafeText);
for (QName qname : this.simpleSearchAdditionalAttrs)
{
additionalAttrsBuf.append(" @").append(
plBuf.append(" @").append(
Repository.escapeQName(qname)).append(":").append(quotedSafeText);
}
}
@@ -209,10 +209,6 @@ public class SearchContext implements Serializable
// as individual search terms
StringTokenizer t = new StringTokenizer(text, " ");
fullTextBuf.append('(');
nameAttrBuf.append('(');
additionalAttrsBuf.append('(');
int termCount = 0;
int tokenCount = t.countTokens();
for (int i=0; i<tokenCount; i++)
@@ -240,36 +236,29 @@ public class SearchContext implements Serializable
// prepend NOT operator if supplied
if (operatorNOT)
{
fullTextBuf.append(OP_NOT);
nameAttrBuf.append(OP_NOT);
processSearchTextAttribute(nameAttr, term, mode == SEARCH_FILE_NAMES_CONTENTS || mode == SEARCH_ALL, mnBuf);
}
// prepend AND operator if supplied
if (operatorAND)
{
fullTextBuf.append(OP_AND);
nameAttrBuf.append(OP_AND);
processSearchTextAttribute(nameAttr, term, mode == SEARCH_FILE_NAMES_CONTENTS || mode == SEARCH_ALL, plBuf);
}
processSearchTextAttribute(nameAttr, term, nameAttrBuf, fullTextBuf);
for (QName qname : this.simpleSearchAdditionalAttrs)
if (mode == SearchContext.SEARCH_ALL)
{
processSearchAttribute(qname, term, additionalAttrsBuf, operatorAND, operatorNOT);
processSearchAdditionalAttribute(term, operatorNOT, operatorAND, mnBuf, plBuf, this.simpleSearchAdditionalAttrs);
}
fullTextBuf.append(' ');
nameAttrBuf.append(' ');
additionalAttrsBuf.append(' ');
termCount++;
}
}
fullTextBuf.append(')');
nameAttrBuf.append(')');
additionalAttrsBuf.append(')');
}
}
plBuf.append(')');
mnBuf.append(')');
validQuery = true;
}
@@ -391,32 +380,37 @@ public class SearchContext implements Serializable
folderTypeQuery = " TYPE:\"{" + NamespaceService.CONTENT_MODEL_1_0_URI + "}folder\" ";
}
String fullTextQuery = fullTextBuf.toString();
String nameAttrQuery = nameAttrBuf.toString();
String additionalAttrsQuery =
(this.simpleSearchAdditionalAttrs.size() != 0) ? additionalAttrsBuf.toString() : "";
if (text.length() != 0 && text.length() >= minimum)
{
StringBuilder buf = new StringBuilder(128);
if (plBuf.length() > 2)
{
buf.append(plBuf);
if (mnBuf.length() > 3)
{
buf.append(" AND ");
}
}
if (mnBuf.length() > 3)
{
buf.append(mnBuf);
}
// text query for name and/or full text specified
switch (mode)
{
case SearchContext.SEARCH_ALL:
query = '(' + fileTypeQuery + " AND " + '(' + nameAttrQuery + ' ' + additionalAttrsQuery + ' ' + fullTextQuery + ')' + ')' +
query = '(' + fileTypeQuery + " AND " + '(' + buf + ')' + ')' +
' ' +
'(' + folderTypeQuery + " AND " + '(' + nameAttrQuery + ' ' + additionalAttrsQuery + "))";
'(' + folderTypeQuery + " AND " + '(' + buf + "))";
break;
case SearchContext.SEARCH_FILE_NAMES:
query = fileTypeQuery + " AND " + nameAttrQuery;
break;
case SearchContext.SEARCH_FILE_NAMES_CONTENTS:
query = fileTypeQuery + " AND " + '(' + nameAttrQuery + ' ' + fullTextQuery + ')';
query = fileTypeQuery + " AND " + '(' + buf + ')';
break;
case SearchContext.SEARCH_SPACE_NAMES:
query = folderTypeQuery + " AND " + nameAttrQuery;
query = folderTypeQuery + " AND " + buf;
break;
default:
@@ -474,19 +468,6 @@ public class SearchContext implements Serializable
return query;
}
/**
* Build the lucene search terms required for the specified attribute and append to a buffer.
* Supports text values with a wildcard '*' character as the prefix and/or the suffix.
*
* @param qname QName of the attribute
* @param value Non-null value of the attribute
* @param buf Buffer to append lucene terms to
*/
private static void processSearchAttribute(QName qname, String value, StringBuilder buf)
{
processSearchAttribute(qname, value, buf, true, false);
}
/**
* Build the lucene search terms required for the specified attribute and append to a buffer.
* Supports text values with a wildcard '*' character as the prefix and/or the suffix.
@@ -497,11 +478,9 @@ public class SearchContext implements Serializable
* @param andOp If true apply the '+' AND operator as the prefix to the attribute term
* @param notOp If true apply the '-' NOT operator as the prefix to the attribute term
*/
private static void processSearchAttribute(QName qname, String value, StringBuilder buf, boolean andOp, boolean notOp)
private static void processSearchAttribute(QName qname, String value, StringBuilder buf)
{
if (andOp) buf.append('+');
else if (notOp) buf.append('-');
buf.append('@').append(Repository.escapeQName(qname)).append(":\"")
buf.append(" @").append(Repository.escapeQName(qname)).append(":\"")
.append(SearchContext.escape(value)).append("\" ");
}
@@ -514,11 +493,33 @@ public class SearchContext implements Serializable
* @param attrBuf Attribute search buffer to append lucene terms to
* @param textBuf Text search buffer to append lucene terms to
*/
private static void processSearchTextAttribute(String qname, String value, StringBuilder attrBuf, StringBuilder textBuf)
private static void processSearchTextAttribute(String qname, String value, boolean appendText, StringBuilder mnBuf)
{
textBuf.append("TEXT:\"").append(SearchContext.escape(value)).append('"');
attrBuf.append('@').append(qname).append(":\"")
mnBuf.append('@').append(qname).append(":\"")
.append(SearchContext.escape(value)).append('"');
if (appendText)
{
mnBuf.append(" TEXT:\"").append(SearchContext.escape(value)).append("\" ");
}
}
private static void processSearchAdditionalAttribute(String value, boolean operatorNOT, boolean operatorAND, StringBuilder mnBuf, StringBuilder plBuf,
List<QName> simpleSearchAdditionalAttrs)
{
for (QName qname : simpleSearchAdditionalAttrs)
{
// prepend NOT operator if supplied
if (operatorNOT)
{
processSearchAttribute(qname, value, mnBuf);
}
// prepend AND operator if supplied
if (operatorAND)
{
processSearchAttribute(qname, value, plBuf);
}
}
}
/**

View File

@@ -834,6 +834,9 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
out.write(bundle.getString(MSG_ACTIONS));
out.write("</th></tr>");
// assets copy to set checkbox value by node index
List<AssetInfo> assetsCopy = new ArrayList<AssetInfo>(assets);
// move conflicts to top of list
if (diffCount > 0)
{
@@ -871,8 +874,9 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
out.write(id);
out.write("' value='");
// the value is a username index followed by a node lookup index
out.write(Integer.toString(index) + '_' + Integer.toString(rowIndex++));
out.write(Integer.toString(index) + '_' + Integer.toString(assetsCopy.indexOf(node)));
out.write("'></td>");
rowIndex++;
if (isGhost == false)
{