Provide a new SiteDoesNotExistException, extending the existing SiteServiceException, to make it easier for code to identify this case

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29030 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch 2011-07-14 13:20:59 +00:00
parent dbf61eef67
commit 72eb9be0bd
2 changed files with 49 additions and 10 deletions

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.site;
/**
* Site does not exist exception
*
* @author Roy Wetherall
*/
public class SiteDoesNotExistException extends SiteServiceException
{
/** Serial version UID */
private static final long serialVersionUID = -58321344792182609L;
/** The error message label for this */
private static final String MSG_SITE_NO_EXIST = "site_service.site_no_exist";
/**
* Constructor
*/
public SiteDoesNotExistException(String shortName)
{
super(MSG_SITE_NO_EXIST, new Object[]{shortName});
}
}

View File

@ -127,7 +127,6 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
private static final String MSG_VISIBILITY_GROUP_MISSING = "site_service.visibility_group_missing";
private static final String MSG_CAN_NOT_UPDATE = "site_service.can_not_update";
private static final String MSG_CAN_NOT_DELETE = "site_service.can_not_delete";
private static final String MSG_SITE_NO_EXIST = "site_service.site_no_exist";
private static final String MSG_CAN_NOT_REMOVE_MSHIP = "site_service.can_not_remove_membership";
private static final String MSG_DO_NOT_CHANGE_MGR = "site_service.do_not_change_manager";
private static final String MSG_CAN_NOT_CHANGE_MSHIP="site_service.can_not_change_membership";
@ -1438,7 +1437,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
NodeRef siteNodeRef = getSiteNodeRef(shortName);
if (siteNodeRef == null)
{
throw new SiteServiceException(MSG_SITE_NO_EXIST, new Object[]{shortName});
throw new SiteDoesNotExistException(shortName);
}
// Build an array of name filter tokens pre lowercased to test against person properties
@ -1651,7 +1650,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
NodeRef siteNodeRef = getSiteNodeRef(siteShortName);
if (siteNodeRef == null)
{
throw new SiteServiceException(MSG_SITE_NO_EXIST, new Object[] { siteShortName });
throw new SiteDoesNotExistException(siteShortName);
}
List<String> fullResult = new ArrayList<String>(5);
@ -1709,7 +1708,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
NodeRef siteNodeRef = getSiteNodeRef(shortName);
if (siteNodeRef == null)
{
throw new SiteServiceException(MSG_SITE_NO_EXIST, new Object[] { shortName });
throw new SiteDoesNotExistException(shortName);
}
QName siteType = directNodeService.getType(siteNodeRef);
return getSiteRoles(siteType);
@ -1741,7 +1740,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
final NodeRef siteNodeRef = getSiteNodeRef(shortName);
if (siteNodeRef == null)
{
throw new SiteServiceException(MSG_SITE_NO_EXIST, new Object[]{shortName});
throw new SiteDoesNotExistException(shortName);
}
// TODO what do we do about the user if they are in a group that has
@ -1818,7 +1817,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
final NodeRef siteNodeRef = getSiteNodeRef(shortName);
if (siteNodeRef == null)
{
throw new SiteServiceException(MSG_SITE_NO_EXIST, new Object[]{shortName});
throw new SiteDoesNotExistException(shortName);
}
// Get the user's current role
@ -1931,7 +1930,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
NodeRef siteNodeRef = getSiteNodeRef(shortName);
if (siteNodeRef == null)
{
throw new SiteServiceException(MSG_SITE_NO_EXIST, new Object[]{shortName});
throw new SiteDoesNotExistException(shortName);
}
// Update the isPublic flag
@ -2017,7 +2016,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
NodeRef siteNodeRef = getSiteNodeRef(shortName);
if (siteNodeRef == null)
{
throw new SiteServiceException(MSG_SITE_NO_EXIST, new Object[] { shortName });
throw new SiteDoesNotExistException(shortName);
}
QName siteType = directNodeService.getType(siteNodeRef);
@ -2047,7 +2046,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
NodeRef siteNodeRef = getSiteNodeRef(shortName);
if (siteNodeRef == null)
{
throw new SiteServiceException(MSG_SITE_NO_EXIST, new Object[]{shortName});
throw new SiteDoesNotExistException(shortName);
}
// retrieve component folder within site
@ -2076,7 +2075,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
final NodeRef siteNodeRef = getSiteNodeRef(shortName);
if (siteNodeRef == null)
{
throw new SiteServiceException(MSG_SITE_NO_EXIST, new Object[]{shortName});
throw new SiteDoesNotExistException(shortName);
}
// retrieve component folder within site