Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)

125605 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2)
      125498 slanglois: MNT-16155 Update source headers - remove svn:eol-style property on Java and JSP source files


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Raluca Munteanu
2016-04-26 13:03:25 +00:00
parent d6f9f50c39
commit dead3c3825
265 changed files with 44099 additions and 44099 deletions

View File

@@ -1,175 +1,175 @@
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.web.scripts.FileTypeImageUtils;
import org.alfresco.repo.workflow.WorkflowModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.workflow.WorkflowTask;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.ui.common.ReportedException;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class CCCheckoutFileDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = 1137163500648349730L;
public static final String LBL_SAVE = "save";
public static final String LBL_CHECKOUT = "check_out";
private final static String MSG_LEFT_QUOTE = "left_qoute";
private final static String MSG_RIGHT_QUOTE = "right_quote";
private static Log logger = LogFactory.getLog(CCCheckoutFileDialog.class);
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return checkoutFile(context, outcome);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_CHECKOUT);
}
@Override
public String getContainerTitle()
{
final Node document = property.getDocument();
if (document != null){
FacesContext fc = FacesContext.getCurrentInstance();
return Application.getMessage(fc, LBL_CHECKOUT) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
+ document.getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
}
return null;
}
/**
* Action called upon completion of the Check Out file page
*/
public String checkoutFile(FacesContext context, String outcome)
{
boolean checkoutSuccessful = false;
final Node node = property.getDocument();
if (node != null)
{
try
{
if (logger.isDebugEnabled())
logger.debug("Trying to checkout content node Id: " + node.getId());
// checkout the node content to create a working copy
if (logger.isDebugEnabled())
{
logger.debug("Checkout copy location: " + property.getCopyLocation());
logger.debug("Selected Space Id: " + property.getSelectedSpaceId());
}
NodeRef workingCopyRef = null;
if (property.getCopyLocation().equals(CCProperties.COPYLOCATION_OTHER) && property.getSelectedSpaceId() != null)
{
// checkout to a arbituary parent Space
NodeRef destRef = property.getSelectedSpaceId();
ChildAssociationRef childAssocRef = getNodeService().getPrimaryParent(destRef);
workingCopyRef = property.getVersionOperationsService().checkout(node.getNodeRef(), destRef, ContentModel.ASSOC_CONTAINS, childAssocRef.getQName());
}
else
{
// checkout the content to the current space
workingCopyRef = property.getVersionOperationsService().checkout(node.getNodeRef());
// if this is a workflow action and there is a task id
// present we need
// to also link the working copy to the workflow package so
// it appears
// in the resources panel in the manage task dialog
if (property.isWorkflowAction() && property.getWorkflowTaskId() != null && (property.getWorkflowTaskId().equals("null") == false))
{
WorkflowTask task = property.getWorkflowService().getTaskById(property.getWorkflowTaskId());
if (task != null)
{
NodeRef workflowPackage = (NodeRef) task.properties.get(WorkflowModel.ASSOC_PACKAGE);
if (workflowPackage != null)
{
getNodeService().addChild(workflowPackage, workingCopyRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName
.createValidLocalName((String) getNodeService().getProperty(workingCopyRef, ContentModel.PROP_NAME))));
if (logger.isDebugEnabled())
logger.debug("Added working copy to workflow package: " + workflowPackage);
}
}
}
}
// set the working copy Node instance
Node workingCopy = new Node(workingCopyRef);
property.setWorkingDocument(workingCopy);
// create content URL to the content download servlet with ID
// and expected filename
// the myfile part will be ignored by the servlet but gives the
// browser a hint
String url = DownloadContentServlet.generateDownloadURL(workingCopyRef, workingCopy.getName());
workingCopy.getProperties().put("url", url);
workingCopy.getProperties().put("fileType32", FileTypeImageUtils.getFileTypeImage(workingCopy.getName(), false));
// mark as successful
checkoutSuccessful = true;
}
catch (Throwable err)
{
Utils.addErrorMessage(Application.getMessage(context, MSG_ERROR_CHECKOUT) + err.getMessage(), err);
ReportedException.throwIfNecessary(err);
}
}
else
{
logger.warn("WARNING: checkoutFile called without a current Document!");
}
// determine which page to show next if the checkout was successful.
if (checkoutSuccessful)
{
// If a check-in rule is present in the space
// the document was checked out to the working copy would have
// already disappeared!
if (getNodeService().exists(property.getWorkingDocument().getNodeRef()))
{
// go to the page that allows the user to download the content
// for editing
outcome = "dialog:checkoutFileLink"; // "checkoutFileLink";
// //checkout-file-link.jsp
// currentAction = Action.CHECKOUT_FILE_LINK;
}
else
{
// show a page telling the user that the content has already
// been checked in
outcome = "dialog:workingCopyMissing";// "workingCopyMissing";
// //
// working-copy-missing.jsp
// currentAction = Action.WORKING_COPY_MISSING;
}
}
return outcome;
}
}
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.web.scripts.FileTypeImageUtils;
import org.alfresco.repo.workflow.WorkflowModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.workflow.WorkflowTask;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.ui.common.ReportedException;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class CCCheckoutFileDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = 1137163500648349730L;
public static final String LBL_SAVE = "save";
public static final String LBL_CHECKOUT = "check_out";
private final static String MSG_LEFT_QUOTE = "left_qoute";
private final static String MSG_RIGHT_QUOTE = "right_quote";
private static Log logger = LogFactory.getLog(CCCheckoutFileDialog.class);
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return checkoutFile(context, outcome);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_CHECKOUT);
}
@Override
public String getContainerTitle()
{
final Node document = property.getDocument();
if (document != null){
FacesContext fc = FacesContext.getCurrentInstance();
return Application.getMessage(fc, LBL_CHECKOUT) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
+ document.getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
}
return null;
}
/**
* Action called upon completion of the Check Out file page
*/
public String checkoutFile(FacesContext context, String outcome)
{
boolean checkoutSuccessful = false;
final Node node = property.getDocument();
if (node != null)
{
try
{
if (logger.isDebugEnabled())
logger.debug("Trying to checkout content node Id: " + node.getId());
// checkout the node content to create a working copy
if (logger.isDebugEnabled())
{
logger.debug("Checkout copy location: " + property.getCopyLocation());
logger.debug("Selected Space Id: " + property.getSelectedSpaceId());
}
NodeRef workingCopyRef = null;
if (property.getCopyLocation().equals(CCProperties.COPYLOCATION_OTHER) && property.getSelectedSpaceId() != null)
{
// checkout to a arbituary parent Space
NodeRef destRef = property.getSelectedSpaceId();
ChildAssociationRef childAssocRef = getNodeService().getPrimaryParent(destRef);
workingCopyRef = property.getVersionOperationsService().checkout(node.getNodeRef(), destRef, ContentModel.ASSOC_CONTAINS, childAssocRef.getQName());
}
else
{
// checkout the content to the current space
workingCopyRef = property.getVersionOperationsService().checkout(node.getNodeRef());
// if this is a workflow action and there is a task id
// present we need
// to also link the working copy to the workflow package so
// it appears
// in the resources panel in the manage task dialog
if (property.isWorkflowAction() && property.getWorkflowTaskId() != null && (property.getWorkflowTaskId().equals("null") == false))
{
WorkflowTask task = property.getWorkflowService().getTaskById(property.getWorkflowTaskId());
if (task != null)
{
NodeRef workflowPackage = (NodeRef) task.properties.get(WorkflowModel.ASSOC_PACKAGE);
if (workflowPackage != null)
{
getNodeService().addChild(workflowPackage, workingCopyRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName
.createValidLocalName((String) getNodeService().getProperty(workingCopyRef, ContentModel.PROP_NAME))));
if (logger.isDebugEnabled())
logger.debug("Added working copy to workflow package: " + workflowPackage);
}
}
}
}
// set the working copy Node instance
Node workingCopy = new Node(workingCopyRef);
property.setWorkingDocument(workingCopy);
// create content URL to the content download servlet with ID
// and expected filename
// the myfile part will be ignored by the servlet but gives the
// browser a hint
String url = DownloadContentServlet.generateDownloadURL(workingCopyRef, workingCopy.getName());
workingCopy.getProperties().put("url", url);
workingCopy.getProperties().put("fileType32", FileTypeImageUtils.getFileTypeImage(workingCopy.getName(), false));
// mark as successful
checkoutSuccessful = true;
}
catch (Throwable err)
{
Utils.addErrorMessage(Application.getMessage(context, MSG_ERROR_CHECKOUT) + err.getMessage(), err);
ReportedException.throwIfNecessary(err);
}
}
else
{
logger.warn("WARNING: checkoutFile called without a current Document!");
}
// determine which page to show next if the checkout was successful.
if (checkoutSuccessful)
{
// If a check-in rule is present in the space
// the document was checked out to the working copy would have
// already disappeared!
if (getNodeService().exists(property.getWorkingDocument().getNodeRef()))
{
// go to the page that allows the user to download the content
// for editing
outcome = "dialog:checkoutFileLink"; // "checkoutFileLink";
// //checkout-file-link.jsp
// currentAction = Action.CHECKOUT_FILE_LINK;
}
else
{
// show a page telling the user that the content has already
// been checked in
outcome = "dialog:workingCopyMissing";// "workingCopyMissing";
// //
// working-copy-missing.jsp
// currentAction = Action.WORKING_COPY_MISSING;
}
}
return outcome;
}
}

View File

@@ -1,90 +1,90 @@
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class CCCheckoutFileLinkDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = -4732775752517417543L;
public static final String MSG_CHECKOUT_OF = "check_out_of";
public static final String LBL_UNDO_CHECKOUT = "undo_checkout";
private final static String MSG_LEFT_QUOTE = "left_qoute";
private final static String MSG_RIGHT_QUOTE = "right_quote";
private static Log logger = LogFactory.getLog(CCCheckoutFileLinkDialog.class);
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return checkoutFileOK(context, outcome);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
return Application.getMessage(fc, MSG_CHECKOUT_OF) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
+ property.getDocument().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_UNDO_CHECKOUT);
}
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "ok");
}
@Override
public String cancel()
{
undoCheckout();
resetState();
super.cancel();
return "browse";
}
/**
* Action called upon completion of the Check Out file Link download page
*/
public String checkoutFileOK(FacesContext context, String outcome)
{
Node node = property.getWorkingDocument();
if (node != null)
{
// reset the underlying node
if (this.browseBean.getDocument() != null)
{
this.browseBean.getDocument().reset();
}
// clean up and clear action context
resetState();
property.setDocument(null);
property.setWorkingDocument(null);
// currentAction = Action.NONE;
outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + ":browse";
}
else
{
logger.warn("WARNING: checkoutFileOK called without a current WorkingDocument!");
}
return outcome;
}
}
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class CCCheckoutFileLinkDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = -4732775752517417543L;
public static final String MSG_CHECKOUT_OF = "check_out_of";
public static final String LBL_UNDO_CHECKOUT = "undo_checkout";
private final static String MSG_LEFT_QUOTE = "left_qoute";
private final static String MSG_RIGHT_QUOTE = "right_quote";
private static Log logger = LogFactory.getLog(CCCheckoutFileLinkDialog.class);
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return checkoutFileOK(context, outcome);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
return Application.getMessage(fc, MSG_CHECKOUT_OF) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
+ property.getDocument().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_UNDO_CHECKOUT);
}
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "ok");
}
@Override
public String cancel()
{
undoCheckout();
resetState();
super.cancel();
return "browse";
}
/**
* Action called upon completion of the Check Out file Link download page
*/
public String checkoutFileOK(FacesContext context, String outcome)
{
Node node = property.getWorkingDocument();
if (node != null)
{
// reset the underlying node
if (this.browseBean.getDocument() != null)
{
this.browseBean.getDocument().reset();
}
// clean up and clear action context
resetState();
property.setDocument(null);
property.setWorkingDocument(null);
// currentAction = Action.NONE;
outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + ":browse";
}
else
{
logger.warn("WARNING: checkoutFileOK called without a current WorkingDocument!");
}
return outcome;
}
}

View File

@@ -1,44 +1,44 @@
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.Application;
public class CCEditFileDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = -1145049277343144264L;
private final static String MSG_LEFT_QUOTE = "left_qoute";
private final static String MSG_RIGHT_QUOTE = "right_quote";
public static final String LBL_CLOSE = "close";
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return super.cancel();
}
@Override
public String cancel()
{
property.setDocument(null);
property.setWorkingDocument(null);
resetState();
return super.cancel();
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_CLOSE);
}
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
return Application.getMessage(fc, MSG_LEFT_QUOTE) + property.getDocument().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
}
}
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.Application;
public class CCEditFileDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = -1145049277343144264L;
private final static String MSG_LEFT_QUOTE = "left_qoute";
private final static String MSG_RIGHT_QUOTE = "right_quote";
public static final String LBL_CLOSE = "close";
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return super.cancel();
}
@Override
public String cancel()
{
property.setDocument(null);
property.setWorkingDocument(null);
resetState();
return super.cancel();
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_CLOSE);
}
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
return Application.getMessage(fc, MSG_LEFT_QUOTE) + property.getDocument().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
}
}

View File

@@ -1,39 +1,39 @@
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.Application;
public class CCEditHtmlInlineDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = 5971155828037579931L;
public static final String LBL_SAVE = "save";
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return editInline(context, outcome);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_SAVE);
}
@Override
public String getContainerTitle()
{
return property.getDocument().getName();
}
}
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.Application;
public class CCEditHtmlInlineDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = 5971155828037579931L;
public static final String LBL_SAVE = "save";
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return editInline(context, outcome);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_SAVE);
}
@Override
public String getContainerTitle()
{
return property.getDocument().getName();
}
}

View File

@@ -1,39 +1,39 @@
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.Application;
public class CCEditTextInlineDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = 4657371875928010937L;
public static final String LBL_SAVE = "save";
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return editInline(context, outcome);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_SAVE);
}
@Override
public String getContainerTitle()
{
return property.getDocument().getName();
}
}
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.Application;
public class CCEditTextInlineDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = 4657371875928010937L;
public static final String LBL_SAVE = "save";
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return editInline(context, outcome);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_SAVE);
}
@Override
public String getContainerTitle()
{
return property.getDocument().getName();
}
}

View File

@@ -1,406 +1,406 @@
package org.alfresco.web.bean.coci;
import java.io.File;
import java.io.Serializable;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.version.VersionService;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
public class CCProperties implements Serializable
{
private static final long serialVersionUID = -79530354521757202L;
/** The VersionOperationsService to be used by the bean */
transient protected CheckOutCheckInService versionOperationsService;
/** The VersionQueryService to be used by the bean */
transient protected VersionService versionQueryService;
/** The ContentService to be used by the bean */
transient protected ContentService contentService;
/** The WorkflowService to be used by the bean */
transient protected WorkflowService workflowService;
/** Content of the document returned from in-line editing */
private String editorOutput;
/** Content of the document used for HTML in-line editing */
private String documentContent;
/** The working copy of the document we are checking out */
private Node workingDocument;
/** The current document */
private Node document;
/** transient form and upload properties */
private File file;
private String fileName;
private String webdavUrl;
private String cifsPath;
private boolean keepCheckedOut = false;
private boolean minorChange = true;
private boolean isWorkflowAction = false;
private String workflowTaskId;
private NodeRef selectedSpaceId = null;
/** constants for copy location selection */
public static final String COPYLOCATION_CURRENT = "current";
public static final String COPYLOCATION_OTHER = "other";
private String versionNotes = "";
private String copyLocation = COPYLOCATION_CURRENT;
/**
* @return Returns the VersionOperationsService.
*/
public CheckOutCheckInService getVersionOperationsService()
{
//check for null in cluster environment
if (versionOperationsService == null)
{
versionOperationsService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getCheckOutCheckInService();
}
return versionOperationsService;
}
/**
* @param versionOperationsService
* The VersionOperationsService to set.
*/
public void setVersionOperationsService(CheckOutCheckInService versionOperationsService)
{
this.versionOperationsService = versionOperationsService;
}
/**
* @return Returns the VersionQueryService.
*/
public VersionService getVersionQueryService()
{
if (this.versionQueryService == null)
{
this.versionQueryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVersionService();
}
return this.versionQueryService;
}
/**
* @param versionQueryService
* The VersionQueryService to set.
*/
public void setVersionQueryService(VersionService versionQueryService)
{
this.versionQueryService = versionQueryService;
}
/**
* @return Returns the ContentService.
*/
public ContentService getContentService()
{
//check for null in cluster environment
if (contentService == null)
{
contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService();
}
return contentService;
}
/**
* @param contentService
* The ContentService to set.
*/
public void setContentService(ContentService contentService)
{
this.contentService = contentService;
}
/**
* @param workflowService
* The WorkflowService to set.
*/
public void setWorkflowService(WorkflowService workflowService)
{
this.workflowService = workflowService;
}
/**
* @return the workflowService
*/
public WorkflowService getWorkflowService()
{
//check for null for cluster environment
if (workflowService == null)
{
workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService();
}
return workflowService;
}
/**
* @return Returns output from the in-line editor page.
*/
public String getEditorOutput()
{
return this.editorOutput;
}
/**
* @param editorOutput
* The output from the in-line editor page
*/
public void setEditorOutput(String editorOutput)
{
this.editorOutput = editorOutput;
}
/**
* @return Returns the document content used for HTML in-line editing.
*/
public String getDocumentContent()
{
return this.documentContent;
}
/**
* @param documentContent
* The document content for HTML in-line editing.
*/
public void setDocumentContent(String documentContent)
{
this.documentContent = documentContent;
}
/**
* @return Returns the working copy Document.
*/
public Node getWorkingDocument()
{
return this.workingDocument;
}
/**
* @param workingDocument
* The working copy Document to set.
*/
public void setWorkingDocument(Node workingDocument)
{
this.workingDocument = workingDocument;
}
/**
* @return The document node being used for the current operation
*/
public Node getDocument()
{
return this.document;
}
/**
* @param document
* The document node to be used for the current operation
*/
public void setDocument(Node document)
{
this.document = document;
}
/**
* @return Returns the selected Space Id.
*/
public NodeRef getSelectedSpaceId()
{
return this.selectedSpaceId;
}
/**
* @param selectedSpaceId
* The selected Space Id to set.
*/
public void setSelectedSpaceId(NodeRef selectedSpaceId)
{
this.selectedSpaceId = selectedSpaceId;
}
/**
* @return the file
*/
public File getFile()
{
return file;
}
/**
* @param file the file to set
*/
public void setFile(File file)
{
this.file = file;
}
/**
* @return the fileName
*/
public String getFileName()
{
return fileName;
}
/**
* @param fileName the fileName to set
*/
public void setFileName(String fileName)
{
this.fileName = fileName;
}
/**
* @param keepCheckedOut
* The keepCheckedOut to set.
*/
public void setKeepCheckedOut(boolean keepCheckedOut)
{
this.keepCheckedOut = keepCheckedOut;
}
/**
* @return Returns the keepCheckedOut.
*/
public boolean getKeepCheckedOut()
{
return this.keepCheckedOut;
}
/**
* @param minorChange
* The minorChange to set.
*/
public void setMinorChange(boolean minorChange)
{
this.minorChange = minorChange;
}
/**
* @return Returns the minorChange flag.
*/
public boolean getMinorChange()
{
return this.minorChange;
}
/**
* @return the isWorkflowAction
*/
public boolean isWorkflowAction()
{
return isWorkflowAction;
}
/**
* @param isWorkflowAction the isWorkflowAction to set
*/
public void setWorkflowAction(boolean isWorkflowAction)
{
this.isWorkflowAction = isWorkflowAction;
}
/**
* @return the workflowTaskId
*/
public String getWorkflowTaskId()
{
return workflowTaskId;
}
/**
* @param workflowTaskId the workflowTaskId to set
*/
public void setWorkflowTaskId(String workflowTaskId)
{
this.workflowTaskId = workflowTaskId;
}
/**
* @return Returns the version history notes.
*/
public String getVersionNotes()
{
return this.versionNotes;
}
/**
* @param versionNotes
* The version history notes to set.
*/
public void setVersionNotes(String versionNotes)
{
this.versionNotes = versionNotes;
}
/**
* @return Returns the copy location. Either the current or other space.
*/
public String getCopyLocation()
{
if (this.getFileName() == null || this.getFileName().length() == 0)
{
return this.copyLocation;
}
else
{
return CCProperties.COPYLOCATION_OTHER;
}
}
/**
* @param copyLocation
* The copy location. Either the current or other space.
*/
public void setCopyLocation(String copyLocation)
{
this.copyLocation = copyLocation;
}
/**
* @return Returns WebDav url for online editing. If webdav online editing didn't yet started, returns null
*/
public String getWebdavUrl()
{
return webdavUrl;
}
/**
* @param webdavUrl The webdav url. Using only for online editing
*/
public void setWebdavUrl(String webdavUrl)
{
this.webdavUrl = webdavUrl;
}
/**
* @return Returns CIFS path for online editing. If cifs online editing didn't yet started, returns null
*/
public String getCifsPath()
{
return cifsPath;
}
/**
* @param cifsPath The cifs path. Using only for online editing
*/
public void setCifsPath(String cifsPath)
{
this.cifsPath = cifsPath;
}
}
package org.alfresco.web.bean.coci;
import java.io.File;
import java.io.Serializable;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.version.VersionService;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
public class CCProperties implements Serializable
{
private static final long serialVersionUID = -79530354521757202L;
/** The VersionOperationsService to be used by the bean */
transient protected CheckOutCheckInService versionOperationsService;
/** The VersionQueryService to be used by the bean */
transient protected VersionService versionQueryService;
/** The ContentService to be used by the bean */
transient protected ContentService contentService;
/** The WorkflowService to be used by the bean */
transient protected WorkflowService workflowService;
/** Content of the document returned from in-line editing */
private String editorOutput;
/** Content of the document used for HTML in-line editing */
private String documentContent;
/** The working copy of the document we are checking out */
private Node workingDocument;
/** The current document */
private Node document;
/** transient form and upload properties */
private File file;
private String fileName;
private String webdavUrl;
private String cifsPath;
private boolean keepCheckedOut = false;
private boolean minorChange = true;
private boolean isWorkflowAction = false;
private String workflowTaskId;
private NodeRef selectedSpaceId = null;
/** constants for copy location selection */
public static final String COPYLOCATION_CURRENT = "current";
public static final String COPYLOCATION_OTHER = "other";
private String versionNotes = "";
private String copyLocation = COPYLOCATION_CURRENT;
/**
* @return Returns the VersionOperationsService.
*/
public CheckOutCheckInService getVersionOperationsService()
{
//check for null in cluster environment
if (versionOperationsService == null)
{
versionOperationsService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getCheckOutCheckInService();
}
return versionOperationsService;
}
/**
* @param versionOperationsService
* The VersionOperationsService to set.
*/
public void setVersionOperationsService(CheckOutCheckInService versionOperationsService)
{
this.versionOperationsService = versionOperationsService;
}
/**
* @return Returns the VersionQueryService.
*/
public VersionService getVersionQueryService()
{
if (this.versionQueryService == null)
{
this.versionQueryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVersionService();
}
return this.versionQueryService;
}
/**
* @param versionQueryService
* The VersionQueryService to set.
*/
public void setVersionQueryService(VersionService versionQueryService)
{
this.versionQueryService = versionQueryService;
}
/**
* @return Returns the ContentService.
*/
public ContentService getContentService()
{
//check for null in cluster environment
if (contentService == null)
{
contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService();
}
return contentService;
}
/**
* @param contentService
* The ContentService to set.
*/
public void setContentService(ContentService contentService)
{
this.contentService = contentService;
}
/**
* @param workflowService
* The WorkflowService to set.
*/
public void setWorkflowService(WorkflowService workflowService)
{
this.workflowService = workflowService;
}
/**
* @return the workflowService
*/
public WorkflowService getWorkflowService()
{
//check for null for cluster environment
if (workflowService == null)
{
workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService();
}
return workflowService;
}
/**
* @return Returns output from the in-line editor page.
*/
public String getEditorOutput()
{
return this.editorOutput;
}
/**
* @param editorOutput
* The output from the in-line editor page
*/
public void setEditorOutput(String editorOutput)
{
this.editorOutput = editorOutput;
}
/**
* @return Returns the document content used for HTML in-line editing.
*/
public String getDocumentContent()
{
return this.documentContent;
}
/**
* @param documentContent
* The document content for HTML in-line editing.
*/
public void setDocumentContent(String documentContent)
{
this.documentContent = documentContent;
}
/**
* @return Returns the working copy Document.
*/
public Node getWorkingDocument()
{
return this.workingDocument;
}
/**
* @param workingDocument
* The working copy Document to set.
*/
public void setWorkingDocument(Node workingDocument)
{
this.workingDocument = workingDocument;
}
/**
* @return The document node being used for the current operation
*/
public Node getDocument()
{
return this.document;
}
/**
* @param document
* The document node to be used for the current operation
*/
public void setDocument(Node document)
{
this.document = document;
}
/**
* @return Returns the selected Space Id.
*/
public NodeRef getSelectedSpaceId()
{
return this.selectedSpaceId;
}
/**
* @param selectedSpaceId
* The selected Space Id to set.
*/
public void setSelectedSpaceId(NodeRef selectedSpaceId)
{
this.selectedSpaceId = selectedSpaceId;
}
/**
* @return the file
*/
public File getFile()
{
return file;
}
/**
* @param file the file to set
*/
public void setFile(File file)
{
this.file = file;
}
/**
* @return the fileName
*/
public String getFileName()
{
return fileName;
}
/**
* @param fileName the fileName to set
*/
public void setFileName(String fileName)
{
this.fileName = fileName;
}
/**
* @param keepCheckedOut
* The keepCheckedOut to set.
*/
public void setKeepCheckedOut(boolean keepCheckedOut)
{
this.keepCheckedOut = keepCheckedOut;
}
/**
* @return Returns the keepCheckedOut.
*/
public boolean getKeepCheckedOut()
{
return this.keepCheckedOut;
}
/**
* @param minorChange
* The minorChange to set.
*/
public void setMinorChange(boolean minorChange)
{
this.minorChange = minorChange;
}
/**
* @return Returns the minorChange flag.
*/
public boolean getMinorChange()
{
return this.minorChange;
}
/**
* @return the isWorkflowAction
*/
public boolean isWorkflowAction()
{
return isWorkflowAction;
}
/**
* @param isWorkflowAction the isWorkflowAction to set
*/
public void setWorkflowAction(boolean isWorkflowAction)
{
this.isWorkflowAction = isWorkflowAction;
}
/**
* @return the workflowTaskId
*/
public String getWorkflowTaskId()
{
return workflowTaskId;
}
/**
* @param workflowTaskId the workflowTaskId to set
*/
public void setWorkflowTaskId(String workflowTaskId)
{
this.workflowTaskId = workflowTaskId;
}
/**
* @return Returns the version history notes.
*/
public String getVersionNotes()
{
return this.versionNotes;
}
/**
* @param versionNotes
* The version history notes to set.
*/
public void setVersionNotes(String versionNotes)
{
this.versionNotes = versionNotes;
}
/**
* @return Returns the copy location. Either the current or other space.
*/
public String getCopyLocation()
{
if (this.getFileName() == null || this.getFileName().length() == 0)
{
return this.copyLocation;
}
else
{
return CCProperties.COPYLOCATION_OTHER;
}
}
/**
* @param copyLocation
* The copy location. Either the current or other space.
*/
public void setCopyLocation(String copyLocation)
{
this.copyLocation = copyLocation;
}
/**
* @return Returns WebDav url for online editing. If webdav online editing didn't yet started, returns null
*/
public String getWebdavUrl()
{
return webdavUrl;
}
/**
* @param webdavUrl The webdav url. Using only for online editing
*/
public void setWebdavUrl(String webdavUrl)
{
this.webdavUrl = webdavUrl;
}
/**
* @return Returns CIFS path for online editing. If cifs online editing didn't yet started, returns null
*/
public String getCifsPath()
{
return cifsPath;
}
/**
* @param cifsPath The cifs path. Using only for online editing
*/
public void setCifsPath(String cifsPath)
{
this.cifsPath = cifsPath;
}
}

View File

@@ -1,101 +1,101 @@
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.ui.common.ReportedException;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class CCUndoCheckoutFileDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = -6957120889259486975L;
public static final String LBL_UNDO_CHECKOUT = "undo_checkout";
public static final String MSG_UNDO_CHECKOUT_FOR = "undo_checkout_for";
private final static String MSG_LEFT_QUOTE = "left_qoute";
private final static String MSG_RIGHT_QUOTE = "right_quote";
private static Log logger = LogFactory.getLog(CheckinCheckoutDialog.class);
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return undoCheckoutFile(context, outcome);
}
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
return Application.getMessage(fc, MSG_UNDO_CHECKOUT_FOR) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
+ property.getDocument().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_UNDO_CHECKOUT);
}
/**
* Action to undo the checkout of a locked document. This document may
* either by the original copy or the working copy node. Therefore calculate
* which it is, if the working copy is found then we simply cancel checkout
* on that document. If the original copy is found then we need to find the
* appropriate working copy and perform the action on that node.
*/
public String undoCheckoutFile(FacesContext context, String outcome)
{
Node node = property.getDocument();
if (node != null)
{
try
{
if (node.hasAspect(ContentModel.ASPECT_WORKING_COPY))
{
this.property.getVersionOperationsService().cancelCheckout(node.getNodeRef());
}
else if (node.hasAspect(ContentModel.ASPECT_LOCKABLE))
{
// TODO: find the working copy for this document and cancel
// the checkout on it
// is this possible? as currently only the workingcopy
// aspect has the copyReference
// attribute - this means we cannot find out where the copy
// is to cancel it!
// can we construct an XPath node lookup?
throw new RuntimeException("NOT IMPLEMENTED");
}
else
{
throw new IllegalStateException("Node supplied for undo checkout has neither Working Copy or Locked aspect!");
}
resetState();
}
catch (Throwable err)
{
Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(), MSG_ERROR_CANCELCHECKOUT) + err.getMessage(), err);
ReportedException.throwIfNecessary(err);
}
}
else
{
logger.warn("WARNING: undoCheckout called without a current WorkingDocument!");
}
return outcome + ":browse";
}
}
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.ui.common.ReportedException;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class CCUndoCheckoutFileDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = -6957120889259486975L;
public static final String LBL_UNDO_CHECKOUT = "undo_checkout";
public static final String MSG_UNDO_CHECKOUT_FOR = "undo_checkout_for";
private final static String MSG_LEFT_QUOTE = "left_qoute";
private final static String MSG_RIGHT_QUOTE = "right_quote";
private static Log logger = LogFactory.getLog(CheckinCheckoutDialog.class);
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return undoCheckoutFile(context, outcome);
}
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
return Application.getMessage(fc, MSG_UNDO_CHECKOUT_FOR) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
+ property.getDocument().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_UNDO_CHECKOUT);
}
/**
* Action to undo the checkout of a locked document. This document may
* either by the original copy or the working copy node. Therefore calculate
* which it is, if the working copy is found then we simply cancel checkout
* on that document. If the original copy is found then we need to find the
* appropriate working copy and perform the action on that node.
*/
public String undoCheckoutFile(FacesContext context, String outcome)
{
Node node = property.getDocument();
if (node != null)
{
try
{
if (node.hasAspect(ContentModel.ASPECT_WORKING_COPY))
{
this.property.getVersionOperationsService().cancelCheckout(node.getNodeRef());
}
else if (node.hasAspect(ContentModel.ASPECT_LOCKABLE))
{
// TODO: find the working copy for this document and cancel
// the checkout on it
// is this possible? as currently only the workingcopy
// aspect has the copyReference
// attribute - this means we cannot find out where the copy
// is to cancel it!
// can we construct an XPath node lookup?
throw new RuntimeException("NOT IMPLEMENTED");
}
else
{
throw new IllegalStateException("Node supplied for undo checkout has neither Working Copy or Locked aspect!");
}
resetState();
}
catch (Throwable err)
{
Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(), MSG_ERROR_CANCELCHECKOUT) + err.getMessage(), err);
ReportedException.throwIfNecessary(err);
}
}
else
{
logger.warn("WARNING: undoCheckout called without a current WorkingDocument!");
}
return outcome + ":browse";
}
}

View File

@@ -1,46 +1,46 @@
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
public class CCWorkingCopyMissingDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = 8067485292477557683L;
public static final String MSG_WORKING_COPY_FOR = "working_copy_for";
private final static String MSG_LEFT_QUOTE = "left_qoute";
private final static String MSG_RIGHT_QUOTE = "right_quote";
public static final String LBL_CLOSE = "close";
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove(AlfrescoNavigationHandler.EXTERNAL_CONTAINER_SESSION);
return getDefaultCancelOutcome();
}
@Override
public String cancel()
{
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove(AlfrescoNavigationHandler.EXTERNAL_CONTAINER_SESSION);
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + ":browse";
}
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
return Application.getMessage(fc, MSG_WORKING_COPY_FOR) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
+ property.getDocument().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_CLOSE);
}
}
package org.alfresco.web.bean.coci;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
public class CCWorkingCopyMissingDialog extends CheckinCheckoutDialog
{
private static final long serialVersionUID = 8067485292477557683L;
public static final String MSG_WORKING_COPY_FOR = "working_copy_for";
private final static String MSG_LEFT_QUOTE = "left_qoute";
private final static String MSG_RIGHT_QUOTE = "right_quote";
public static final String LBL_CLOSE = "close";
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove(AlfrescoNavigationHandler.EXTERNAL_CONTAINER_SESSION);
return getDefaultCancelOutcome();
}
@Override
public String cancel()
{
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove(AlfrescoNavigationHandler.EXTERNAL_CONTAINER_SESSION);
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + ":browse";
}
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
return Application.getMessage(fc, MSG_WORKING_COPY_FOR) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
+ property.getDocument().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_CLOSE);
}
}