Skip to main content
summaryrefslogtreecommitdiffstats
blob: e2ceffa7816446598a427f48880b4d11055569e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<%
/*******************************************************************************
 * Copyright (c) 2002, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
%>
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.*,
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.util.*,
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.*,
                                                        org.eclipse.wst.ws.internal.explorer.platform.perspective.*,
                                                        org.eclipse.emf.common.util.EList,
                                                        org.eclipse.xsd.*,
                                                        java.util.*" %>

<jsp:useBean id="sessionID" class="java.lang.StringBuffer" scope="request"/>
<jsp:useBean id="fragID" class="java.lang.StringBuffer" scope="request"/>
<jsp:useBean id="nodeID" class="java.lang.StringBuffer" scope="request"/>
<%
HttpSession currentSession = (HttpSession)application.getAttribute(sessionID.toString());
Controller controller = (Controller)currentSession.getAttribute("controller");
WSDLPerspective wsdlPerspective = controller.getWSDLPerspective();
Node selectedNode = wsdlPerspective.getNodeManager().getNode(Integer.parseInt(nodeID.toString()));
WSDLOperationElement operElement = (WSDLOperationElement)selectedNode.getTreeElement();
IXSDFragment frag = operElement.getFragmentByID(fragID.toString());
XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition)frag.getXSDToFragmentConfiguration().getXSDComponent();

int minLength = -1;
int maxLength = -1;
Vector patternVector = new Vector();
String whiteSpace = null;
boolean minExclusive = true;
Object min = null;
boolean maxExclusive = true;
Object max = null;
int totalDigits = -1;
int fractionDigits = -1;

XSDSimpleTypeDefinition currType = simpleType;
while (!XSDTypeDefinitionUtil.isRootTypeDefinition(currType)) {
  // minLength
  if (minLength < 0) {
    XSDLengthFacet xsdLengthFacet = currType.getLengthFacet();
    XSDMinLengthFacet xsdMinLengthFacet = currType.getMinLengthFacet();
    // port to org.eclipse.xsd
    if (xsdLengthFacet != null)
      minLength = xsdLengthFacet.getValue();
    else if (xsdMinLengthFacet != null)
      minLength = xsdMinLengthFacet.getValue();
  }
  // maxLength
  if (maxLength < 0) {
    XSDLengthFacet xsdLengthFacet = currType.getLengthFacet();
    XSDMaxLengthFacet xsdMaxLengthFacet = currType.getMaxLengthFacet();
    // port to org.eclipse.xsd
    if (xsdLengthFacet != null)
      maxLength = xsdLengthFacet.getValue();
    else if (xsdMaxLengthFacet != null)
      maxLength = xsdMaxLengthFacet.getValue();
  }
  // patternVector
  EList xsdPatternFacets = currType.getPatternFacets();
  if (xsdPatternFacets != null) {
    for (int i = 0; i < xsdPatternFacets.size(); i++) {
      XSDPatternFacet xsdPatternFacet = (XSDPatternFacet)xsdPatternFacets.get(i);
      EList patterns = xsdPatternFacet.getValue();
      for (int j = 0; j < patterns.size(); j++) {
        patternVector.add(patterns.get(j));
      }
    }
  }
  // whiteSpace
  if (whiteSpace == null) {
    XSDWhiteSpaceFacet xsdWhiteSpaceFacet = currType.getWhiteSpaceFacet();
    // port to org.eclipse.xsd
    if (xsdWhiteSpaceFacet != null)
      whiteSpace = xsdWhiteSpaceFacet.getValue().getName();
  }
  // min in/exclusive
  if (min == null ) {
    XSDMinExclusiveFacet xsdMinExclusiveFacet = currType.getMinExclusiveFacet();
    XSDMinInclusiveFacet xsdMinInclusiveFacet = currType.getMinInclusiveFacet();
    if (xsdMinExclusiveFacet != null) {
      min = xsdMinExclusiveFacet.getValue();
      minExclusive = true;
    }
    else if (xsdMinInclusiveFacet != null) {
      min = xsdMinInclusiveFacet.getValue();
      minExclusive = false;
    }
  }
  // max in/exclusive
  if (max == null) {
    XSDMaxExclusiveFacet xsdMaxExclusiveFacet = currType.getMaxExclusiveFacet();
    XSDMaxInclusiveFacet xsdMaxInclusiveFacet = currType.getMaxInclusiveFacet();
    if (xsdMaxExclusiveFacet != null) {
      max = xsdMaxExclusiveFacet.getValue();
      maxExclusive = true;
    }
    else if (xsdMaxInclusiveFacet != null) {
      max = xsdMaxInclusiveFacet.getValue();
      maxExclusive = false;
    }
  }
  // totalDigits
  if (totalDigits < 0) {
    XSDTotalDigitsFacet xsdTotalDigitsFacet = currType.getTotalDigitsFacet();
    if (xsdTotalDigitsFacet != null)
      totalDigits = xsdTotalDigitsFacet.getValue();
  }
  // fractionDigits
  if (fractionDigits < 0) {
    XSDFractionDigitsFacet xsdFractionDigitsFacet = currType.getFractionDigitsFacet();
    if (xsdFractionDigitsFacet != null)
      fractionDigits = xsdFractionDigitsFacet.getValue();
  }
  // walk to base type
  currType = currType.getBaseTypeDefinition();
}
%>

<jsp:include page="/wsdl/fragment/XSDDefaultInfoFragmentJSP.jsp" flush="true"/>

<table>
  <tr>
    <td height=20>&nbsp;</td>
  </tr>
</table>
<table width="95%" border=0 cellpadding=3 cellspacing=0 class="tableborder">
  <tr>
    <th class="singleheadercolor" height=20 valign="bottom" align="left">
      <%=wsdlPerspective.getMessage("FORM_LABEL_BASE_TYPE")%>
    </th>
  </tr>
  <tr>
    <td class="tablecells">
      <%=XSDTypeDefinitionUtil.resolveToXSDBuiltInTypeDefinition(simpleType).getName()%>
    </td>
  </tr>
</table>

<%
String minLengthString = (minLength < 0) ? wsdlPerspective.getMessage("FORM_LABEL_UNBOUNDED") : String.valueOf(minLength);
String maxLengthString = (maxLength < 0) ? wsdlPerspective.getMessage("FORM_LABEL_UNBOUNDED") : String.valueOf(maxLength);
String[] lengthValues = {minLengthString, maxLengthString};
if (minLength >= 0 || maxLength >= 0) {
%>
  <table>
    <tr>
      <td height=20>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border=0 cellpadding=3 cellspacing=0 class="tableborder">
    <tr>
      <th class="singleheadercolor" height=20 valign="bottom" align="left">
        <%=wsdlPerspective.getMessage("FORM_LABEL_LENGTH")%>
      </th>
    </tr>
    <tr>
      <td class="tablecells">
        <%=wsdlPerspective.getMessage("FORM_LABEL_LENGTH_VALUE", lengthValues)%>
      </td>
    </tr>
  </table>
<%
}
%>

<%
if (patternVector.size() > 0) {
  String patternContainerID = "::pattern";
  String xpatternContainerID = "x::pattern";
%>
  <table>
    <tr>
      <td height=20>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border=0 cellpadding=3 cellspacing=0>
    <tr>
      <td height=25 valign="bottom" align="left" nowrap width=11>
        <a href="javascript:twist('<%=patternContainerID%>','<%=xpatternContainerID%>')"><img name="<%=xpatternContainerID%>" src="<%=response.encodeURL(controller.getPathWithContext("images/twistopened.gif"))%>" alt="<%=controller.getMessage("ALT_TWIST_OPENED")%>" class="twist"></a>
      </td>
      <td class="labels" height=25 valign="bottom" align="left" nowrap>
       <strong><%=wsdlPerspective.getMessage("FORM_LABEL_PATTERN")%></strong>
      </td>
    </tr>
  </table>
  <span id="<%=patternContainerID%>">
  <table width="95%" border=0 cellpadding=3 cellspacing=0 class="tableborder">
    <tr>
      <th class="singleheadercolor" height=20 valign="bottom" align="left">
        <%=wsdlPerspective.getMessage("FORM_LABEL_PATTERN")%>
      </th>
    </tr>
    <%
    for (int k = 0; k < patternVector.size(); k++) {
    %>
      <tr>
        <td class="tablecells">
          <%=(String)patternVector.get(k)%>
        </td>
      </tr>
    <%
    }
    %>
  </table>
  </span>
<%
}
%>

<%
if (whiteSpace != null) {
%>
  <table>
    <tr>
      <td height=20>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border=0 cellpadding=3 cellspacing=0 class="tableborder">
    <tr>
      <th class="singleheadercolor" height=20 valign="bottom" align="left">
        <%=wsdlPerspective.getMessage("FORM_LABEL_WHITESPACE")%>
      </th>
    </tr>
    <tr>
      <td class="tablecells">
        <%=whiteSpace%>
      </td>
    </tr>
  </table>
<%
}
%>

<%
String lowerBound;
if (minExclusive)
  lowerBound = wsdlPerspective.getMessage("FORM_LABEL_MIN_EXCLUSIVE", (min == null) ? wsdlPerspective.getMessage("FORM_LABEL_UNBOUNDED") : min.toString());
else
  lowerBound = wsdlPerspective.getMessage("FORM_LABEL_MIN_INCLUSIVE", (min == null) ? wsdlPerspective.getMessage("FORM_LABEL_UNBOUNDED") : min.toString());
String upperBound;
if (maxExclusive)
  upperBound = wsdlPerspective.getMessage("FORM_LABEL_MAX_EXCLUSIVE", (max == null) ? wsdlPerspective.getMessage("FORM_LABEL_UNBOUNDED") : max.toString());
else
  upperBound = wsdlPerspective.getMessage("FORM_LABEL_MAX_INCLUSIVE", (max == null) ? wsdlPerspective.getMessage("FORM_LABEL_UNBOUNDED") : max.toString());
if (min != null || max != null) {
%>
  <table>
    <tr>
      <td height=20>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border=0 cellpadding=3 cellspacing=0 class="tableborder">
    <tr>
      <th class="singleheadercolor" height=20 valign="bottom" align="left">
        <%=wsdlPerspective.getMessage("FORM_LABEL_RANGE_OF_VALUES")%>
      </th>
    </tr>
    <tr>
      <td class="tablecells">
        <%=lowerBound + upperBound%>
      </td>
    </tr>
  </table>
<%
}
%>

<%
if (totalDigits >= 0) {
%>
  <table>
    <tr>
      <td height=20>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border=0 cellpadding=3 cellspacing=0 class="tableborder">
    <tr>
      <th class="singleheadercolor" height=20 valign="bottom" align="left">
        <%=wsdlPerspective.getMessage("FORM_LABEL_TOTAL_DIGITS")%>
      </th>
    </tr>
    <tr>
      <td class="tablecells">
        <%=totalDigits%>
      </td>
    </tr>
  </table>
<%
}
%>

<%
if (fractionDigits >= 0) {
%>
  <table>
    <tr>
      <td height=20>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border=0 cellpadding=3 cellspacing=0 class="tableborder">
    <tr>
      <th class="singleheadercolor" height=20 valign="bottom" align="left">
        <%=wsdlPerspective.getMessage("FORM_LABEL_FRACTION_DIGITS")%>
      </th>
    </tr>
    <tr>
      <td class="tablecells">
        <%=fractionDigits%>
      </td>
    </tr>
  </table>
<%
}
%>

Back to the top