mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-09 17:45:10 +00:00
Beefed up javadocs around automatic person creation
Added specialized PersonException for when the user could not be automatically created git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2439 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
93c234dddd
commit
42a2cd165a
@ -37,6 +37,7 @@ import org.alfresco.service.cmr.search.ResultSetRow;
|
|||||||
import org.alfresco.service.cmr.search.SearchParameters;
|
import org.alfresco.service.cmr.search.SearchParameters;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
|
import org.alfresco.service.cmr.security.NoSuchPersonException;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@ -111,7 +112,7 @@ public class PersonServiceImpl implements PersonService
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new PersonException("No person found for user name " + userName);
|
throw new NoSuchPersonException(userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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.service.cmr.security;
|
||||||
|
|
||||||
|
import org.alfresco.repo.security.person.PersonException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when a person doesn't exist and can't be created.
|
||||||
|
*
|
||||||
|
* @author Derek Hulley
|
||||||
|
*/
|
||||||
|
public class NoSuchPersonException extends PersonException
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = -8514361120995433997L;
|
||||||
|
|
||||||
|
private final String userName;
|
||||||
|
|
||||||
|
public NoSuchPersonException(String userName)
|
||||||
|
{
|
||||||
|
super(String.format("User does not exist and could not be created: %s", userName));
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName()
|
||||||
|
{
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
}
|
@ -39,18 +39,23 @@ public interface PersonService
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get a person by userName. The person is store in the repository. The
|
* Get a person by userName. The person is store in the repository. The
|
||||||
* person may be created as a side effect of this call.
|
* person may be created as a side effect of this call, depending on
|
||||||
|
* the setting to {@link #setCreateMissingPeople(boolean) create missing people or not}.
|
||||||
*
|
*
|
||||||
* @param userName - the userName key to find the person
|
* @param userName - the userName key to find the person
|
||||||
* @return
|
* @return Returns the person node, either existing or new
|
||||||
|
* @throws NoSuchPersonException if the user doesn't exist and could not be created automatically
|
||||||
|
*
|
||||||
|
* @see #setCreateMissingPeople(boolean)
|
||||||
|
* @see #createMissingPeople()
|
||||||
*/
|
*/
|
||||||
public NodeRef getPerson(String userName);
|
public NodeRef getPerson(String userName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a person exists.
|
* Check if a person exists.
|
||||||
*
|
*
|
||||||
* @param userName
|
* @param userName the user name
|
||||||
* @return
|
* @return Returns true if the user exists, otherwise false
|
||||||
*/
|
*/
|
||||||
public boolean personExists(String userName);
|
public boolean personExists(String userName);
|
||||||
|
|
||||||
@ -65,7 +70,9 @@ public interface PersonService
|
|||||||
/**
|
/**
|
||||||
* Set if missing people should be created.
|
* Set if missing people should be created.
|
||||||
*
|
*
|
||||||
* @param createMissing
|
* @param createMissing set to true to create people
|
||||||
|
*
|
||||||
|
* @see #getPerson(String)
|
||||||
*/
|
*/
|
||||||
public void setCreateMissingPeople(boolean createMissing);
|
public void setCreateMissingPeople(boolean createMissing);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user