KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > web > bean > wizard > InviteUsersWizard


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.web.bean.wizard;
18
19 import java.text.MessageFormat JavaDoc;
20 import java.util.ArrayList JavaDoc;
21 import java.util.Arrays JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.ResourceBundle JavaDoc;
24 import java.util.Set JavaDoc;
25
26 import javax.faces.component.UISelectOne;
27 import javax.faces.context.FacesContext;
28 import javax.faces.event.ActionEvent;
29 import javax.faces.model.DataModel;
30 import javax.faces.model.ListDataModel;
31 import javax.faces.model.SelectItem;
32 import javax.transaction.UserTransaction JavaDoc;
33
34 import org.alfresco.model.ContentModel;
35 import org.alfresco.service.cmr.repository.NodeRef;
36 import org.alfresco.service.cmr.security.AuthorityService;
37 import org.alfresco.service.cmr.security.AuthorityType;
38 import org.alfresco.service.cmr.security.PermissionService;
39 import org.alfresco.service.cmr.security.PersonService;
40 import org.alfresco.service.namespace.NamespaceService;
41 import org.alfresco.web.app.Application;
42 import org.alfresco.web.app.context.UIContextService;
43 import org.alfresco.web.bean.repository.Node;
44 import org.alfresco.web.bean.repository.Repository;
45 import org.alfresco.web.bean.repository.User;
46 import org.alfresco.web.ui.common.SortableSelectItem;
47 import org.alfresco.web.ui.common.Utils;
48 import org.alfresco.web.ui.common.component.UIGenericPicker;
49 import org.apache.commons.logging.Log;
50 import org.apache.commons.logging.LogFactory;
51 import org.springframework.mail.SimpleMailMessage;
52 import org.springframework.mail.javamail.JavaMailSender;
53
54 /**
55  * @author Kevin Roast
56  */

57 public abstract class InviteUsersWizard extends AbstractWizardBean
58 {
59    private static Log logger = LogFactory.getLog(InviteUsersWizard.class);
60    
61    /** I18N message strings */
62    private static final String JavaDoc MSG_USERS = "users";
63    private static final String JavaDoc MSG_GROUPS = "groups";
64    private static final String JavaDoc MSG_INVITED_TO = "invited_to";
65    private static final String JavaDoc MSG_INVITED_ROLE = "invite_role";
66    private static final String JavaDoc STEP1_TITLE_ID = "invite_step1_title";
67    private static final String JavaDoc STEP2_TITLE_ID = "invite_step2_title";
68    private static final String JavaDoc STEP2_DESCRIPTION_ID = "invite_step2_desc";
69    private static final String JavaDoc FINISH_INSTRUCTION_ID = "invite_finish_instruction";
70    
71    private static final String JavaDoc NOTIFY_YES = "yes";
72    
73    /** NamespaceService bean reference */
74    protected NamespaceService namespaceService;
75    
76    /** JavaMailSender bean reference */
77    protected JavaMailSender mailSender;
78    
79    /** AuthorityService bean reference */
80    protected AuthorityService authorityService;
81    
82    /** PermissionService bean reference */
83    protected PermissionService permissionService;
84    
85    /** personService bean reference */
86    protected PersonService personService;
87    
88    /** datamodel for table of roles for users */
89    private DataModel userRolesDataModel = null;
90    
91    /** list of user/group role wrapper objects */
92    private List JavaDoc<UserGroupRole> userGroupRoles = null;
93    
94    /** dialog state */
95    private String JavaDoc notify = NOTIFY_YES;
96    private String JavaDoc subject = null;
97    private String JavaDoc body = null;
98    private String JavaDoc internalSubject = null;
99    private String JavaDoc automaticText = null;
100    
101    /**
102     * @return a cached list of available permissions for the type being dealt with
103     */

104    protected abstract Set JavaDoc<String JavaDoc> getPermissionsForType();
105    
106    /**
107     * @return Returns the node that the permissions are being applied to
108     */

109    protected abstract Node getNode();
110    
111    /**
112     * @return The text to use for the description of step 1 (depends on the type being dealt with)
113     */

114    protected abstract String JavaDoc getStep1DescriptionText();
115    
116    /**
117     * @param namespaceService The NamespaceService to set.
118     */

119    public void setNamespaceService(NamespaceService namespaceService)
120    {
121       this.namespaceService = namespaceService;
122    }
123    
124    /**
125     * @param mailSender The JavaMailSender to set.
126     */

127    public void setMailSender(JavaMailSender mailSender)
128    {
129       this.mailSender = mailSender;
130    }
131    
132    /**
133     * @param permissionService The PermissionService to set.
134     */

135    public void setPermissionService(PermissionService permissionService)
136    {
137       this.permissionService = permissionService;
138    }
139    
140    /**
141     * @param permissionService The PermissionService to set.
142     */

143    public void setPersonService(PersonService personService)
144    {
145       this.personService = personService;
146    }
147    
148    /**
149     * @param authorityService The authorityService to set.
150     */

151    public void setAuthorityService(AuthorityService authorityService)
152    {
153       this.authorityService = authorityService;
154    }
155
156    /**
157     * Initialises the wizard
158     */

159    public void init()
160    {
161       super.init();
162       
163       notify = NOTIFY_YES;
164       userGroupRoles = new ArrayList JavaDoc<UserGroupRole>(8);
165       subject = "";
166       body = "";
167       automaticText = "";
168       internalSubject = null;
169    }
170
171    /**
172     * @see org.alfresco.web.bean.wizard.AbstractWizardBean#finish()
173     */

174    public String JavaDoc finish()
175    {
176       String JavaDoc outcome = FINISH_OUTCOME;
177       
178       UserTransaction JavaDoc tx = null;
179       
180       try
181       {
182          FacesContext context = FacesContext.getCurrentInstance();
183          
184          tx = Repository.getUserTransaction(context);
185          tx.begin();
186          
187          String JavaDoc subject = this.subject;
188          if (subject == null || subject.length() == 0)
189          {
190             subject = this.internalSubject;
191          }
192          
193          User user = Application.getCurrentUser(context);
194          String JavaDoc from = (String JavaDoc)this.nodeService.getProperty(user.getPerson(), ContentModel.PROP_EMAIL);
195          if (from == null || from.length() == 0)
196          {
197             // if the user does not have an email address get the default one from the config service
198
from = Application.getClientConfig(context).getFromEmailAddress();
199          }
200          
201          // get the Space to apply changes too
202
NodeRef nodeRef = this.getNode().getNodeRef();
203          
204          // set permissions for each user and send them a mail
205
for (int i=0; i<this.userGroupRoles.size(); i++)
206          {
207             UserGroupRole userGroupRole = this.userGroupRoles.get(i);
208             String JavaDoc authority = userGroupRole.getAuthority();
209             
210             // find the selected permission ref from it's name and apply for the specified user
211
Set JavaDoc<String JavaDoc> perms = getPermissionsForType();
212             for (String JavaDoc permission : perms)
213             {
214                if (userGroupRole.getRole().equals(permission))
215                {
216                   this.permissionService.setPermission(
217                         nodeRef,
218                         authority,
219                         permission,
220                         true);
221                   break;
222                }
223             }
224             
225             // Create the mail message for sending to each User
226
if (NOTIFY_YES.equals(this.notify))
227             {
228                // if User, email then, else if Group get all members and email them
229
AuthorityType authType = AuthorityType.getAuthorityType(authority);
230                if (authType.equals(AuthorityType.USER))
231                {
232                   if (this.personService.personExists(authority) == true)
233                   {
234                      notifyUser(this.personService.getPerson(authority), nodeRef, from, userGroupRole.getRole());
235                   }
236                }
237                else if (authType.equals(AuthorityType.GROUP))
238                {
239                   // else notify all members of the group
240
Set JavaDoc<String JavaDoc> users = this.authorityService.getContainedAuthorities(AuthorityType.USER, authority, false);
241                   for (String JavaDoc userAuth : users)
242                   {
243                      if (this.personService.personExists(userAuth) == true)
244                      {
245                         notifyUser(this.personService.getPerson(userAuth), nodeRef, from, userGroupRole.getRole());
246                      }
247                   }
248                }
249             }
250          }
251          
252          // commit the transaction
253
tx.commit();
254          
255          UIContextService.getInstance(context).notifyBeans();
256       }
257       catch (Throwable JavaDoc e)
258       {
259          // rollback the transaction
260
try { if (tx != null) {tx.rollback();} } catch (Exception JavaDoc ex) {}
261          Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
262                FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e);
263          outcome = null;
264       }
265       
266       return outcome;
267    }
268    
269    /**
270     * Send an email notification to the specified User authority
271     *
272     * @param person Person node representing the user
273     * @param node Node they are invited too
274     * @param from From text message
275     * @param roleText The role display label for the user invite notification
276     */

277    private void notifyUser(NodeRef person, NodeRef node, String JavaDoc from, String JavaDoc roleText)
278    {
279       String JavaDoc to = (String JavaDoc)this.nodeService.getProperty(person, ContentModel.PROP_EMAIL);
280       
281       if (to != null && to.length() != 0)
282       {
283          String JavaDoc msgRole = Application.getMessage(FacesContext.getCurrentInstance(), MSG_INVITED_ROLE);
284          String JavaDoc roleMessage = MessageFormat.format(msgRole, new Object JavaDoc[] {roleText});
285          
286          // TODO: include External Authentication link to the invited node
287
//String args = node.getStoreRef().getProtocol() + '/' +
288
// node.getStoreRef().getIdentifier() + '/' +
289
// node.getId();
290
//String url = ExternalAccessServlet.generateExternalURL(LoginBean.OUTCOME_SPACEDETAILS, args);
291

292          String JavaDoc body = this.internalSubject + "\r\n\r\n" + roleMessage + "\r\n\r\n";// + url + "\r\n\r\n";
293
if (this.body != null && this.body.length() != 0)
294          {
295             body += this.body;
296          }
297          
298          SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
299          simpleMailMessage.setTo(to);
300          simpleMailMessage.setSubject(subject);
301          simpleMailMessage.setText(body);
302          simpleMailMessage.setFrom(from);
303          
304          if (logger.isDebugEnabled())
305             logger.debug("Sending notification email to: " + to + "\n...with subject:\n" + subject + "\n...with body:\n" + body);
306          
307          try
308          {
309             // Send the message
310
this.mailSender.send(simpleMailMessage);
311          }
312          catch (Throwable JavaDoc e)
313          {
314             // don't stop the action but let admins know email is not getting sent
315
logger.error("Failed to send email to " + to, e);
316          }
317       }
318    }
319    
320    /**
321     * Returns the properties for current user-roles JSF DataModel
322     *
323     * @return JSF DataModel representing the current user-roles
324     */

325    public DataModel getUserRolesDataModel()
326    {
327       if (this.userRolesDataModel == null)
328       {
329          this.userRolesDataModel = new ListDataModel();
330       }
331       
332       this.userRolesDataModel.setWrappedData(this.userGroupRoles);
333       
334       return this.userRolesDataModel;
335    }
336    
337    /**
338     * Query callback method executed by the Generic Picker component.
339     * This method is part of the contract to the Generic Picker, it is up to the backing bean
340     * to execute whatever query is appropriate and return the results.
341     *
342     * @param filterIndex Index of the filter drop-down selection
343     * @param contains Text from the contains textbox
344     *
345     * @return An array of SelectItem objects containing the results to display in the picker.
346     */

347    public SelectItem[] pickerCallback(int filterIndex, String JavaDoc contains)
348    {
349       FacesContext context = FacesContext.getCurrentInstance();
350       
351       SelectItem[] items;
352       
353       UserTransaction JavaDoc tx = null;
354       try
355       {
356          tx = Repository.getUserTransaction(context, true);
357          tx.begin();
358          
359          if (filterIndex == 0)
360          {
361             // build xpath to match available User/Person objects
362
NodeRef peopleRef = personService.getPeopleContainer();
363             // NOTE: see SearcherComponentTest
364
String JavaDoc xpath = "*[like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "firstName, '%" + contains + "%', false)" +
365                     " or " + "like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "lastName, '%" + contains + "%', false)]";
366             
367             List JavaDoc<NodeRef> nodes = searchService.selectNodes(
368                   peopleRef,
369                   xpath,
370                   null,
371                   this.namespaceService,
372                   false);
373             
374             items = new SelectItem[nodes.size()];
375             for (int index=0; index<nodes.size(); index++)
376             {
377                NodeRef personRef = nodes.get(index);
378                String JavaDoc firstName = (String JavaDoc)this.nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);
379                String JavaDoc lastName = (String JavaDoc)this.nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME);
380                String JavaDoc username = (String JavaDoc)this.nodeService.getProperty(personRef, ContentModel.PROP_USERNAME);
381                SelectItem item = new SortableSelectItem(username, firstName + " " + lastName, lastName);
382                items[index] = item;
383             }
384          }
385          else
386          {
387             // groups - simple text based match on name
388
Set JavaDoc<String JavaDoc> groups = authorityService.getAllAuthorities(AuthorityType.GROUP);
389             groups.addAll(authorityService.getAllAuthorities(AuthorityType.EVERYONE));
390             
391             List JavaDoc<SelectItem> results = new ArrayList JavaDoc<SelectItem>(groups.size());
392             String JavaDoc containsLower = contains.toLowerCase();
393             int offset = PermissionService.GROUP_PREFIX.length();
394             for (String JavaDoc group : groups)
395             {
396                if (group.toLowerCase().indexOf(containsLower, offset) != -1)
397                {
398                   results.add(new SortableSelectItem(group, group.substring(offset), group));
399                }
400             }
401             items = new SelectItem[results.size()];
402             results.toArray(items);
403          }
404          
405          Arrays.sort(items);
406          
407          // commit the transaction
408
tx.commit();
409       }
410       catch (Throwable JavaDoc err)
411       {
412          Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
413                FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err );
414          try { if (tx != null) {tx.rollback();} } catch (Exception JavaDoc tex) {}
415          
416          items = new SelectItem[0];
417       }
418       
419       return items;
420    }
421    
422    /**
423     * Action handler called when the Add button is pressed to process the current selection
424     */

425    public void addSelection(ActionEvent event)
426    {
427       UIGenericPicker picker = (UIGenericPicker)event.getComponent().findComponent("picker");
428       UISelectOne rolePicker = (UISelectOne)event.getComponent().findComponent("roles");
429       
430       String JavaDoc[] results = picker.getSelectedResults();
431       if (results != null)
432       {
433          String JavaDoc role = (String JavaDoc)rolePicker.getValue();
434          
435          if (role != null)
436          {
437             for (int i=0; i<results.length; i++)
438             {
439                String JavaDoc authority = results[i];
440                
441                // only add if authority not already present in the list with same role
442
boolean foundExisting = false;
443                for (int n=0; n<this.userGroupRoles.size(); n++)
444                {
445                   UserGroupRole wrapper = this.userGroupRoles.get(n);
446                   if (authority.equals(wrapper.getAuthority()) &&
447                       role.equals(wrapper.getRole()))
448                   {
449                      foundExisting = true;
450                      break;
451                   }
452                }
453                
454                if (foundExisting == false)
455                {
456                   StringBuilder JavaDoc label = new StringBuilder JavaDoc(64);
457                   
458                   // build a display label showing the user and their role for the space
459
AuthorityType authType = AuthorityType.getAuthorityType(authority);
460                   if (authType == AuthorityType.GUEST || authType == AuthorityType.USER)
461                   {
462                      if (authType == AuthorityType.GUEST || this.personService.personExists(authority) == true)
463                      {
464                         // found a User authority
465
NodeRef ref = this.personService.getPerson(authority);
466                         String JavaDoc firstName = (String JavaDoc)this.nodeService.getProperty(ref, ContentModel.PROP_FIRSTNAME);
467                         String JavaDoc lastName = (String JavaDoc)this.nodeService.getProperty(ref, ContentModel.PROP_LASTNAME);
468                         
469                         label.append(firstName)
470                              .append(" ")
471                              .append(lastName != null ? lastName : "")
472                              .append(" (")
473                              .append(Application.getMessage(FacesContext.getCurrentInstance(), role))
474                              .append(")");
475                      }
476                   }
477                   else
478                   {
479                      // found a group authority
480
label.append(authority.substring(PermissionService.GROUP_PREFIX.length()))
481                           .append(" (")
482                           .append(Application.getMessage(FacesContext.getCurrentInstance(), role))
483                           .append(")");
484                   }
485                   
486                   this.userGroupRoles.add(new UserGroupRole(authority, role, label.toString()));
487                }
488             }
489          }
490       }
491    }
492    
493    /**
494     * Action handler called when the Remove button is pressed to remove a user+role
495     */

496    public void removeSelection(ActionEvent event)
497    {
498       UserGroupRole wrapper = (UserGroupRole)this.userRolesDataModel.getRowData();
499       if (wrapper != null)
500       {
501          this.userGroupRoles.remove(wrapper);
502       }
503    }
504    
505    /**
506     * Property accessed by the Generic Picker component.
507     *
508     * @return the array of filter options to show in the users/groups picker
509     */

510    public SelectItem[] getFilters()
511    {
512       ResourceBundle JavaDoc bundle = Application.getBundle(FacesContext.getCurrentInstance());
513       
514       return new SelectItem[] {
515             new SelectItem("0", bundle.getString(MSG_USERS)),
516             new SelectItem("1", bundle.getString(MSG_GROUPS)) };
517    }
518    
519    /**
520     * @return The list of available roles for the users/groups
521     */

522    public SelectItem[] getRoles()
523    {
524       ResourceBundle JavaDoc bundle = Application.getBundle(FacesContext.getCurrentInstance());
525       
526       // get available roles (grouped permissions) from the permission service
527
Set JavaDoc<String JavaDoc> perms = getPermissionsForType();
528       SelectItem[] roles = new SelectItem[perms.size()];
529       int index = 0;
530       for (String JavaDoc permission : perms)
531       {
532          String JavaDoc displayLabel = bundle.getString(permission);
533          roles[index++] = new SelectItem(permission, displayLabel);
534       }
535       
536       return roles;
537    }
538    
539    /**
540     * @return Returns the notify listbox selection.
541     */

542    public String JavaDoc getNotify()
543    {
544       return this.notify;
545    }
546
547    /**
548     * @param notify The notify listbox selection to set.
549     */

550    public void setNotify(String JavaDoc notify)
551    {
552       this.notify = notify;
553    }
554
555    /**
556     * @return Returns the automaticText.
557     */

558    public String JavaDoc getAutomaticText()
559    {
560       return this.automaticText;
561    }
562
563    /**
564     * @param automaticText The automaticText to set.
565     */

566    public void setAutomaticText(String JavaDoc automaticText)
567    {
568       this.automaticText = automaticText;
569    }
570    
571    /**
572     * @return Returns the email body text.
573     */

574    public String JavaDoc getBody()
575    {
576       return this.body;
577    }
578
579    /**
580     * @param body The email body text to set.
581     */

582    public void setBody(String JavaDoc body)
583    {
584       this.body = body;
585    }
586
587    /**
588     * @return Returns the email subject text.
589     */

590    public String JavaDoc getSubject()
591    {
592       return this.subject;
593    }
594
595    /**
596     * @param subject The email subject text to set.
597     */

598    public void setSubject(String JavaDoc subject)
599    {
600       this.subject = subject;
601    }
602
603    /**
604     * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepDescription()
605     */

606    public String JavaDoc getStepDescription()
607    {
608       String JavaDoc stepDesc = null;
609       
610       switch (this.currentStep)
611       {
612          case 1:
613          {
614             stepDesc = Application.getMessage(FacesContext.getCurrentInstance(), getStep1DescriptionText());
615             break;
616          }
617          case 2:
618          {
619             stepDesc = Application.getMessage(FacesContext.getCurrentInstance(), STEP2_DESCRIPTION_ID);
620             break;
621          }
622          default:
623          {
624             stepDesc = "";
625          }
626       }
627       
628       return stepDesc;
629    }
630
631    /**
632     * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepTitle()
633     */

634    public String JavaDoc getStepTitle()
635    {
636       String JavaDoc stepTitle = null;
637       
638       switch (this.currentStep)
639       {
640          case 1:
641          {
642             stepTitle = Application.getMessage(FacesContext.getCurrentInstance(), STEP1_TITLE_ID);
643             break;
644          }
645          case 2:
646          {
647             stepTitle = Application.getMessage(FacesContext.getCurrentInstance(), STEP2_TITLE_ID);
648             break;
649          }
650          default:
651          {
652             stepTitle = "";
653          }
654       }
655       
656       return stepTitle;
657    }
658    
659    /**
660     * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepInstructions()
661     */

662    public String JavaDoc getStepInstructions()
663    {
664       String JavaDoc stepInstruction = null;
665       
666       switch (this.currentStep)
667       {
668          case 2:
669          {
670             stepInstruction = Application.getMessage(FacesContext.getCurrentInstance(), FINISH_INSTRUCTION_ID);
671             break;
672          }
673          default:
674          {
675             stepInstruction = Application.getMessage(FacesContext.getCurrentInstance(), DEFAULT_INSTRUCTION_ID);
676          }
677       }
678       
679       return stepInstruction;
680    }
681    
682    /**
683     * @see org.alfresco.web.bean.wizard.AbstractWizardBean#next()
684     */

685    public String JavaDoc next()
686    {
687       String JavaDoc outcome = super.next();
688       
689       if (outcome.equals("notify"))
690       {
691          FacesContext context = FacesContext.getCurrentInstance();
692          
693          // prepare automatic text for email and screen
694
StringBuilder JavaDoc buf = new StringBuilder JavaDoc(256);
695          
696          String JavaDoc personName = Application.getCurrentUser(context).getFullName(getNodeService());
697          String JavaDoc msgInvitedTo = Application.getMessage(context, MSG_INVITED_TO);
698          Node node = this.getNode();
699          String JavaDoc path = this.nodeService.getPath(node.getNodeRef()).toDisplayPath(this.nodeService);
700          buf.append(MessageFormat.format(msgInvitedTo, new Object JavaDoc[] {
701                path + '/' + node.getName(),
702                personName}) );
703          
704          this.internalSubject = buf.toString();
705          
706          buf.append("<br>");
707          
708          String JavaDoc msgRole = Application.getMessage(context, MSG_INVITED_ROLE);
709          String JavaDoc roleText;
710          if (this.userGroupRoles.size() != 0)
711          {
712             String JavaDoc roleMsg = Application.getMessage(context, userGroupRoles.get(0).getRole());
713             roleText = MessageFormat.format(msgRole, roleMsg);
714          }
715          else
716          {
717             roleText = MessageFormat.format(msgRole, "[role]");
718          }
719          
720          buf.append(roleText);
721          
722          this.automaticText = buf.toString();
723       }
724       
725       return outcome;
726    }
727    
728    /**
729     * @see org.alfresco.web.bean.wizard.AbstractWizardBean#determineOutcomeForStep(int)
730     */

731    protected String JavaDoc determineOutcomeForStep(int step)
732    {
733       String JavaDoc outcome = null;
734       
735       switch(step)
736       {
737          case 1:
738          {
739             outcome = "invite";
740             break;
741          }
742          case 2:
743          {
744             outcome = "notify";
745             break;
746          }
747          default:
748          {
749             outcome = CANCEL_OUTCOME;
750          }
751       }
752       
753       return outcome;
754    }
755    
756    /**
757     * Simple wrapper class to represent a user/group and a role combination
758     */

759    public static class UserGroupRole
760    {
761       public UserGroupRole(String JavaDoc authority, String JavaDoc role, String JavaDoc label)
762       {
763          this.authority = authority;
764          this.role = role;
765          this.label = label;
766       }
767       
768       public String JavaDoc getAuthority()
769       {
770          return this.authority;
771       }
772       
773       public String JavaDoc getRole()
774       {
775          return this.role;
776       }
777       
778       public String JavaDoc getLabel()
779       {
780          return this.label;
781       }
782       
783       private String JavaDoc authority;
784       private String JavaDoc role;
785       private String JavaDoc label;
786    }
787 }
788
Popular Tags