Merged V2.2 to HEAD

10982: Merged V2.1 to V2.2
      10273: Fix for ETWOONE-317: Error from regenerate renditions wizard when templates are updated
   10985: Merged V2.1 to V2.2
      10717: Fix for ETWOONE-14: System Error message appears while clicking 'Manage Task' icon in ...
      10742: Fix for ETWOONE-119: A user created with space characters at the begin and at the end can't login
      10758: Fix for ETWOONE-183: URL addressability of forum spaces and topics
      10760: Fix for ETWOONE-339: URL Addressability to discussions causes display issue
      10761: Fix for ETWOONE-196: Attempt to post to the same forum by two or more users simultaneously leads to error appearance and impossibility to post for some of them
      10772: Fix for ETWOONE-225: Validation.js does not properly handle trailing whitespace
   10986: Added Hibernate src to Eclipse project
   11004: Remove annoying exceptions on shutdown
   11005: Minor javadoc fix
   11012: Fixed ETWOTWO-423: Optionally inject the Open Office document converter instance to the transformer


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11202 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-10-06 11:22:26 +00:00
parent c9afa4a3c8
commit 09c1c23776
9 changed files with 317 additions and 14 deletions

View File

@@ -35,6 +35,7 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -280,6 +281,9 @@ public class ForumsBean implements IContextListener
this.viewsConfig.getDefaultSortColumn(PAGE_NAME_FORUMS));
this.forumsRichList.setInitialSortDescending(
this.viewsConfig.hasDescendingSort(PAGE_NAME_FORUMS));
// ETWOONE-183 & ETWOONE-339. For URL addressability of forums spaces
this.forumsRichList.setRefreshOnBind(true);
}
}
@@ -337,6 +341,9 @@ public class ForumsBean implements IContextListener
this.viewsConfig.getDefaultSortColumn(PAGE_NAME_TOPIC));
this.topicRichList.setInitialSortDescending(
this.viewsConfig.hasDescendingSort(PAGE_NAME_TOPIC));
// ETWOONE-183. For URL addressability of topics:
this.topicRichList.setRefreshOnBind(true);
}
}
@@ -394,6 +401,9 @@ public class ForumsBean implements IContextListener
this.viewsConfig.getDefaultSortColumn(PAGE_NAME_FORUM));
this.forumRichList.setInitialSortDescending(
this.viewsConfig.hasDescendingSort(PAGE_NAME_FORUM));
// ETWOONE-183 & ETWOONE-339. For URL addressability of forum spaces
this.forumRichList.setRefreshOnBind(true);
}
}
@@ -928,6 +938,10 @@ public class ForumsBean implements IContextListener
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss");
name.append(dateFormat.format(new Date()));
// add Universal Unique Identifier
// fix bugs ETWOONE-196 and ETWOONE-203
name.append("-" + UUID.randomUUID());
// add the HTML file extension
name.append(".html");

View File

@@ -39,9 +39,13 @@ import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.forms.Form;
import org.alfresco.web.forms.RenderingEngineTemplate;
import org.alfresco.web.forms.xforms.SchemaUtil;
@@ -53,6 +57,11 @@ import org.apache.commons.logging.LogFactory;
* Backing bean for the Edit Form wizard.
*
* @author Ariel Backenroth
* @author Arseny Kovalchuk (Bug Fixer)
*
* Methods removeRenderingEngineTemplateFromWebProjects, addRenderingEngineTemplateToWebProjects, searchRenderingEngineTemplateInWebProject
* are added to fix an issue reported in https://issues.alfresco.com/jira/browse/ETWOONE-317
*
*/
public class EditFormWizard
extends CreateFormWizard
@@ -91,8 +100,10 @@ public class EditFormWizard
this.getNodeService().getProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA);
if (schemaNodeRef == null)
{
LOGGER.debug(WCMAppModel.PROP_XML_SCHEMA + " not set on " + formNodeRef +
", checking " + WCMAppModel.PROP_XML_SCHEMA_OLD);
if (LOGGER.isDebugEnabled())
LOGGER.debug(WCMAppModel.PROP_XML_SCHEMA + " not set on " + formNodeRef +
", checking " + WCMAppModel.PROP_XML_SCHEMA_OLD);
schemaNodeRef = (NodeRef)
getNodeService().getProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA_OLD);
if (schemaNodeRef != null)
@@ -175,8 +186,10 @@ public class EditFormWizard
if (wd != null && workflowRefs.size() == 0)
{
LOGGER.debug("adding workflow definition " + wd.getName() +
" to form " + this.getFormName());
if (LOGGER.isDebugEnabled())
LOGGER.debug("adding workflow definition " + wd.getName() +
" to form " + this.getFormName());
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f);
props.put(WCMAppModel.PROP_WORKFLOW_NAME, wd.getName());
this.getNodeService().createNode(formNodeRef,
@@ -187,15 +200,19 @@ public class EditFormWizard
}
else if (wd != null && workflowRefs.size() == 1)
{
LOGGER.debug("setting workflow definition " + wd.getName() +
" to form " + this.getFormName());
if (LOGGER.isDebugEnabled())
LOGGER.debug("setting workflow definition " + wd.getName() +
" to form " + this.getFormName());
this.getNodeService().setProperty(workflowRefs.get(0).getChildRef(),
WCMAppModel.PROP_WORKFLOW_NAME,
wd.getName());
}
else if (wd == null && workflowRefs.size() == 1)
{
LOGGER.debug("removing workflow definitions from form " + this.getFormName());
if (LOGGER.isDebugEnabled())
LOGGER.debug("removing workflow definitions from form " + this.getFormName());
this.getNodeService().removeChild(formNodeRef, workflowRefs.get(0).getChildRef());
}
@@ -222,24 +239,148 @@ public class EditFormWizard
{
for (final RenderingEngineTemplateData retd : this.removedRenderingEngineTemplates)
{
LOGGER.debug("removing rendering engine template " + retd);
if (LOGGER.isDebugEnabled())
LOGGER.debug("removing rendering engine template " + retd);
assert retd != null;
assert retd.getNodeRef() != null;
this.getNodeService().removeChild(formNodeRef, retd.getNodeRef());
this.removeRenderingEngineTemplateFromWebProjects(formNodeRef, retd);
}
}
for (final RenderingEngineTemplateData retd : this.renderingEngineTemplates)
{
if (retd.getFile() != null)
{
this.saveRenderingEngineTemplate(retd, formNodeRef);
this.addRenderingEngineTemplateToWebProjects(formNodeRef, retd);
}
}
return outcome;
}
/**
* Removes an associated Rendering Engine Template from all web forms in all web projects.
*
* @param formNodeRef Form nodeRef
* @param retd Rendering engine template to remove from web projects
*/
private void removeRenderingEngineTemplateFromWebProjects(NodeRef formNodeRef, RenderingEngineTemplateData retd)
{
List<WebProject> webProjects = getFormsService().getAssociatedWebProjects(getFormsService().getForm(formNodeRef));
for (WebProject wp: webProjects)
{
ResultSet results = searchRenderingEngineTemplateInWebProject(wp, retd.getName());
for (int i=0; i<results.length(); i++)
{
NodeRef webformTemplateNodeRef = results.getNodeRef(i);
NodeRef webformNodeRef = getNodeService().getPrimaryParent(webformTemplateNodeRef).getParentRef();
getNodeService().removeChild(webformNodeRef, webformTemplateNodeRef);
if (LOGGER.isDebugEnabled())
LOGGER.debug(webformNodeRef);
}
}
}
/**
* Adds or updates an associated Rendering Engine Template from all web forms in all web projects.
*
* @param formNodeRef
* @param retd Rendering engine template to remove from web projects
*/
private void addRenderingEngineTemplateToWebProjects(NodeRef formNodeRef, RenderingEngineTemplateData retd)
{
Form form = getFormsService().getForm(formNodeRef);
List<WebProject> webProjects = getFormsService().getAssociatedWebProjects(form);
Map<QName, Serializable> props = new HashMap<QName, Serializable>(4, 1.0f);
for (WebProject wp: webProjects)
{
ResultSet results = searchRenderingEngineTemplateInWebProject(wp, retd.getName());
int resultsCount = results.length();
if (resultsCount>0)
{
//update
for (int i=0; i<resultsCount; i++)
{
NodeRef webformTemplateNodeRef = results.getNodeRef(i);
if (retd.getOutputPathPatternForRendition() != null)
{
props.clear();
props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, retd.getOutputPathPatternForRendition());
getNodeService().addAspect(webformTemplateNodeRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props);
}
}
}
else
{
//just add
String query = "+TYPE:\"" + WCMAppModel.TYPE_WEBFORM + "\"" +
" +@" + Repository.escapeQName(WCMAppModel.PROP_FORMNAME) + ":\"" + form.getName() + "\"";
if (LOGGER.isDebugEnabled())
LOGGER.debug("Search web forms query: " + query);
ResultSet webforms = getSearchService().query(wp.getNodeRef().getStoreRef(), SearchService.LANGUAGE_LUCENE, query);
props.clear();
props.put(WCMAppModel.PROP_BASE_RENDERING_ENGINE_TEMPLATE_NAME,
retd.getName());
for (int i=0; i<webforms.length(); i++)
{
if (LOGGER.isDebugEnabled())
LOGGER.debug("WebForm NodeRef: " + webforms.getNodeRef(i));
NodeRef templateRef = getNodeService().createNode(webforms.getNodeRef(i),
WCMAppModel.ASSOC_WEBFORMTEMPLATE,
WCMAppModel.ASSOC_WEBFORMTEMPLATE,
WCMAppModel.TYPE_WEBFORMTEMPLATE,
props).getChildRef();
if (retd.getOutputPathPatternForRendition() != null)
{
props.clear();
props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, retd.getOutputPathPatternForRendition());
getNodeService().addAspect(templateRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props);
}
}
}
}
}
/**
* Searches an specific Web Form Template with appropriate name in the Web Project.
*
* @param wp The WebProject to search
* @param name The name of Rendering Engine Template to search
* @return Search result
*/
private ResultSet searchRenderingEngineTemplateInWebProject(WebProject wp, String name)
{
ResultSet result = null;
StringBuilder query = new StringBuilder(256);
query.append("+TYPE:\"").append(WCMAppModel.TYPE_WEBFORMTEMPLATE).append("\" ");
query.append("+@").append(Repository.escapeQName(WCMAppModel.PROP_BASE_RENDERING_ENGINE_TEMPLATE_NAME)).append(":\"").append(name).append("\" ");
// Search not found anything in this StoreRef!
// It looks like a wrong search in RegenerateRenditionsWizard.
//
//StoreRef storeRef = AVMNodeConverter.ToStoreRef(wp.getStagingStore());
StoreRef storeRef = wp.getNodeRef().getStoreRef();
result = getSearchService().query(storeRef, SearchService.LANGUAGE_LUCENE, query.toString());
if (LOGGER.isDebugEnabled())
{
LOGGER.debug(">>>Web Project: " + wp);
LOGGER.debug(">>>StoreRef: " + storeRef);
LOGGER.debug(">>>Search query: " + query.toString());
LOGGER.debug(">>>Search results: " + result.length());
}
return result;
}
/**
* Action handler called when the Remove button is pressed to remove a
* rendering engine
*/

View File

@@ -161,7 +161,10 @@ public class WebProject implements Serializable
nodeService.getProperty(car.getChildRef(), WCMAppModel.PROP_OUTPUT_PATH_PATTERN);
final RenderingEngineTemplateImpl ret = (RenderingEngineTemplateImpl)
allRets.get(renderingEngineTemplateName);
result.put(ret.getName(),
if (ret != null)
{
result.put(ret.getName(),
new RenderingEngineTemplateImpl(ret.getNodeRef(),
ret.getRenditionPropertiesNodeRef(),
this.getFormsService())
@@ -174,6 +177,7 @@ public class WebProject implements Serializable
return outputPathPattern;
}
});
}
}
return result;

View File

@@ -814,6 +814,11 @@ public class NewUserWizard extends AbstractWizardBean
*/
public void setUserName(String userName)
{
if (userName != null)
{
userName = userName.trim();
}
this.userName = userName;
}