001: /**
002: * Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use of this
003: * product is subject to license terms. Federal Acquisitions:
004: * Commercial Software -- Government Users Subject to Standard License Terms
005: * and Conditions.
006: *
007: * Sun, Sun Microsystems, the Sun logo, and Sun ONE are trademarks or
008: * registered trademarks of Sun Microsystems, Inc. in the United States
009: * and other countries.
010: */package com.sun.ssoadapter.ab.exchange;
011:
012: import com.sun.addressbook.ABStore;
013: import com.sun.addressbook.ABFilter;
014: import com.sun.addressbook.Group;
015: import com.sun.addressbook.Element;
016:
017: import com.sun.addressbook.ABStoreException;
018: import com.sun.addressbook.OperationNotSupportedException;
019:
020: import com.sun.ssoadapter.ab.pim.JPimAddressBook;
021: import com.sun.ssoadapter.ab.pim.JPimABStore;
022:
023: import com.aligo.pim.interfaces.PimAddressBook;
024:
025: public class ExchangeAddressBook extends JPimAddressBook {
026:
027: private String pimInterfaceType = PIM_WEBDAV;
028:
029: public ExchangeAddressBook(ABStore store, PimAddressBook pBook,
030: String abID) {
031: super (store, pBook, abID);
032: jPimStore = (JPimABStore) store;
033: String tmp = jPimStore.getSession().getProperty(
034: PIM_INTERFACE_TYPE);
035: if ((tmp != null) && (tmp.equals(PIM_CDO))) {
036: pimInterfaceType = PIM_CDO;
037: }
038: }
039:
040: /**
041: * add
042: */
043: public void add(Element element) throws ABStoreException,
044: OperationNotSupportedException {
045: System.out.println("In Exchange add : element type = "
046: + element.getElementType() + ", piminterfaceType = "
047: + pimInterfaceType);
048: if (element.getElementType() == Element.GROUP) {
049: // Groups not supported in CDO
050: if (pimInterfaceType.equals(PIM_CDO)) {
051: String msg = "Exchange CDO Container does not support groups";
052: System.out
053: .println("ExchangeAddressBook.add() : Throwing OperationNotSupportedException");
054: throw new OperationNotSupportedException(msg);
055: } else {
056: // Else .. Call the super method which supports Groups
057: super .add(element);
058: }
059: } else {
060: // Else .. Call the super method which supports Entries
061: super .add(element);
062: }
063: }
064:
065: /**
066: * modify
067: */
068:
069: public void modify(Element oldElement, Element newElement)
070: throws ABStoreException, OperationNotSupportedException {
071: if (newElement.getElementType() == Element.GROUP) {
072: if (pimInterfaceType.equals(PIM_CDO)) {
073: // Groups not supported in CDO
074: String msg = "Exchange CDO Container does not support groups";
075: System.out
076: .println("ExchangeAddressBook.modify() : Throwing OperationNotSupportedException");
077: throw new OperationNotSupportedException(msg);
078: } else {
079: // Else .. Call the super method which supports Groups
080: super .modify(oldElement, newElement);
081: }
082: } else {
083: // Else .. Call the super method which supports Entries
084: super .modify(oldElement, newElement);
085: }
086: }
087:
088: public Element[] fetchGroupMembers(ABFilter filter, Group group)
089: throws ABStoreException, OperationNotSupportedException {
090: if (pimInterfaceType.equals(PIM_CDO)) {
091: // Groups not supported in CDO
092: String msg = "Exchange CDO Container does not support groups";
093: throw new OperationNotSupportedException(msg);
094: } else {
095: // Else .. Call the super method which supports Groups
096: return super .fetchGroupMembers(filter, group);
097: }
098:
099: }
100:
101: public void addGroupMember(Element element, Group group)
102: throws ABStoreException, OperationNotSupportedException {
103: if (pimInterfaceType.equals(PIM_CDO)) {
104: // Groups not supported in CDO
105: String msg = "Exchange CDO Container does not support groups";
106: System.out
107: .println("ExchangeAddressBook.addGroupMember() : Throwing OperationNotSupportedException");
108: throw new OperationNotSupportedException(msg);
109: } else {
110: // Else .. Call the super method which supports Groups
111: super .addGroupMember(element, group);
112: }
113:
114: }
115:
116: public void deleteGroupMember(Element element, Group group)
117: throws ABStoreException, OperationNotSupportedException {
118: if (pimInterfaceType.equals(PIM_CDO)) {
119: // Groups not supported in CDO
120: String msg = "Exchange CDO Container does not support groups";
121: System.out
122: .println("ExchangeAddressBook.deleteGroupMember() : Throwing OperationNotSupportedException");
123: throw new OperationNotSupportedException(msg);
124: } else {
125: // Else .. Call the super method which supports Groups
126: super.deleteGroupMember(element, group);
127: }
128: }
129:
130: }
|