001: /**
002: * %W% %G% Sun Microsystems
003: * Copyright 2002 Sun Microsystems, Inc. All
004: * rights reserved. Use of this product is subject
005: * to license terms. Federal Acquisitions:
006: * Commercial Software -- Government Users
007: * Subject to Standard License Terms and
008: * Conditions.
009: *
010: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011: * are trademarks or registered trademarks of Sun Microsystems,
012: * Inc. in the United States and other countries.
013: */package com.sun.portal.wireless.taglibs.ab;
014:
015: import java.beans.*;
016: import java.util.logging.Logger;
017: import javax.servlet.jsp.*;
018:
019: import com.sun.portal.wireless.taglibs.base.BeanSupport;
020: import com.sun.portal.wireless.taglibs.base.Edit;
021: import com.sun.portal.log.common.PortalLogger;
022:
023: import com.sun.addressbook.Group;
024: import com.sun.addressbook.Element;
025:
026: /**
027: * ABSetGroupMembersTag - add group members to a group
028: *
029: * This class writes the group members to the Group bean found in its parent
030: * entry tag or retrieved from pagecontext using name attribute.
031: *
032: * Attributes:
033: *
034: * members
035: * ',' separated list of element ids to add to the Group
036: * name
037: * name to use to retrieve the bean from the page context
038: *
039: */
040: public class ABSetGroupMembersTag extends BeanSupport {
041:
042: // Create a logger for this class
043: private static Logger debugLogger = PortalLogger
044: .getLogger(ABSetGroupMembersTag.class);
045:
046: /*
047: * Member ids of the members of a group .. to be used from add and
048: * modify with groups
049: */
050: protected String members = null;
051:
052: /**
053: * Get the members attribute
054: *
055: * @return set the members attribute
056: */
057: public String getMembers() {
058: return members;
059: }
060:
061: /**
062: * Set the members attribute
063: *
064: * @param set the members attribute
065: */
066: public void setMembers(String members) {
067: this .members = evalAttribute(members);
068: }
069:
070: /**
071: * Edit bean...
072: */
073: private Edit edit = null;
074:
075: /**
076: * Set the edit bean
077: */
078: public void setEdit(String edit) {
079: this .edit = (Edit) pageContext.getAttribute(edit);
080: }
081:
082: /**
083: * Set the group members to be added list in the properties object
084: *
085: * @return SKIP_BODY
086: * @exception JspException
087: */
088: public int doStartTag() throws JspException {
089: Object value;
090:
091: if (edit != null) {
092: members = edit.editString(members.toString());
093: }
094:
095: try {
096: Group group = (Group) findBean();
097: group.setProperty("members", members);
098: } catch (Exception e) {
099: String msg = this .getClass().getName()
100: + ".doStartTag(): No Group bean found.";
101: debugLogger.fine("PSMA_CSPWTA0003");
102: throw new JspException(msg + e.getMessage());
103: }
104:
105: return SKIP_BODY;
106: }
107:
108: /**
109: * Cleanup
110: */
111: public void release() {
112: super.release();
113: members = null;
114: edit = null;
115: }
116:
117: }
|