001: /*
002: *
003: * Copyright 2000 Sun Microsystems, Inc. All rights reserved.
004: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
005: */
006:
007: package com.sun.portal.comm.url;
008:
009: import com.sun.comclient.calendar.CalendarStoreException;
010: import com.sun.comclient.calendar.CalendarStore;
011:
012: import com.sun.ssoadapter.SSOAdapter;
013:
014: import java.io.BufferedReader;
015: import java.io.InputStreamReader;
016: import java.io.IOException;
017:
018: import java.net.URLConnection;
019: import java.net.MalformedURLException;
020: import java.net.URL;
021: import java.net.URLEncoder;
022: import com.sun.comclient.calendar.DateTime;
023:
024: public class ExchangeCalURLBuilder extends URLBuilder implements CalURL {
025:
026: private String calid = null;
027:
028: /**
029: * Call prior init functions and set the path to the notes operation
030: *
031: * @param SSOAdapter ssoadapter used to init everything
032: */
033: public void init(SSOAdapter ssoAdapter) {
034: super .init(ssoAdapter);
035: setPath(adapterProperties.getProperty("exchangeContextPath",
036: "/exchange"));
037:
038: }
039:
040: /**
041: * Return URL string for calendar client.
042: *
043: * @return String Client start URL
044: */
045: public String getStartURL() {
046: StringBuffer startURL = new StringBuffer(getBaseURL());
047: startURL.append(getPath());
048: String exchangeOperation = adapterProperties
049: .getProperty("exchangeOperation");
050: if (exchangeOperation != null) {
051: startURL.append('/');
052: startURL.append(encode(user));
053: startURL.append('/');
054: startURL.append(encode(exchangeOperation));
055: }
056: return startURL.toString();
057: }
058:
059: /**
060: * Sets the calendar id
061: *
062: * @param String Calendar ID
063: */
064: public void setCalid(String calid) {
065: this .calid = calid;
066: }
067:
068: /**
069: * Return the calendar id
070: *
071: * @return String Calendar ID
072: */
073: public String getCalid() {
074: return calid;
075: }
076:
077: /**
078: * Lets invoking classes know if multiple view urls are available
079: * in this URLBuilder.
080: *
081: * @return boolean Are view URLs available
082: */
083: public boolean allowsViewURL() {
084: return false;
085: }
086:
087: /**
088: * Return URL string for specific view to be opened in cal client.
089: *
090: * @param String View
091: * @param String Date
092: * @return String View URL string
093: */
094: public String getViewURL(String view, String date) {
095: return getStartURL();
096: }
097:
098: /**
099: * Lets invoking classes know if task URLs are available
100: * in this URLBuilder.
101: *
102: * @return boolean Are task URLs available
103: */
104: public boolean allowsTaskURL() {
105: return false;
106: }
107:
108: /**
109: * Return URL string for specific task to be opened in cal client.
110: *
111: * @param Object Task Object
112: * @return String Task URL string
113: */
114: public String getTaskURL(Object task) {
115: return getStartURL();
116: }
117:
118: /**
119: * Lets invoking classes know if event URLs are available
120: * in this URLBuilder.
121: *
122: * @return boolean Are event URLs available
123: */
124: public boolean allowsEventURL() {
125: return false;
126: }
127:
128: /**
129: * Return URL string for specific event to be opened in cal client.
130: *
131: * @param Object Event Object
132: * @return String Event URL string
133: */
134: public String getEventURL(Object event) {
135: return getStartURL();
136: }
137:
138: /**
139: * Lets invoking clasess know is composeEvent is available
140: * in this URLBuilder
141: * @return boolean , is composeEvent available
142: */
143: public boolean allowsComposeEventURL() {
144: return false;
145: }
146:
147: /**
148: * Lets invoking clasess know is composeTask is available
149: * in this URLBuilder
150: * @return boolean , is composeTask available
151: */
152: public boolean allowsComposeTaskURL() {
153: return false;
154: }
155:
156: /**
157: * Return URL string to open the client's composeEvent window.
158: *
159: * @param String Subject of the event
160: * @param DateTime the DateTimeat which event should be created
161: * @return String Composition URL string
162: */
163: public String getComposeEventURL(DateTime datetime) {
164: return getStartURL();
165: }
166:
167: /**
168: * Return URL string to open the client's composeTask window.
169: *
170: * @param String Subject of the task
171: * @param DateTime the DateTimeat which event should be created
172: * @return String Composition URL string
173: */
174: public String getComposeTaskURL(DateTime datetime) {
175: return getStartURL();
176:
177: }
178:
179: }
|