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