1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.wsrp;
21  
22  import org.apache.wsrp4j.consumer.URLGenerator;
23  import org.apache.wsrp4j.consumer.URLTemplateComposer;
24  
25  /**
26   * <a href="URLTemplateComposerImpl.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Michael Young
29   *
30   */
31  public class URLTemplateComposerImpl implements URLTemplateComposer {
32  
33      public static URLTemplateComposer getInstance() {
34          if (_instance == null) {
35              _instance = new URLTemplateComposerImpl();
36          }
37  
38          return _instance;
39      }
40  
41      private URLTemplateComposerImpl() {
42      }
43  
44      /**
45       * Sets the url generator to be used.
46       */
47      public void setURLGenerator(URLGenerator urlGenerator) {
48          this._urlGenerator = urlGenerator;
49      }
50  
51      public String createBlockingActionTemplate(boolean includePortletHandle,
52              boolean includeUserContextKey, boolean includePortletInstanceKey,
53              boolean includeSessionID) {
54  
55          String template = null;
56  
57          //TODO: Template processing Pluto case
58  
59          return template;
60      }
61  
62      public String createSecureBlockingActionTemplate(
63              boolean includePortletHandle, boolean includeUserContextKey,
64              boolean includePortletInstanceKey, boolean includeSessionID) {
65  
66          String template = null;
67  
68          //TODO: Template processing Pluto case
69          /*
70           *
71           * if (this.urlGenerator != null) { template = createTemplate(
72           * urlGenerator.getBlockingActionURL(null), false, true, true, true,
73           * true, true, false, false, includePortletHandle,
74           * includeUserContextKey, includePortletInstanceKey, includeSessionID); }
75           */
76          return template;
77      }
78  
79      public String createRenderTemplate(boolean includePortletHandle,
80              boolean includeUserContextKey, boolean includePortletInstanceKey,
81              boolean includeSessionID) {
82  
83          String template = null;
84  
85          //TODO: Template processing Pluto case
86  
87          return template;
88      }
89  
90      public String createSecureRenderTemplate(boolean includePortletHandle,
91              boolean includeUserContextKey, boolean includePortletInstanceKey,
92              boolean includeSessionID) {
93  
94          String template = null;
95  
96          //TODO: Template processing Pluto case
97  
98          return template;
99      }
100 
101     public String createResourceTemplate(boolean includePortletHandle,
102             boolean includeUserContextKey, boolean includePortletInstanceKey,
103             boolean includeSessionID) {
104 
105         String template = null;
106 
107         //TODO: Template processing Pluto case
108 
109         return template;
110     }
111 
112     public String createSecureResourceTemplate(boolean includePortletHandle,
113             boolean includeUserContextKey, boolean includePortletInstanceKey,
114             boolean includeSessionID) {
115 
116         String template = null;
117 
118         //TODO: Template processing Pluto case
119 
120         return template;
121     }
122 
123     public String createDefaultTemplate(boolean includePortletHandle,
124             boolean includeUserContextKey, boolean includePortletInstanceKey,
125             boolean includeSessionID) {
126 
127         String template = null;
128 
129         //TODO: Template processing Pluto case
130 
131         return template;
132     }
133 
134     public String createSecureDefaultTemplate(boolean includePortletHandle,
135             boolean includeUserContextKey, boolean includePortletInstanceKey,
136             boolean includeSessionID) {
137 
138         String template = null;
139 
140         //TODO: Template processing Pluto case
141 
142         return template;
143     }
144 
145     public String getNamespacePrefix() {
146         return _urlGenerator.getNamespacedToken("");
147     }
148 
149     private static URLTemplateComposer _instance = null;
150 
151     private URLGenerator _urlGenerator = null;
152 
153 }