Added the following community contribution from Ray Gauss II "Add configuration to allow basic search to be changed to search X, Y, Z attributes by default."

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5649 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-05-09 16:40:28 +00:00
parent 0234890142
commit c9ceb5fc4f
4 changed files with 132 additions and 7 deletions

View File

@@ -24,6 +24,8 @@
*/
package org.alfresco.web.config;
import java.util.List;
import javax.faces.context.FacesContext;
import org.alfresco.config.ConfigElement;
@@ -31,6 +33,7 @@ import org.alfresco.config.JNDIConstants;
import org.alfresco.config.element.ConfigElementAdapter;
import org.alfresco.mbeans.VirtServerRegistry;
import org.alfresco.repo.cache.ExpiringValueCache;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Repository;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -68,6 +71,7 @@ public class ClientConfigElement extends ConfigElementAdapter
private boolean clipboardStatusVisible = true;
private boolean pasteAllAndClear = true;
private boolean allowGuestConfig = false;
private List<QName> simpleSearchAdditionalAttributes = null;
/**
* Default Constructor
@@ -204,6 +208,12 @@ public class ClientConfigElement extends ConfigElementAdapter
combinedElement.setAllowGuestConfig(newElement.getAllowGuestConfig());
}
if (newElement.getSimpleSearchAdditionalAttributes() != null &&
newElement.getSimpleSearchAdditionalAttributes().equals(combinedElement.getSimpleSearchAdditionalAttributes()) == false)
{
combinedElement.setSimpleSearchAdditionalAttributes(newElement.getSimpleSearchAdditionalAttributes());
}
return combinedElement;
}
@@ -547,4 +557,20 @@ public class ClientConfigElement extends ConfigElementAdapter
{
return this.allowGuestConfig;
}
/**
* @return Returns the additional attributes to search on a simple search
*/
public List<QName> getSimpleSearchAdditionalAttributes()
{
return this.simpleSearchAdditionalAttributes;
}
/**
* @param simpleSearchAdditionalAttributes The additional simple search attributes
*/
/*package*/ void setSimpleSearchAdditionalAttributes(List<QName> simpleSearchAdditionalAttributes)
{
this.simpleSearchAdditionalAttributes = simpleSearchAdditionalAttributes;
}
}

View File

@@ -24,9 +24,14 @@
*/
package org.alfresco.web.config;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigException;
import org.alfresco.config.xml.elementreader.ConfigElementReader;
import org.alfresco.service.namespace.QName;
import org.dom4j.Element;
/**
@@ -54,6 +59,8 @@ public class ClientElementReader implements ConfigElementReader
public static final String ELEMENT_CLIPBOARDSTATUS = "clipboard-status-visible";
public static final String ELEMENT_PASTEALLANDCLEAR = "paste-all-and-clear";
public static final String ELEMENT_GUESTCONFIG = "allow-guest-config";
public static final String ELEMENT_SIMPLESEARCHADDITIONALATTRS = "simple-search-additional-attributes";
public static final String ELEMENT_SIMPLESEARCHADDITIONALATTRSQNAME = "qname";
/**
* @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element)
@@ -160,7 +167,7 @@ public class ClientElementReader implements ConfigElementReader
configElement.setLoginPage(loginPage.getTextTrim());
}
// get the ajax enabled flag
// get the node summary popup enabled flag
Element ajaxEnabled = element.element(ELEMENT_NODESUMMARY_ENABLED);
if (ajaxEnabled != null)
{
@@ -204,6 +211,23 @@ public class ClientElementReader implements ConfigElementReader
boolean allow = Boolean.parseBoolean(guestConfigElement.getTextTrim());
configElement.setAllowGuestConfig(allow);
}
// get the additional simple search attributes
Element simpleSearchAdditionalAttributesElement = element.element(ELEMENT_SIMPLESEARCHADDITIONALATTRS);
if (simpleSearchAdditionalAttributesElement != null)
{
List<Element> attrbElements =
simpleSearchAdditionalAttributesElement.elements(ELEMENT_SIMPLESEARCHADDITIONALATTRSQNAME);
if (attrbElements != null && attrbElements.size() != 0)
{
List<QName> simpleSearchAddtlAttrb = new ArrayList<QName>(4);
for (Element elem : attrbElements)
{
simpleSearchAddtlAttrb.add(QName.createQName(elem.getTextTrim()));
}
configElement.setSimpleSearchAdditionalAttributes(simpleSearchAddtlAttrb);
}
}
}
return configElement;