001: /**
002: * $Id: CMCNodeImpl.java,v 1.3 2005/07/25 23:02:37 jtb Exp $
003: * Copyright 2005 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.community.mc.impl.am.org;
014:
015: import com.iplanet.am.sdk.AMException;
016: import com.iplanet.am.sdk.AMObject;
017: import com.iplanet.am.sdk.AMOrganization;
018: import com.iplanet.sso.SSOException;
019: import com.sun.portal.community.mc.CMCException;
020: import com.sun.portal.community.mc.CMCNode;
021: import com.sun.portal.community.mc.CMCPrincipal;
022: import com.sun.portal.community.mc.ConfigTable;
023: import com.sun.portal.community.mc.ConfigTable.ConfigKey;
024: import com.sun.portal.community.mc.CMCRolePrincipal;
025: import com.sun.portal.community.mc.impl.am.CMCNodeImplBase;
026: import java.util.HashSet;
027: import java.util.Iterator;
028: import java.util.Properties;
029: import java.util.Set;
030:
031: /**
032: * AM organization community node contributor.
033: */
034: public class CMCNodeImpl extends CMCNodeImplBase implements CMCNode {
035: public static String getStaticType() {
036: return "am-org";
037: }
038:
039: public String getType() {
040: return getStaticType();
041: }
042:
043: public void init(Properties p, CMCPrincipal cp) throws CMCException {
044: super .init(p, cp);
045:
046: String dn = getCMCPrincipal().getName();
047: try {
048: int type = getAMObjectType(dn);
049: if (!(type == AMObject.ORGANIZATION)) {
050: throw new CMCException(
051: "name was not an organization DN: " + dn);
052: }
053: } catch (SSOException ssoe) {
054: throw new CMCException(ssoe);
055: } catch (AMException ame) {
056: throw new CMCException(ame);
057: }
058:
059: }
060:
061: public Set getUsers() throws CMCException {
062: Set users;
063:
064: try {
065: String orgDn = getCMCPrincipal().getName();
066: // one level deep, just this org
067: users = getOrganizationUsers(orgDn, 1);
068: } catch (AMException ame) {
069: throw new CMCException(ame);
070: } catch (SSOException ssoe) {
071: throw new CMCException(ssoe);
072: }
073:
074: return users;
075: }
076:
077: public boolean exists() throws CMCException {
078: return isValidEntry(getCMCPrincipal().getName());
079: }
080:
081: public ConfigTable getDPDocuments() throws CMCException {
082: ConfigTable dpDocuments;
083:
084: try {
085: String name = getCMCPrincipal().getName();
086: dpDocuments = getTemplateDPDocuments(name);
087: } catch (AMException ame) {
088: throw new CMCException(ame);
089: } catch (SSOException ssoe) {
090: throw new CMCException(ssoe);
091: }
092:
093: return dpDocuments;
094: }
095:
096: public ConfigTable getDPDocumentsLastModified() throws CMCException {
097: ConfigTable lastModifieds;
098:
099: try {
100: String name = getCMCPrincipal().getName();
101: lastModifieds = getTemplateDPDocumentsLastModified(name);
102: } catch (AMException ame) {
103: throw new CMCException(ame);
104: } catch (SSOException ssoe) {
105: throw new CMCException(ssoe);
106: }
107:
108: return lastModifieds;
109: }
110: }
|