- removing filename attribute from rendering engine, wasn't working properly and redundant with name property

- misc ui fixes per usability meeting this morning
- using action node path in XFormsBean since current path isn't reliable in workflow context
- getting location column to work in manage task screen.  had to use actioncontext.id for wcm actions since path can be a Path object in workflow screens
- adding property resolvers to AVMNode for common props

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4731 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2007-01-04 19:16:41 +00:00
parent 315219c59b
commit 14b455eb62
13 changed files with 256 additions and 210 deletions

View File

@@ -89,7 +89,7 @@ public class AVMBrowseBean implements IContextListener
private static final String MSG_SUBMIT_SUCCESS = "submit_success";
private static final String MSG_SUBMITALL_SUCCESS = "submitall_success";
private static final String MSG_SUBMITSELECTED_SUCCESS = "submitselected_success";
/** Component id the status messages are tied too */
static final String COMPONENT_SANDBOXESPANEL = "sandboxes-panel";
@@ -629,15 +629,11 @@ public class AVMBrowseBean implements IContextListener
tx = Repository.getUserTransaction(context, true);
tx.begin();
String dns = AVMConstants.lookupStoreDNS(getSandbox());
int rootPathIndex = AVMConstants.buildSandboxRootPath(getSandbox()).length();
Map<String, AVMNodeDescriptor> nodes = this.avmService.getDirectoryListing(-1, getCurrentPath());
this.files = new ArrayList<Map>(nodes.size());
this.folders = new ArrayList<Map>(nodes.size());
ClientConfigElement config = Application.getClientConfig(context);
String wcmDomain = config.getWCMDomain();
String wcmPort = config.getWCMPort();
for (String name : nodes.keySet())
{
AVMNodeDescriptor avmRef = nodes.get(name);
@@ -661,9 +657,7 @@ public class AVMBrowseBean implements IContextListener
}
// common properties
String assetPath = path.substring(rootPathIndex);
String previewUrl = AVMConstants.buildAssetUrl(assetPath, wcmDomain, wcmPort, dns);
node.getProperties().put("previewUrl", previewUrl);
node.addPropertyResolver("previewUrl", AVMNode.RESOLVER_PREVIEW_URL);
}
// commit the transaction

View File

@@ -62,6 +62,7 @@ import org.w3c.dom.Document;
/**
* Bean backing the edit pages for a AVM node content.
*
* @author Ariel Backenroth
* @author Kevin Roast
*/
public class AVMEditBean

View File

@@ -19,13 +19,18 @@ package org.alfresco.web.bean.wcm;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import javax.faces.context.FacesContext;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.Path;
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.NodePropertyResolver;
import org.alfresco.web.config.ClientConfigElement;
/**
* Node class representing an AVM specific Node.
@@ -37,8 +42,57 @@ import org.alfresco.web.bean.repository.Node;
*/
public class AVMNode extends Node implements Map<String, Object>
{
public final static NodePropertyResolver RESOLVER_PREVIEW_URL =
new NodePropertyResolver()
{
public Object get(final Node node)
{
if (! (node instanceof AVMNode))
{
return null;
}
final ClientConfigElement config =
Application.getClientConfig(FacesContext.getCurrentInstance());
final String dns =
AVMConstants.lookupStoreDNS(AVMConstants.getStoreName(node.getPath()));
return AVMConstants.buildAssetUrl(AVMConstants.getSandboxRelativePath(node.getPath()),
config.getWCMDomain(),
config.getWCMPort(),
dns);
}
};
public final static NodePropertyResolver RESOLVER_SANDBOX_RELATIVE_PATH =
new NodePropertyResolver()
{
public Object get(final Node node)
{
if (! (node instanceof AVMNode))
{
return null;
}
String s = node.getPath();
s = AVMConstants.getSandboxRelativePath(s);
final Path result = new Path();
final String[] parts = s.split("/");
for (int i = 1; i < parts.length; i++)
{
if (parts[i].length() != 0)
{
final String s2 = parts[i];
result.append(new Path.Element()
{
public String getElementString() { return s2; }
});
}
}
return result;
}
};
private AVMNodeDescriptor avmRef;
private String path;
private int version;
private boolean deleted = false;
@@ -48,13 +102,12 @@ public class AVMNode extends Node implements Map<String, Object>
*
* @param avmRef The AVMNodeDescriptor that describes this node
*/
public AVMNode(AVMNodeDescriptor avmRef)
public AVMNode(final AVMNodeDescriptor avmRef)
{
super(AVMNodeConverter.ToNodeRef(-1, avmRef.getPath()));
this.avmRef = avmRef;
this.version = -1; // TODO: always -1 for now...
this.path = avmRef.getPath();
this.id = this.path;
this.id = avmRef.getPath();
}
/**
@@ -69,17 +122,19 @@ public class AVMNode extends Node implements Map<String, Object>
this.deleted = deleted;
}
public final String getPath()
@Override
public String getPath()
{
return this.path;
return this.avmRef.getPath();
}
public final int getVersion()
public int getVersion()
{
return this.version;
}
public final String getName()
@Override
public String getName()
{
return this.avmRef.getName();
}
@@ -97,13 +152,13 @@ public class AVMNode extends Node implements Map<String, Object>
/**
* @return All the properties known about this node.
*/
public final Map<String, Object> getProperties()
public Map<String, Object> getProperties()
{
if (this.propsRetrieved == false)
if (!this.propsRetrieved)
{
if (this.deleted == false)
if (!this.deleted)
{
Map<QName, PropertyValue> props = getServiceRegistry().getAVMService().getNodeProperties(this.version, this.path);
Map<QName, PropertyValue> props = getServiceRegistry().getAVMService().getNodeProperties(this.version, this.id);
for (QName qname: props.keySet())
{
PropertyValue propValue = props.get(qname);
@@ -111,8 +166,7 @@ public class AVMNode extends Node implements Map<String, Object>
}
}
this.properties.put("id", this.path);
this.properties.put("path", this.path);
this.properties.put("id", this.id);
this.properties.put("size", this.avmRef.getLength());
this.properties.put("name", this.avmRef.getName());
this.properties.put("created", this.avmRef.getCreateDate());

View File

@@ -86,7 +86,6 @@ public class CreateFormWizard
public class RenderingEngineTemplateData
implements Serializable
{
private final String fileName;
private final NodeRef nodeRef;
private final File file;
private final String name;
@@ -100,7 +99,6 @@ public class CreateFormWizard
{
this.file = null;
this.nodeRef = ((RenderingEngineTemplateImpl)ret).getNodeRef();
this.fileName = ret.getName();
this.name = ret.getName();
this.title = ret.getTitle();
this.description = ret.getDescription();
@@ -109,8 +107,7 @@ public class CreateFormWizard
this.renderingEngine = ret.getRenderingEngine();
}
public RenderingEngineTemplateData(final String fileName,
final File file,
public RenderingEngineTemplateData(final File file,
final String name,
final String title,
final String description,
@@ -119,7 +116,6 @@ public class CreateFormWizard
final RenderingEngine renderingEngine)
{
this.nodeRef = null;
this.fileName = fileName;
this.file = file;
this.name = name;
this.title = title;
@@ -139,11 +135,6 @@ public class CreateFormWizard
return this.mimetypeForRendition;
}
public String getFileName()
{
return this.fileName;
}
public File getFile()
{
return this.file;
@@ -177,7 +168,7 @@ public class CreateFormWizard
public String toString()
{
return (this.getClass().getName() + "{" +
"fileName: " + this.getFileName() + "," +
"name: " + this.getName() + "," +
"mimetypeForRendition: " + this.getMimetypeForRendition() + "," +
"outputPathPatternForRendition: " + this.getOutputPathPatternForRendition() + "," +
"renderingEngine: " + this.getRenderingEngine().getName() +
@@ -529,8 +520,7 @@ public class CreateFormWizard
}
}
final RenderingEngineTemplateData data =
this.new RenderingEngineTemplateData(this.getRenderingEngineTemplateFileName(),
this.getRenderingEngineTemplateFile(),
this.new RenderingEngineTemplateData(this.getRenderingEngineTemplateFile(),
this.getRenderingEngineTemplateName(),
this.getRenderingEngineTemplateTitle(),
this.getRenderingEngineTemplateDescription(),
@@ -726,35 +716,6 @@ public class CreateFormWizard
return this.mimetypeChoices;
}
private FileUploadBean getFileUploadBean(final String id)
{
final FacesContext ctx = FacesContext.getCurrentInstance();
final Map sessionMap = ctx.getExternalContext().getSessionMap();
return (FileUploadBean)sessionMap.get(FileUploadBean.getKey(id));
}
/**
* @return Returns the name of the file
*/
private String getFileName(final String id)
{
// try and retrieve the file and filename from the file upload bean
// representing the file we previously uploaded.
final FileUploadBean fileBean = this.getFileUploadBean(id);
return fileBean == null ? null : fileBean.getFileName();
}
/**
* @return Returns the schema file or <tt>null</tt>
*/
private File getFile(final String id)
{
// try and retrieve the file and filename from the file upload bean
// representing the file we previously uploaded.
final FileUploadBean fileBean = this.getFileUploadBean(id);
return fileBean != null ? fileBean.getFile() : null;
}
/**
* @return Returns the schema file or <tt>null</tt>
@@ -927,7 +888,7 @@ public class CreateFormWizard
public String getRenderingEngineTemplateName()
{
return (this.renderingEngineTemplateName == null && this.getRenderingEngineTemplateFileName() != null
? FilenameUtils.removeExtension(this.getRenderingEngineTemplateFileName())
? this.getRenderingEngineTemplateFileName()
: this.renderingEngineTemplateName);
}
/**
@@ -1056,13 +1017,42 @@ public class CreateFormWizard
protected void clearUpload(final String id)
{
// remove the file upload bean from the session
FacesContext ctx = FacesContext.getCurrentInstance();
FileUploadBean fileBean =
(FileUploadBean)ctx.getExternalContext().getSessionMap().get(FileUploadBean.getKey(id));
final FacesContext ctx = FacesContext.getCurrentInstance();
FileUploadBean fileBean = (FileUploadBean)
ctx.getExternalContext().getSessionMap().get(FileUploadBean.getKey(id));
if (fileBean != null)
{
fileBean.setFile(null);
fileBean.setFileName(null);
}
}
private FileUploadBean getFileUploadBean(final String id)
{
final FacesContext ctx = FacesContext.getCurrentInstance();
final Map sessionMap = ctx.getExternalContext().getSessionMap();
return (FileUploadBean)sessionMap.get(FileUploadBean.getKey(id));
}
/**
* @return Returns the name of the file
*/
private String getFileName(final String id)
{
// try and retrieve the file and filename from the file upload bean
// representing the file we previously uploaded.
final FileUploadBean fileBean = this.getFileUploadBean(id);
return fileBean == null ? null : fileBean.getFileName();
}
/**
* @return Returns the schema file or <tt>null</tt>
*/
private File getFile(final String id)
{
// try and retrieve the file and filename from the file upload bean
// representing the file we previously uploaded.
final FileUploadBean fileBean = this.getFileUploadBean(id);
return fileBean != null ? fileBean.getFile() : null;
}
}

View File

@@ -34,9 +34,7 @@ import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.NodePropertyResolver;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.TransientNode;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMNode;
import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;
@@ -126,7 +124,14 @@ public class ManageTaskDialog extends BaseDialogBean
{
LOGGER.debug("Task: " + this.task);
LOGGER.debug("Trasient node: " + this.taskNode);
LOGGER.debug("Workflow package: " + this.workflowPackage );
Boolean isSystemPackage = (Boolean)
this.nodeService.getProperty(this.workflowPackage,
WorkflowModel.PROP_IS_SYSTEM_PACKAGE);
LOGGER.debug("Workflow package: " + this.workflowPackage +
" system package: " + isSystemPackage);
boolean isWCMWorkflow =
this.task.properties.get(AVMWorkflowUtil.PROP_FROM_PATH) != null;
LOGGER.debug("is wcm workflow: " + isWCMWorkflow);
}
}
}
@@ -537,8 +542,7 @@ public class ManageTaskDialog extends BaseDialogBean
tx = Repository.getUserTransaction(context, true);
tx.begin();
if ((Boolean)this.nodeService.getProperty(this.workflowPackage,
WorkflowModel.PROP_IS_SYSTEM_PACKAGE))
if (this.task.properties.get(AVMWorkflowUtil.PROP_FROM_PATH) != null)
{
final NodeRef stagingNodeRef = (NodeRef)
this.nodeService.getProperty(this.workflowPackage,
@@ -689,39 +693,9 @@ public class ManageTaskDialog extends BaseDialogBean
{
LOGGER.debug("adding node " + node);
node.getProperties().put("taskId", this.task.id);
final ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
final String dns = AVMConstants.lookupStoreDNS(AVMConstants.getStoreName(node.getPath()));
node.getProperties().put("previewUrl",
AVMConstants.buildAssetUrl(AVMConstants.getSandboxRelativePath(node.getPath()),
config.getWCMDomain(),
config.getWCMPort(),
dns));
this.browseBean.setupCommonBindingProperties(node);
final String packagePath = AVMNodeConverter.ToAVMVersionPath(this.workflowPackage).getSecond();
NodePropertyResolver resolverPath = new NodePropertyResolver()
{
public Object get(Node node)
{
Path result = new Path();
String s = node.getPath();
s = s.substring(packagePath.length());
for (final String s2 : s.split("/"))
{
if (s2.length() != 0)
{
result.append(new Path.Element()
{
public String getElementString() { return s2; }
});
}
}
return result;
}
};
// node.remove("path");
// node.addPropertyResolver("path", resolverPath);
// node.addPropertyResolver("displayPath", resolverPath);
node.addPropertyResolver("path", AVMNode.RESOLVER_SANDBOX_RELATIVE_PATH);
node.addPropertyResolver("previewUrl", AVMNode.RESOLVER_PREVIEW_URL);
this.resources.add(node);
}

View File

@@ -42,6 +42,7 @@ import org.alfresco.web.bean.FileUploadBean;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMBrowseBean;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMNode;
import org.alfresco.web.forms.*;
import org.alfresco.web.ui.common.Utils;
@@ -426,12 +427,12 @@ public class XFormsBean
String currentPath = (String)requestParameters.get("currentPath");
if (currentPath == null)
{
currentPath = this.avmBrowseBean.getCurrentPath();
currentPath = this.getCurrentAVMPath();
}
else
{
final String previewStorePath =
AVMConstants.getCorrespondingPathInPreviewStore(this.avmBrowseBean.getCurrentPath());
AVMConstants.getCorrespondingPathInPreviewStore(this.getCurrentAVMPath());
currentPath = AVMConstants.buildPath(previewStorePath,
currentPath,
AVMConstants.PathRelation.WEBAPP_RELATIVE);
@@ -449,7 +450,7 @@ public class XFormsBean
final Element errorElement = result.createElement("error");
errorElement.appendChild(result.createTextNode("Path " + currentPath + " not found"));
filePickerDataElement.appendChild(errorElement);
currentPath = this.avmBrowseBean.getCurrentPath();
currentPath = this.getCurrentAVMPath();
}
else if (! currentNode.isDirectory())
{
@@ -515,7 +516,7 @@ public class XFormsBean
else if (item.isFormField() && item.getFieldName().equals("currentPath"))
{
final String previewStorePath =
AVMConstants.getCorrespondingPathInPreviewStore(this.avmBrowseBean.getCurrentPath());
AVMConstants.getCorrespondingPathInPreviewStore(this.getCurrentAVMPath());
currentPath = AVMConstants.buildPath(previewStorePath,
item.getString(),
AVMConstants.PathRelation.WEBAPP_RELATIVE);
@@ -709,7 +710,7 @@ public class XFormsBean
private Document getXFormsDocument()
throws FormBuilderException
{
final String cwdAVMPath = this.avmBrowseBean.getCurrentPath();
final String cwdAVMPath = this.getCurrentAVMPath();
if (LOGGER.isDebugEnabled())
{
@@ -748,4 +749,11 @@ public class XFormsBean
throw new FormBuilderException(saxe);
}
}
private String getCurrentAVMPath()
{
final AVMNode node = this.avmBrowseBean.getAvmActionNode();
final String result = node.getPath();
return node.isDirectory() ? result : AVMNodeConverter.SplitBase(result)[0];
}
}