mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Added environment variable expansion to the command line handling of desktop actions, plus the special '%AlfrescoDir%' token for the
current working directory path (from the client side). Updated sample commandline test action to use '%SystemRoot%\Notepad.exe'. Added lock check to check out action code to give more meaningful error message. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3689 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -113,6 +113,11 @@ public class CheckInOutDesktopAction extends DesktopAction {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Dump the error
|
||||
|
||||
if ( logger.isErrorEnabled())
|
||||
logger.error("Desktop action error", ex);
|
||||
|
||||
// Return an error status and message
|
||||
|
||||
response.setStatus(StsError, "Checkin failed for " + target.getTarget() + ", " + ex.getMessage());
|
||||
@@ -122,6 +127,19 @@ public class CheckInOutDesktopAction extends DesktopAction {
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check if the file is locked
|
||||
|
||||
if ( getNodeService().hasAspect( target.getNode(), ContentModel.ASPECT_LOCKABLE)) {
|
||||
|
||||
// Get the lock type
|
||||
|
||||
String lockTypeStr = (String) getNodeService().getProperty( target.getNode(), ContentModel.PROP_LOCK_TYPE);
|
||||
if ( lockTypeStr != null) {
|
||||
response.setStatus(StsError, "Checkout failed, file is locked");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
// Check out the file
|
||||
|
||||
NodeRef workingCopyNode = getCheckInOutService().checkout( target.getNode());
|
||||
@@ -149,6 +167,11 @@ public class CheckInOutDesktopAction extends DesktopAction {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Dump the error
|
||||
|
||||
if ( logger.isErrorEnabled())
|
||||
logger.error("Desktop action error", ex);
|
||||
|
||||
// Return an error status and message
|
||||
|
||||
response.setStatus(StsError, "Failed to checkout " + target.getTarget() + ", " + ex.getMessage());
|
||||
|
@@ -47,6 +47,6 @@ public class CmdLineDesktopAction extends DesktopAction {
|
||||
|
||||
// Return a URL in the status message
|
||||
|
||||
return new DesktopResponse(StsCommandLine, "C:\\Windows\\notepad.exe");
|
||||
return new DesktopResponse(StsCommandLine, "%SystemRoot%\\notepad.exe");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user