View Javadoc
1   package org.argeo.people;
2   
3   import javax.jcr.Node;
4   import javax.jcr.RepositoryException;
5   
6   /**
7    * Provides method interfaces to manage persons and organisations in a people
8    * repository. Implementing applications should extend and/or override the
9    * canonical implementation in order to provide business specific behaviours.
10   * 
11   * The correct instance of this interface is usually acquired through the
12   * peopleService.
13   * */
14  public interface PersonService {
15  
16  	/** Simply returns the display name of the given person or organisation */
17  	public String getDefaultDisplayName(Node person);
18  	
19  	/**
20  	 * Try to save and optionally commit a person or an organisation after applying
21  	 * context specific rules and special behaviors (typically cache updates).
22  	 * 
23  	 * @param entity
24  	 * @param commit
25  	 *            also commit the corresponding object
26  	 * @throws PeopleException
27  	 *             If one a the rule defined for this type is not respected. Use
28  	 *             getMessage to display to the user if needed
29  	 */
30  	public Node saveEntity(Node entity, boolean commit) throws PeopleException, RepositoryException;
31  	
32  	/**
33  	 * 
34  	 * Creates or update a job of a person in an organisation
35  	 * 
36  	 * @param oldJob
37  	 *            null if creation
38  	 * @param person
39  	 *            cannot be null
40  	 * @param organisation
41  	 *            cannot be null
42  	 * @param position
43  	 *            can be null
44  	 * @param department
45  	 *            can be null
46  	 * @param isPrimary
47  	 *            pass false by default
48  	 * @return
49  	 */
50  	public Node createOrUpdateJob(Node oldJob, Node person, Node organisation,
51  			String position, String department, boolean isPrimary);
52  
53  }