Merged V2.1 to HEAD

6535: adding in handlers for renames and deletes of webforms to update web project configurations.
   6536: fix to monthpicker.
   6537: Cluster sample config for ticketsCache defaults to replicating puts
   6538: Invite web users wizard was not correctly initialising
   6539: AWC-1474 - Email Space Users dialog - if no email recipients then show message
   6540: Fixed remote classpath check for SDK projects
   6541: AR-1544: Inbound Rules Being Fired on Name Property Update
   6542: Fix for AWC-1216 - changed NavigationBean to spot when CIFS server is disabled (as the method has changed in repo)
   6543: AR-1623: WebServices authentication errors during concurrent load test
   6544: AWC-1253: AddContent action should be externally configurable/overridable
   6545: Fixed AR-1586: Nicer message when installing older module or duplicate module
   6546: AWC-1301: Access Denied viewing details of content with association
   6547: AWC-1499: It is impossible to remove 'Complianceable' aspect with the help of Run action
   6548: Missing file ... should fix build issues
   6549: Missed file .. fixed build issue
   6550: AWC-1092: sorting by version number in version history is alpha, not numeric
   6551: AWC-1217: Cannot differentiate between two users with same name in user picker search results
   6552: Fixed AR-1572: Export of ML-enabled documents can now be imported
   6553: Removed tabs
   6554: Fixed handling of SC_NOT_FOUND message
   6555: Fixed AR-1627: Removed ability to flush transaction resources on demand


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6744 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-11 00:52:59 +00:00
parent 598a5ea21a
commit 1b9a268ae3
18 changed files with 241 additions and 70 deletions

View File

@@ -35,6 +35,7 @@ import javax.faces.event.ActionEvent;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.filesys.CIFSServer;
import org.alfresco.filesys.server.config.ServerConfiguration;
import org.alfresco.filesys.server.filesys.DiskSharedDevice;
import org.alfresco.filesys.smb.server.repo.ContentContext;
import org.alfresco.filesys.smb.server.repo.ContentDiskInterface;
@@ -67,6 +68,7 @@ import org.alfresco.web.ui.common.component.UIModeList;
import org.alfresco.web.ui.repo.component.IRepoBreadcrumbHandler;
import org.alfresco.web.ui.repo.component.shelf.UIShelf;
import org.apache.log4j.Logger;
import org.springframework.web.jsf.FacesContextUtils;
/**
* Bean providing access and management of the various global navigation mechanisms
@@ -587,23 +589,27 @@ public class NavigationBean
Path path = node.getNodePath();
// resolve CIFS network folder location for this node
DiskSharedDevice diskShare = cifsServer.getConfiguration().getPrimaryFilesystem();
if (diskShare != null && diskShare.getContext() instanceof ContentContext)
ServerConfiguration fileServiceConfig = (ServerConfiguration)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean("fileServerConfiguration");
if (fileServiceConfig.isSMBServerEnabled())
{
ContentContext contentCtx = (ContentContext) diskShare.getContext();
NodeRef rootNode = contentCtx.getRootNode();
try
DiskSharedDevice diskShare = cifsServer.getConfiguration().getPrimaryFilesystem();
if (diskShare != null && diskShare.getContext() instanceof ContentContext)
{
String cifsPath = Repository.getNamePath(this.nodeService, path, rootNode, "\\", "file:///" + getCIFSServerPath(diskShare));
node.getProperties().put("cifsPath", cifsPath);
node.getProperties().put("cifsPathLabel", cifsPath.substring(8)); // strip file:/// part
}
catch(AccessDeniedException ade)
{
node.getProperties().put("cifsPath", "");
node.getProperties().put("cifsPathLabel",""); // strip file:/// part
ContentContext contentCtx = (ContentContext) diskShare.getContext();
NodeRef rootNode = contentCtx.getRootNode();
try
{
String cifsPath = Repository.getNamePath(this.nodeService, path, rootNode, "\\", "file:///" + getCIFSServerPath(diskShare));
node.getProperties().put("cifsPath", cifsPath);
node.getProperties().put("cifsPathLabel", cifsPath.substring(8)); // strip file:/// part
}
catch(AccessDeniedException ade)
{
node.getProperties().put("cifsPath", "");
node.getProperties().put("cifsPathLabel",""); // strip file:/// part
}
}
}

View File

@@ -19,7 +19,8 @@
* 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" */
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.web.bean.wcm;
import java.io.File;
@@ -685,6 +686,11 @@ public class CreateFormWizard
return false;
}
public List<WebProject> getAssociatedWebProjects()
{
return Collections.<WebProject>emptyList();
}
/**
* Returns the properties for current configured output methods JSF DataModel
*

View File

@@ -51,14 +51,12 @@ import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.DNSNameMangler;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.BaseWizardBean;
import org.alfresco.web.bean.wizard.InviteUsersWizard.UserGroupRole;
import org.alfresco.web.forms.Form;
@@ -86,7 +84,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
private static final String WEBAPP_DEFAULT = "ROOT";
protected final static Log LOGGER = LogFactory.getLog(CreateWebsiteWizard.class);
protected final static Log logger = LogFactory.getLog(CreateWebsiteWizard.class);
protected boolean editMode = false;
protected String dnsName;
@@ -171,8 +169,8 @@ public class CreateWebsiteWizard extends BaseWizardBean
WCMAppModel.TYPE_AVMWEBFOLDER);
NodeRef nodeRef = fileInfo.getNodeRef();
if (LOGGER.isDebugEnabled())
LOGGER.debug("Created website folder node with name: " + this.name);
if (logger.isDebugEnabled())
logger.debug("Created website folder node with name: " + this.name);
// TODO: check that this dns is unique by querying existing store properties for a match
String avmStore = DNSNameMangler.MakeDNSName(this.dnsName);
@@ -193,7 +191,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
// call a delegate wizard bean to provide invite user functionality
InviteWebsiteUsersWizard wiz = getInviteUsersWizard();
wiz.init(null);
wiz.reset();
wiz.setNode(new Node(nodeRef));
wiz.setAvmStore(avmStore);
wiz.setStandalone(false);

View File

@@ -63,6 +63,7 @@ public class EditFormWizard
private final static Log LOGGER = LogFactory.getLog(EditFormWizard.class);
private List<RenderingEngineTemplateData> removedRenderingEngineTemplates;
private List<WebProject> associatedWebProjects;
// ------------------------------------------------------------------------------
// Wizard implementation
@@ -136,6 +137,7 @@ public class EditFormWizard
this.renderingEngineTemplates.add(data);
}
this.removedRenderingEngineTemplates = null;
this.associatedWebProjects = this.formsService.getAssociatedWebProjects(form);
}
/**
@@ -149,7 +151,11 @@ public class EditFormWizard
final NodeRef formNodeRef = this.browseBean.getActionSpace().getNodeRef();
// apply the name, title and description props
this.nodeService.setProperty(formNodeRef, ContentModel.PROP_NAME, this.getFormName());
if (!this.getFormName().equals(this.nodeService.getProperty(formNodeRef, ContentModel.PROP_NAME)))
{
this.fileFolderService.rename(formNodeRef, this.getFormName());
}
this.nodeService.setProperty(formNodeRef, ContentModel.PROP_TITLE, this.getFormTitle());
this.nodeService.setProperty(formNodeRef, ContentModel.PROP_DESCRIPTION, this.getFormDescription());
this.nodeService.setProperty(formNodeRef,
@@ -252,8 +258,15 @@ public class EditFormWizard
/** Indicates whether or not the wizard is currently in edit mode */
@Override
public boolean getEditMode()
{
return true;
}
@Override
public List<WebProject> getAssociatedWebProjects()
{
return this.associatedWebProjects;
}
}

View File

@@ -147,7 +147,7 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
catch (FormNotFoundException fnfe)
{
//ignore
LOGGER.debug(fnfe.getMessage(), fnfe);
logger.debug(fnfe.getMessage(), fnfe);
}
}

View File

@@ -59,9 +59,6 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
/** the node representing the website */
private Node website;
/** list of authorities with the Content Manager role */
private List<String> managers;
/** root AVM store the users are invited into */
private String avmStore;
@@ -93,11 +90,19 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
// only allow one selection per authority
this.allowDuplicateAuthorities = false;
this.website = null;
this.managers = null;
this.avmStore = null;
this.standalone = true;
}
public void reset()
{
this.isFinished = false;
this.allowDuplicateAuthorities = false;
this.website = null;
this.avmStore = null;
this.standalone = true;
}
/**
* @see org.alfresco.web.bean.wizard.InviteUsersWizard#finishImpl(javax.faces.context.FacesContext, java.lang.String)
*/
@@ -108,7 +113,7 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
// create a sandbox for each user appropriately with permissions based on role
// build a list of managers who will have full permissions on ALL staging areas
this.managers = new ArrayList<String>(4);
List<String> managers = new ArrayList<String>(4);
Set<String> existingUsers = new HashSet(8);
if (isStandalone() == false)
{
@@ -127,7 +132,7 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
}
if (AVMUtil.ROLE_CONTENT_MANAGER.equals(userRole.getRole()))
{
this.managers.add(userAuth);
managers.add(userAuth);
}
}
}
@@ -135,7 +140,7 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
if (foundCurrentUser == false)
{
this.userGroupRoles.add(new UserGroupRole(currentUser, AVMUtil.ROLE_CONTENT_MANAGER, null));
this.managers.add(currentUser);
managers.add(currentUser);
}
}
else
@@ -148,7 +153,7 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
{
if (AVMUtil.ROLE_CONTENT_MANAGER.equals(userRole.getRole()))
{
this.managers.add(userAuth);
managers.add(userAuth);
}
}
}
@@ -162,9 +167,9 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
String userrole = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
if (AVMUtil.ROLE_CONTENT_MANAGER.equals(userrole) &&
this.managers.contains(username) == false)
managers.contains(username) == false)
{
this.managers.add(username);
managers.add(username);
}
// add each existing user to the exclude this - we cannot add them more than once!
@@ -185,7 +190,7 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
if (existingUsers.contains(userAuth) == false)
{
SandboxInfo info = SandboxFactory.createUserSandbox(
getAvmStore(), this.managers, userAuth, userRole.getRole());
getAvmStore(), managers, userAuth, userRole.getRole());
this.sandboxInfoList.add(info);
@@ -218,7 +223,7 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
if (existingUsers.contains(username))
{
// only need to modify the sandboxes we haven't just created
SandboxFactory.updateSandboxManagers(getAvmStore(), this.managers, username);
SandboxFactory.updateSandboxManagers(getAvmStore(), managers, username);
}
}
}
@@ -352,14 +357,6 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
}
}
/**
* @return List of authorities with the Content Manager role
*/
public List<String> getManagers()
{
return this.managers;
}
/**
* @return Returns the root AVM store.
*/

View File

@@ -319,7 +319,7 @@ public abstract class InviteUsersWizard extends BaseWizardBean
String firstName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);
String lastName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME);
String username = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_USERNAME);
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName, lastName);
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName + " [" + username + "]", lastName);
items[index] = item;
}
}

View File

@@ -38,11 +38,16 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.Behaviour;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.search.impl.lucene.QueryParser;
import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.MimetypeService;
@@ -96,12 +101,23 @@ public final class FormsService
public FormsService(final ContentService contentService,
final NodeService nodeService,
final NamespaceService namespaceService,
final SearchService searchService)
final SearchService searchService,
final PolicyComponent policyComponent)
{
this.contentService = contentService;
this.nodeService = nodeService;
this.namespaceService = namespaceService;
this.searchService = searchService;
policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onMoveNode"),
WCMAppModel.TYPE_FORMFOLDER,
new JavaBehaviour(this,
"handleMoveFormFolder",
Behaviour.NotificationFrequency.FIRST_EVENT));
policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"),
WCMAppModel.TYPE_FORMFOLDER,
new JavaBehaviour(this,
"handleDeleteFormFolder",
Behaviour.NotificationFrequency.FIRST_EVENT));
}
/**
@@ -174,18 +190,16 @@ public final class FormsService
*/
public Collection<Form> getForms()
{
final SearchParameters sp = new SearchParameters();
sp.addStore(Repository.getStoreRef());
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery("+ASPECT:\"" + WCMAppModel.ASPECT_FORM +
"\" +PARENT:\"" + this.getContentFormsNodeRef() + "\"");
final String query =
"+ASPECT:\"" + WCMAppModel.ASPECT_FORM +
"\" +PARENT:\"" + this.getContentFormsNodeRef() + "\"";
final ResultSet rs = this.searchService.query(Repository.getStoreRef(),
SearchService.LANGUAGE_LUCENE,
query);
if (LOGGER.isDebugEnabled())
LOGGER.debug("running query [" + sp.getQuery() + "]");
final ResultSet rs = this.searchService.query(sp);
if (LOGGER.isDebugEnabled())
LOGGER.debug("received " + rs.length() + " results");
LOGGER.debug("found " + rs.length() + " form definitions");
final Collection<Form> result = new ArrayList<Form>(rs.length());
for (ResultSetRow row : rs)
for (final ResultSetRow row : rs)
{
result.add(this.getForm(row.getNodeRef()));
}
@@ -269,4 +283,87 @@ public final class FormsService
{
return new RenditionImpl(nodeRef, this);
}
public List<WebProject> getAssociatedWebProjects(final Form form)
{
final List<NodeRef> formConfigurations = this.getFormConfigurations(form.getName());
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("found " + formConfigurations.size() +
" web projects configured with " + form.getName());
}
final List<WebProject> result = new ArrayList<WebProject>(formConfigurations.size());
for (final NodeRef ref : formConfigurations)
{
final List<ChildAssociationRef> parents = this.nodeService.getParentAssocs(ref);
assert parents.size() != 1 : ("expected only one parent for " + ref +
" got " + parents.size());
result.add(new WebProject(parents.get(0).getParentRef()));
}
return result;
}
// event handlers
public void handleMoveFormFolder(final ChildAssociationRef oldChild, final ChildAssociationRef newChild)
{
final String oldName = oldChild.getQName().getLocalName();
final String newName = newChild.getQName().getLocalName();
final List<NodeRef> formConfigurations = this.getFormConfigurations(oldName);
// find all webprojects that used the old name
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("handling rename (" + oldName +
" => " + newName +
") for " + formConfigurations.size());
}
for (final NodeRef ref : formConfigurations)
{
this.nodeService.setProperty(ref,
WCMAppModel.PROP_FORMNAME,
newName);
}
}
public void handleDeleteFormFolder(final ChildAssociationRef childRef,
final boolean isArchivedNode)
{
final String formName = childRef.getQName().getLocalName();
final List<NodeRef> formConfigurations = this.getFormConfigurations(formName);
for (final NodeRef ref : formConfigurations)
{
final List<ChildAssociationRef> parents = this.nodeService.getParentAssocs(ref);
assert parents.size() != 1 : ("expected only one parent for " + ref +
" got " + parents.size());
final NodeRef parentRef = parents.get(0).getParentRef();
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("removing configuration for " + formName +
" from web project " + this.nodeService.getProperty(parentRef, ContentModel.PROP_NAME));
}
this.nodeService.removeChild(parentRef, ref);
}
}
private List<NodeRef> getFormConfigurations(final String formName)
{
final String query =
"+TYPE:\"" + WCMAppModel.TYPE_WEBFORM +
"\" +@" + Repository.escapeQName(WCMAppModel.PROP_FORMNAME) +
":\"" + QueryParser.escape(formName) + "\"";
final ResultSet rs = this.searchService.query(Repository.getStoreRef(),
SearchService.LANGUAGE_LUCENE,
query);
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("query " + query + " returned " + rs.length() + " results");
}
final List<NodeRef> result = new ArrayList<NodeRef>(rs.length());
for (final ResultSetRow row : rs)
{
result.add(row.getNodeRef());
}
return result;
}
}

View File

@@ -25,7 +25,6 @@
package org.alfresco.web.ui.repo.component.property;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -35,11 +34,13 @@ import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
@@ -56,6 +57,8 @@ import org.apache.commons.logging.LogFactory;
public class UIAssociationEditor extends BaseAssociationEditor
{
private static final Log logger = LogFactory.getLog(UIAssociationEditor.class);
public static final String MSG_WARN_CANNOT_VIEW_TARGET_DETAILS = "warn_cannot_view_target_details";
// ------------------------------------------------------------------------------
// Component implementation
@@ -180,9 +183,19 @@ public class UIAssociationEditor extends BaseAssociationEditor
else
{
// use the standard cm:name property
out.write(Repository.getDisplayPath(nodeService.getPath(targetNode)));
out.write("/");
out.write(Repository.getNameForNode(nodeService, targetNode));
// Fix AWC-1301
String displayString = null;
try
{
displayString = Repository.getDisplayPath(nodeService.getPath(targetNode)) + "/" + Repository.getNameForNode(nodeService, targetNode);
}
catch (AccessDeniedException ade)
{
displayString = Application.getMessage(context, MSG_WARN_CANNOT_VIEW_TARGET_DETAILS);
}
out.write(displayString);
}
out.write("</td></tr>");
}