mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Partially applied patch from ETHREEOH-2145 to resolve combining issue in JSF client config
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14510 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -91,7 +91,7 @@
|
||||
|
||||
<!-- Domain suffix appended to the CIFS URL host name -->
|
||||
<!--
|
||||
<cifs-url-suffix>.alfresco.org<cifs-url-suffix>
|
||||
<cifs-url-suffix>.alfresco.org</cifs-url-suffix>
|
||||
-->
|
||||
|
||||
<!-- Breadcrumb mode, can be either 'path' or 'location' -->
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.web.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
@@ -80,7 +81,7 @@ public class ClientConfigElement extends ConfigElementAdapter
|
||||
private int minUsernameLength = 2;
|
||||
private int minPasswordLength = 3;
|
||||
private String breadcrumbMode = BREADCRUMB_PATH;
|
||||
private String cifsURLSuffix;
|
||||
private String cifsURLSuffix = null;
|
||||
private boolean languageSelect = true;
|
||||
private boolean zeroByteFileUploads = true;
|
||||
private boolean userGroupAdmin = true;
|
||||
@@ -160,6 +161,38 @@ public class ClientConfigElement extends ConfigElementAdapter
|
||||
combinedElement.setHomeSpacePermission(newElement.getHomeSpacePermission());
|
||||
}
|
||||
|
||||
if (newElement.getCifsURLSuffix() == null)
|
||||
{
|
||||
combinedElement.setCifsURLSuffix(this.cifsURLSuffix);
|
||||
}
|
||||
else
|
||||
{
|
||||
combinedElement.setCifsURLSuffix(newElement.getCifsURLSuffix());
|
||||
}
|
||||
|
||||
if (newElement.getSimpleSearchAdditionalAttributes() == null)
|
||||
{
|
||||
combinedElement.setSimpleSearchAdditionalAttributes(this.simpleSearchAdditionalAttributes);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.simpleSearchAdditionalAttributes == null)
|
||||
{
|
||||
// there aren't any existing attributes so just use the new set
|
||||
combinedElement.setSimpleSearchAdditionalAttributes(newElement.getSimpleSearchAdditionalAttributes());
|
||||
}
|
||||
else
|
||||
{
|
||||
// get the current list and add the additional attributes to it
|
||||
List<QName> newAttrs = newElement.getSimpleSearchAdditionalAttributes();
|
||||
List<QName> combinedAttrs = new ArrayList<QName>(
|
||||
this.simpleSearchAdditionalAttributes.size() + newAttrs.size());
|
||||
combinedAttrs.addAll(this.simpleSearchAdditionalAttributes);
|
||||
combinedAttrs.addAll(newAttrs);
|
||||
combinedElement.setSimpleSearchAdditionalAttributes(combinedAttrs);
|
||||
}
|
||||
}
|
||||
|
||||
// override default values if they have changed
|
||||
if (newElement.getDefaultHomeSpacePath() != null &&
|
||||
newElement.getDefaultHomeSpacePath().equals(combinedElement.getDefaultHomeSpacePath()) == false)
|
||||
@@ -234,12 +267,6 @@ public class ClientConfigElement extends ConfigElementAdapter
|
||||
combinedElement.setAllowGuestConfig(newElement.getAllowGuestConfig());
|
||||
}
|
||||
|
||||
if (newElement.getSimpleSearchAdditionalAttributes() != null &&
|
||||
newElement.getSimpleSearchAdditionalAttributes().equals(combinedElement.getSimpleSearchAdditionalAttributes()) == false)
|
||||
{
|
||||
combinedElement.setSimpleSearchAdditionalAttributes(newElement.getSimpleSearchAdditionalAttributes());
|
||||
}
|
||||
|
||||
if (newElement.getMinUsernameLength() != combinedElement.getMinUsernameLength())
|
||||
{
|
||||
combinedElement.setMinUsernameLength(newElement.getMinUsernameLength());
|
||||
@@ -250,12 +277,6 @@ public class ClientConfigElement extends ConfigElementAdapter
|
||||
combinedElement.setMinPasswordLength(newElement.getMinPasswordLength());
|
||||
}
|
||||
|
||||
if ( newElement.getCifsURLSuffix() != null &&
|
||||
newElement.getCifsURLSuffix().equals(combinedElement.getCifsURLSuffix()) == false)
|
||||
{
|
||||
combinedElement.setCifsURLSuffix(newElement.getCifsURLSuffix());
|
||||
}
|
||||
|
||||
if (newElement.getBreadcrumbMode() != null &&
|
||||
newElement.getBreadcrumbMode().equals(combinedElement.getBreadcrumbMode()) == false)
|
||||
{
|
||||
|
@@ -33,6 +33,7 @@ import org.alfresco.config.Config;
|
||||
import org.alfresco.config.ConfigElement;
|
||||
import org.alfresco.config.ConfigException;
|
||||
import org.alfresco.config.xml.XMLConfigService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.BaseTest;
|
||||
import org.alfresco.web.config.ActionsConfigElement.ActionDefinition;
|
||||
import org.alfresco.web.config.ActionsConfigElement.ActionGroup;
|
||||
@@ -321,6 +322,10 @@ public class WebClientConfigTest extends BaseTest
|
||||
assertEquals("recent spaces", 1, clientConfig.getRecentSpacesItems());
|
||||
assertEquals("search minimum", 10, clientConfig.getSearchMinimum());
|
||||
assertFalse("shelf visible", clientConfig.isShelfVisible());
|
||||
|
||||
List<QName> attrs = clientConfig.getSimpleSearchAdditionalAttributes();
|
||||
assertNotNull("Expecting a list of search attributes", attrs);
|
||||
assertEquals("Expecting 4 search attributes", 4, attrs.size());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -895,4 +900,25 @@ public class WebClientConfigTest extends BaseTest
|
||||
assertEquals("number of items in new_group group", 1, actions.size());
|
||||
assertEquals("action", "custom_action", actions.get(0));
|
||||
}
|
||||
|
||||
public void testETHREEOH2145()
|
||||
{
|
||||
XMLConfigService svc = initXMLConfigService("test-config.xml", "test-config-e30-2145.xml");
|
||||
|
||||
// get the "client" config from global config section
|
||||
Config cfg = svc.getGlobalConfig();
|
||||
assertNotNull("cfg should not be null", cfg);
|
||||
ClientConfigElement clientConfig = (ClientConfigElement)cfg.getConfigElement("client");
|
||||
assertNotNull("clientConfig should not be null", clientConfig);
|
||||
|
||||
assertEquals("from-email-address", "alfresco@alfresco.org", clientConfig.getFromEmailAddress());
|
||||
assertEquals("cifs-url-suffix", ".alfresco.org", clientConfig.getCifsURLSuffix());
|
||||
assertEquals("edit-link-type", "http", clientConfig.getEditLinkType());
|
||||
assertEquals("error-page", "/jsp/error.jsp", clientConfig.getErrorPage());
|
||||
assertEquals("home-space-permission", "Consumer", clientConfig.getHomeSpacePermission());
|
||||
|
||||
List<QName> attrs = clientConfig.getSimpleSearchAdditionalAttributes();
|
||||
assertNotNull("Expecting a list of search attributes", attrs);
|
||||
assertEquals("Expecting 2 search attributes", 2, attrs.size());
|
||||
}
|
||||
}
|
||||
|
10
source/test-resources/test-config-e30-2145.xml
Normal file
10
source/test-resources/test-config-e30-2145.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<alfresco-config>
|
||||
|
||||
<!-- Test for ETHREEOH-2145 where having an empty client config element wipes out -->
|
||||
<!-- existing values -->
|
||||
<config>
|
||||
<client>
|
||||
</client>
|
||||
</config>
|
||||
|
||||
</alfresco-config>
|
@@ -29,6 +29,12 @@
|
||||
|
||||
<!-- the from address to use when sending emails from the client -->
|
||||
<from-email-address>me@somewhere.com</from-email-address>
|
||||
|
||||
<!-- add some more search attributes -->
|
||||
<simple-search-additional-attributes>
|
||||
<qname>attr3</qname>
|
||||
<qname>attr4</qname>
|
||||
</simple-search-additional-attributes>
|
||||
</client>
|
||||
</config>
|
||||
|
||||
|
@@ -45,8 +45,12 @@
|
||||
<!-- can be: http|webdav|cifs -->
|
||||
<edit-link-type>http</edit-link-type>
|
||||
|
||||
<!-- the from address to use when sending emails from the client -->
|
||||
<from-email-address>alfresco@alfresco.org</from-email-address>
|
||||
<cifs-url-suffix>.alfresco.org</cifs-url-suffix>
|
||||
|
||||
<simple-search-additional-attributes>
|
||||
<qname>attr1</qname>
|
||||
<qname>attr2</qname>
|
||||
</simple-search-additional-attributes>
|
||||
</client>
|
||||
|
||||
<actions>
|
||||
|
Reference in New Issue
Block a user