mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Edit Properties dialog for an AVM File
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3976 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -42,7 +42,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
||||
super.init(parameters);
|
||||
|
||||
// setup the editable node
|
||||
this.editableNode = new Node(this.browseBean.getDocument().getNodeRef());
|
||||
this.editableNode = initEditableNode();
|
||||
|
||||
// special case for Mimetype - since this is a sub-property of the ContentData object
|
||||
// we must extract it so it can be edited in the client, then we check for it later
|
||||
@@ -54,11 +54,16 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
||||
}
|
||||
}
|
||||
|
||||
protected Node initEditableNode()
|
||||
{
|
||||
return new Node(this.browseBean.getDocument().getNodeRef());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome)
|
||||
throws Exception
|
||||
{
|
||||
NodeRef nodeRef = this.browseBean.getDocument().getNodeRef();
|
||||
NodeRef nodeRef = this.editableNode.getNodeRef();
|
||||
Map<String, Object> editedProps = this.editableNode.getProperties();
|
||||
|
||||
// get the name and move the node as necessary
|
||||
@@ -233,6 +238,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean getters and setters
|
||||
|
||||
|
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.cmr.model.FileExistsException;
|
||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.content.EditContentPropertiesDialog;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
/**
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class EditFilePropertiesDialog extends EditContentPropertiesDialog
|
||||
{
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean property getters and setters
|
||||
|
||||
/**
|
||||
* @param avmBrowseBean The AVMBrowseBean to set.
|
||||
*/
|
||||
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
|
||||
{
|
||||
this.avmBrowseBean = avmBrowseBean;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.content.EditContentPropertiesDialog#initEditableNode()
|
||||
*/
|
||||
@Override
|
||||
protected Node initEditableNode()
|
||||
{
|
||||
return new Node(this.avmBrowseBean.getAvmNode().getNodeRef());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
||||
{
|
||||
return outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the error message to display if an error occurs during finish processing
|
||||
*
|
||||
* @param The exception
|
||||
* @return The formatted message
|
||||
*/
|
||||
@Override
|
||||
protected String formatErrorMessage(Throwable exception)
|
||||
{
|
||||
if (exception instanceof FileExistsException)
|
||||
{
|
||||
return MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), Repository.ERROR_EXISTS),
|
||||
((FileExistsException)exception).getName());
|
||||
}
|
||||
else if (exception instanceof InvalidNodeRefException)
|
||||
{
|
||||
return MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF),
|
||||
new Object[] {this.avmBrowseBean.getAvmNode().getPath()});
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.formatErrorMessage(exception);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user