Merged V2.1 to HEAD

6418: Allow getLayeringInfo on deleted nodes.
   6419: fixes for submitting of deleted directories and regenerate renditions related fixes.
   6420: Added installs to build
   6421: Build fix for sdk
   6423: WCM-710 - Submit All feature reintroducted to WCM My Modified Files views
   6424: OpenOffice connection is now tested on bootstrap.
   6425: AWC-1446 - Space Selector would show spaces you do not have access to
   6426: WCM-699 - Staging area user assets
   6427: Rollback exceptions now explicitly handled by RetryingTransactionHelper to extract the cause of the exception.
   6428: Fix for AWC-1340
   6429: Fixed transaction boundaries for full index recovery components
   6433: AR-1660 - SMB and SMB2 signature check 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6732 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 21:50:49 +00:00
parent 26172af267
commit a8023d20a2
14 changed files with 111 additions and 51 deletions

View File

@@ -723,6 +723,7 @@
<action idref="import_space" />
<action idref="manage_space_users" />
<action idref="manage_space_rules" />
<action idref="regenerate_renditions" />
<!-- NOTE: now found on the User Console
<action idref="manage_deleted_items" />-->
</action-group>

View File

@@ -34,6 +34,7 @@ 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.wcm.AVMBrowseBean;
import org.alfresco.web.bean.wcm.AVMUtil;
import org.alfresco.web.bean.wcm.WebProject;
/**
@@ -48,20 +49,25 @@ public class WCMLockEvaluator implements ActionEvaluator
*/
public boolean evaluate(final Node node)
{
final FacesContext fc = FacesContext.getCurrentInstance();
final AVMLockingService avmLockService = Repository.getServiceRegistry(fc).getAVMLockingService();
final AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME);
boolean result = false;
final String path = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()).getSecond();
final String username = Application.getCurrentUser(fc).getUserName();
WebProject webProject = avmBrowseBean.getWebProject();
if (webProject == null)
if (!AVMUtil.isMainStore(AVMUtil.getStoreName(path)))
{
// when in a workflow context, the WebProject may not be accurate on the browsebean
// so get the web project associated with the path
webProject = new WebProject(path);
final FacesContext fc = FacesContext.getCurrentInstance();
final AVMLockingService avmLockService = Repository.getServiceRegistry(fc).getAVMLockingService();
final AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME);
final String username = Application.getCurrentUser(fc).getUserName();
WebProject webProject = avmBrowseBean.getWebProject();
if (webProject == null)
{
// when in a workflow context, the WebProject may not be accurate on the browsebean
// so get the web project associated with the path
webProject = new WebProject(path);
}
result = avmLockService.hasAccess(webProject.getNodeRef(), path, username);
}
return avmLockService.hasAccess(webProject.getNodeRef(), path, username);
return result;
}
}

View File

@@ -461,11 +461,11 @@ public class CategoriesBean implements IContextListener
NodeRef ref;
if (categoryRef == null)
{
ref = categoryService.createRootCategory(Repository.getStoreRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, name);
ref = categoryService.createRootCategory(Repository.getStoreRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, name.trim());
}
else
{
ref = categoryService.createCategory(categoryRef, name);
ref = categoryService.createCategory(categoryRef, name.trim());
}
// apply the titled aspect - for description

View File

@@ -155,6 +155,18 @@ public final class AVMUtil
return storeName.indexOf(AVMUtil.STORE_SEPARATOR) != -1;
}
/**
* Indicates whether the store name describes a main store.
*
* @param storeName the store name
*
* @return <tt>true</tt> if the store is a main store, <tt>false</tt> otherwise.
*/
public static boolean isMainStore(String storeName)
{
return (storeName.indexOf(AVMUtil.STORE_SEPARATOR) == -1);
}
/**
* Extracts the username from the store name.
*

View File

@@ -71,7 +71,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class AVMWorkflowUtil extends WorkflowUtil
{
private static final Log LOGGER = LogFactory.getLog(AVMWorkflowUtil.class);
private static final Log logger = LogFactory.getLog(AVMWorkflowUtil.class);
// cached configured lists
private static List<WorkflowDefinition> configuredWorkflowDefs = null;
@@ -133,6 +133,7 @@ public class AVMWorkflowUtil extends WorkflowUtil
final ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
final PermissionService permissionService = services.getPermissionService();
permissionService.setPermission(packageNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.ALL_PERMISSIONS, true);
return packageNodeRef;
}
@@ -209,14 +210,14 @@ public class AVMWorkflowUtil extends WorkflowUtil
ConfigElement config = Application.getConfigService(fc).getGlobalConfig().getConfigElement("wcm");
if (config == null)
{
LOGGER.warn("WARNING: Unable to find 'wcm' config element definition.");
logger.warn("WARNING: Unable to find 'wcm' config element definition.");
}
else
{
ConfigElement workflowConfig = config.getChild("workflows");
if (workflowConfig == null)
{
LOGGER.warn("WARNING: Unable to find WCM 'workflows' config element definition.");
logger.warn("WARNING: Unable to find WCM 'workflows' config element definition.");
}
else
{
@@ -233,7 +234,7 @@ public class AVMWorkflowUtil extends WorkflowUtil
}
else
{
LOGGER.warn("WARNING: Cannot find WCM workflow def for configured definition name: " + wfName);
logger.warn("WARNING: Cannot find WCM workflow def for configured definition name: " + wfName);
}
}
}
@@ -249,48 +250,54 @@ public class AVMWorkflowUtil extends WorkflowUtil
final FacesContext fc = FacesContext.getCurrentInstance();
final WorkflowService workflowService = Repository.getServiceRegistry(fc).getWorkflowService();
final WorkflowTaskQuery query = new WorkflowTaskQuery();
final HashMap<QName, Object> props = new HashMap<QName, Object>(1, 1.0f);
props.put(WCMWorkflowModel.PROP_FROM_PATH, fromPath);
query.setProcessCustomProps(props);
final List<WorkflowTask> tasks = workflowService.queryTasks(query);
LOGGER.debug("found " + tasks.size() + " tasks originating user sandbox " + fromPath);
if (logger.isDebugEnabled())
logger.debug("found " + tasks.size() + " tasks originating user sandbox " + fromPath);
return tasks;
}
public static List<WorkflowTask> getAssociatedTasksForNode(final AVMNodeDescriptor node)
public static List<WorkflowTask> getAssociatedTasksForNode(AVMNodeDescriptor node, List<WorkflowTask> tasks)
{
final List<WorkflowTask> tasks = AVMWorkflowUtil.getAssociatedTasksForSandbox(AVMUtil.getStoreName(node.getPath()));
final List<WorkflowTask> result = new LinkedList<WorkflowTask>();
final FacesContext fc = FacesContext.getCurrentInstance();
final AVMService avmService = Repository.getServiceRegistry(fc).getAVMService();
for (final WorkflowTask task : tasks)
{
final NodeRef ref = task.path.instance.workflowPackage;
final String path = AVMUtil.getCorrespondingPath(node.getPath(), ref.getStoreRef().getIdentifier());
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("checking store " + ref.getStoreRef().getIdentifier() +
if (logger.isDebugEnabled())
logger.debug("checking store " + ref.getStoreRef().getIdentifier() +
" for " + node.getPath() + " (" + path + ")");
}
try
{
final LayeringDescriptor ld = avmService.getLayeringInfo(-1, path);
if (!ld.isBackground())
{
LOGGER.debug(path + " is in the foreground. workflow active");
if (logger.isDebugEnabled())
logger.debug(path + " is in the foreground. workflow active");
result.add(task);
}
else
{
// LOGGER.debug(path + " is in the background");
}
}
catch (final AVMNotFoundException avmnfe)
{
LOGGER.debug(path + " not found");
if (logger.isDebugEnabled())
logger.debug(path + " not found");
}
}
return result;
}
public static List<WorkflowTask> getAssociatedTasksForNode(AVMNodeDescriptor node)
{
final List<WorkflowTask> tasks = AVMWorkflowUtil.getAssociatedTasksForSandbox(AVMUtil.getStoreName(node.getPath()));
return getAssociatedTasksForNode(node, tasks);
}
}

View File

@@ -201,7 +201,12 @@ public class RegenerateRenditionsWizard
@Override
public boolean getNextButtonDisabled()
{
return false;
boolean disabled = false;
if ("select_renditions".equals(Application.getWizardManager().getCurrentStepName()))
{
disabled = this.selectedWebProject == null;
}
return disabled;
}
@Override
@@ -413,7 +418,7 @@ public class RegenerateRenditionsWizard
final StoreRef storeRef = AVMNodeConverter.ToStoreRef(webProject.getStagingStore());
sp.addStore(storeRef);
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
StringBuilder query = new StringBuilder();
final StringBuilder query = new StringBuilder();
query.append("+ASPECT:\"" + WCMAppModel.ASPECT_FORM_INSTANCE_DATA + "\"");
query.append("-ASPECT:\"" + WCMAppModel.ASPECT_RENDITION + "\"");
query.append(" +@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_FORM_NAME) +
@@ -438,9 +443,9 @@ public class RegenerateRenditionsWizard
final StoreRef storeRef = AVMNodeConverter.ToStoreRef(webProject.getStagingStore());
sp.addStore(storeRef);
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
StringBuilder query = new StringBuilder();
final StringBuilder query = new StringBuilder();
query.append("+ASPECT:\"" + WCMAppModel.ASPECT_RENDITION + "\"");
query.append("+@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE) +
query.append(" +@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE) +
":\"" + ((RenderingEngineTemplateImpl)ret).getNodeRef() + "\"");
LOGGER.debug("running query " + query);

View File

@@ -957,9 +957,14 @@ public class SubmitDialog extends BaseDialogBean
Set<String> submittedPaths = new HashSet<String>(selected.size());
this.submitItems = new ArrayList<ItemWrapper>(selected.size());
this.warningItems = new ArrayList<ItemWrapper>(selected.size() >> 1);
List<WorkflowTask> tasks = null;
for (AVMNodeDescriptor node : selected)
{
if (AVMWorkflowUtil.getAssociatedTasksForNode(node).size() != 0)
if (tasks == null)
{
tasks = AVMWorkflowUtil.getAssociatedTasksForSandbox(AVMUtil.getStoreName(node.getPath()));
}
if (AVMWorkflowUtil.getAssociatedTasksForNode(node, tasks).size() != 0)
{
this.warningItems.add(new ItemWrapper(node));
continue;
@@ -977,7 +982,7 @@ public class SubmitDialog extends BaseDialogBean
}
// lookup if this item was created via a form - then lookup the workflow defaults
// for that form and store into the list of available workflows
else if (! this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
else if (!this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{
this.submitItems.add(new ItemWrapper(node));
submittedPaths.add(node.getPath());

View File

@@ -819,7 +819,7 @@ public class ManageTaskDialog extends BaseDialogBean
node.addPropertyResolver("url", this.browseBean.resolverUrl);
}
this.resources.add(node);
if (node.isDirectory())
if (node.isDirectory() && !node.getDescriptor().isDeleted())
{
for (final AVMNodeDescriptor d :
this.avmService.getDirectoryListingArray(node.getDescriptor(), true))

View File

@@ -202,6 +202,13 @@ public abstract class Sort
if (getter != null)
{
// if we have a bean getter method impl use that
try
{
getter.setAccessible(true);
}
catch (SecurityException se)
{
}
obj = getter.invoke(data.get(iIndex), (Object [])null);
}
else

View File

@@ -790,6 +790,24 @@ public abstract class AbstractItemSelector extends UIInput
* @return Node Service bean instance or throws exception if not found
*/
protected static NodeService getNodeService(FacesContext context)
{
NodeService service = Repository.getServiceRegistry(context).getNodeService();
if (service == null)
{
throw new IllegalStateException("Unable to obtain NodeService bean reference.");
}
return service;
}
/**
* Use Spring JSF integration to return the node Service bean instance
*
* @param context FacesContext
*
* @return Node Service bean instance or throws exception if not found
*/
protected static NodeService getFastNodeService(FacesContext context)
{
NodeService service = (NodeService)FacesContextUtils.getRequiredWebApplicationContext(
context).getBean("nodeService");

View File

@@ -91,7 +91,7 @@ public class UICategorySelector extends AbstractItemSelector
if (this.navigationId != null)
{
ChildAssociationRef parentRef = getNodeService(context).getPrimaryParent(
ChildAssociationRef parentRef = getFastNodeService(context).getPrimaryParent(
new NodeRef(Repository.getStoreRef(), this.navigationId));
Node parentNode = new Node(parentRef.getParentRef());

View File

@@ -70,7 +70,7 @@ public class UISpaceSelector extends AbstractItemSelector
{
try
{
ChildAssociationRef parentRef = getNodeService(context).getPrimaryParent(
ChildAssociationRef parentRef = getFastNodeService(context).getPrimaryParent(
new NodeRef(Repository.getStoreRef(), this.navigationId));
id = parentRef.getParentRef().getId();
}
@@ -89,7 +89,7 @@ public class UISpaceSelector extends AbstractItemSelector
List<ChildAssociationRef> allKids = getNodeService(context).getChildAssocs(nodeRef,
ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
DictionaryService dd = getDictionaryService(context);
NodeService service = getNodeService(context);
NodeService service = getFastNodeService(context);
// filter out those children that are not spaces
List<NodeRef> spaceKids = new ArrayList<NodeRef>();
@@ -126,7 +126,7 @@ public class UISpaceSelector extends AbstractItemSelector
public String getItemIcon(FacesContext context, NodeRef ref)
{
String icon = (String)getNodeService(context).getProperty(ref, ApplicationModel.PROP_ICON);
String icon = (String)getFastNodeService(context).getProperty(ref, ApplicationModel.PROP_ICON);
if (icon != null)
{
icon = "/images/icons/" + icon + "-16.gif";

View File

@@ -142,10 +142,10 @@ public class UIWebProjectFolderSelector extends AbstractItemSelector
public Collection<NodeRef> getRootChildren(FacesContext context)
{
// query for all nodes under the "Web Projects" foler in company home.
// query for all nodes under the "Web Projects" folder in company home.
FacesContext fc = FacesContext.getCurrentInstance();
String xpath = Application.getRootPath(fc) + "/" + Application.getWebsitesFolderName(fc) + "/*";
NodeRef rootNodeRef = getNodeService(fc).getRootNode(Repository.getStoreRef());
NodeRef rootNodeRef = getFastNodeService(fc).getRootNode(Repository.getStoreRef());
NamespaceService resolver = Repository.getServiceRegistry(fc).getNamespaceService();
SearchService searchService = Repository.getServiceRegistry(fc).getSearchService();
List<NodeRef> nodes = searchService.selectNodes(rootNodeRef, xpath, null, resolver, false);
@@ -179,7 +179,7 @@ public class UIWebProjectFolderSelector extends AbstractItemSelector
public String getItemIcon(FacesContext context, NodeRef ref)
{
String icon = (String)getNodeService(context).getProperty(ref, ApplicationModel.PROP_ICON);
String icon = (String)getFastNodeService(context).getProperty(ref, ApplicationModel.PROP_ICON);
if (icon != null)
{
icon = "/images/icons/" + icon + "-16.gif";

View File

@@ -409,11 +409,10 @@ public class UIUserSandboxes extends SelfRenderingComponent
out.write("&nbsp;&nbsp;");
// Submit All Items
// NOTE: removed for 2.0 final
/*Utils.encodeRecursive(context, aquireAction(
Utils.encodeRecursive(context, aquireAction(
context, mainStore, username, ACT_SANDBOX_SUBMITALL, "/images/icons/submit_all.gif",
"#{AVMBrowseBean.setupAllItemsAction}", "dialog:submitSandboxItems"));
out.write("&nbsp;&nbsp;");*/
out.write("&nbsp;&nbsp;");
// Revert All Items
Utils.encodeRecursive(context, aquireAction(