forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathliferay-service-builder_3_5_0.dtd
281 lines (227 loc) · 8.06 KB
/
liferay-service-builder_3_5_0.dtd
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
<!--
<!DOCTYPE service-builder PUBLIC
"-//Liferay//DTD Service Builder 3.5.0//EN"
"http://www.liferay.com/dtd/liferay-service-builder_3_5_0.dtd">
-->
<!--
The service-builder element is the root of the deployment descriptor for
a Service Builder descriptor that is used to generate services available to
portlets. The Service Builder saves the developer time by generating EJBs,
Spring utilities, SOAP utilities, and Hibernate persistence classes to ease the
development of services.
To run the service generator, go to /portal/portal-ejb (or /ext/ext-ejb) and
type "ant build-service". The ant task will check for the existence of a file
called "service.xml" that must exist in your current directory. It will parse
that file to generate the service.
-->
<!ELEMENT service-builder (portlet, entity+, exceptions?)>
<!--
The root-dir value specifies the root directory of the portal source code. If
you are running the service builder in /portal/portal-ejb or /ext/ext-ejb, then
the value is just ".." because the root is /portal or /ext.
The package-dir value specifies the package of the generated code. If the value
is "com.liferay.portlet", then all generated code will fall inside
"com.liferay.portlet" + the shortened portlet name. The portlet name is
specified in the portlet element. For example, if the portlet name is
"Message Boards", the generated code will fall under
"com.liferay.portlet.messageboards".
-->
<!ATTLIST service-builder
root-dir CDATA #REQUIRED
package-dir CDATA #REQUIRED
>
<!--
The portlet element specifies the portlet that the generated services are
designed for. Services are not limited to the specified portlet but are only
grouped by portlet for easier maintenance.
-->
<!ELEMENT portlet (#PCDATA)>
<!--
The name can be something like "Message Boards". It is used by the Service
Builder in combination with the package-dir attribute.
The short-name can be something like "MB". This is used as a namespace to
distinguish all the generated objects.
-->
<!ATTLIST portlet
name CDATA #REQUIRED
short-name CDATA #REQUIRED
>
<!--
An entity usually represents a business facade and a table in the database. If
an entity does not have any columns, then it only represents a business facade.
The Service Builder will always generate an empty business facade POJO if it
does not exist. Upon subsequent generations, the Service Builder will check to
see if the business facade already exists. If it exists and has additional
methods, then the Service Builder will also update the EJB and SOAP wrappers.
If an entity does have columns, then the value object, the POJO class that
is mapped to the database, and other persistence utilities are also generated
based on the order and finder elements.
-->
<!ELEMENT entity (column*, order?, finder*, reference*)>
<!--
The name value specifies the name of the entity.
If the local-service is true, then the service will generate the local
interfaces for the service as well as the remote interfaces.
If persistence-class specifies the name of your custom persistence class.
This class must extend the generated persistence class. By extending the
generated persistence class, you can add custom logic without modifying the
generated class. You can also specify this value in portal.properties at
runtime.
-->
<!ATTLIST entity
name CDATA #REQUIRED
local-service CDATA #IMPLIED
persistence-class CDATA #IMPLIED
>
<!--
The column element represents a column in the database.
-->
<!ELEMENT column (#PCDATA)>
<!--
The name value specifies the getter and setter name in the entity.
The type value specifies whether the column is a String, Boolean, or int, etc.
For example:
<column name="companyId" type="String" />
The above column specifies that there will be a getter called
pojo.getCompanyId() that will return a String.
If the primary value is set to true, then this column is part of the primary key
of the entity. If multiple columns have the primary value set to true, then a
compound key will be created.
See com.liferay.portal.service.persistence.LayoutPK for an example of a compound
primary key.
If the entity and mapping-key attributes are specified and mapping-table is not,
then the Service Builder will assume you are specifying a one to many
relationship.
For example:
<column
name="shoppingItemPrices"
type="Collection"
entity="ShoppingItemPrice"
mapping-key="itemId"
/>
The above column specifies that there will be a getter called
pojo.getShoppingItemPrices() that will return a collection. It will map to a
column called itemId in the table that maps to the entity ShoppingItemPrice.
If the entity and mapping-table attributes are specified and mapping-key is not,
then the Service Builder will assume you are specifying a many to many
relationship.
For example:
<column
name="roles"
type="Collection"
entity="Role"
mapping-table="Groups_Roles"
/>
The above column specifies that there will be a getter called
pojo.getRoles() that will return a collection. It will use a mapping table
called Groups_Roles to give a many to many relationship between groups and
roles.
-->
<!ATTLIST column
name CDATA #REQUIRED
type CDATA #REQUIRED
primary CDATA #IMPLIED
entity CDATA #IMPLIED
mapping-key CDATA #IMPLIED
mapping-table CDATA #IMPLIED
>
<!--
The order element specifies a default ordering and sorting of the entities when
they are retrieved from the database.
-->
<!ELEMENT order (order-column+)>
<!--
Set the by attribute to "asc" or "desc" to order by ascending or descending.
-->
<!ATTLIST order
by CDATA #IMPLIED
>
<!--
The order-column element allows you to order the entities by specific columns.
-->
<!ELEMENT order-column (#PCDATA)>
<!--
The attributes of the order-column element allows you to fine tune the ordering
of the entity.
For example:
<order by="asc">
<order-column name="parentLayoutId" />
<order-column name="priority" />
</order>
The above settings will order by parentLayoutId and then by priority in an
ascending manner.
For example:
<order by="asc">
<order-column name="name" case-sensitive="false" />
</order>
The above settings will order by name and will not be case sensitive.
For example:
<order>
<order-column name="articleId" order-by="asc" />
<order-column name="version" order-by="desc" />
</order>
The above settings will order by articleId in an ascending manner and then by
version in a descending manner.
-->
<!ATTLIST order-column
name CDATA #REQUIRED
case-sensitive CDATA #IMPLIED
order-by CDATA #IMPLIED
>
<!--
The finder element represents a generated finder method.
-->
<!ELEMENT finder (finder-column+)>
<!--
-->
<!ATTLIST finder
name CDATA #REQUIRED
return-type CDATA #REQUIRED
where CDATA #IMPLIED
db-index CDATA #IMPLIED
>
<!--
The finder-column element specifies the columns to find by.
-->
<!ELEMENT finder-column (#PCDATA)>
<!--
The name value specifies the name of the finder method.
For example:
<finder name="CompanyId" return-type="Collection">
<finder-column name="companyId" />
</finder>
The above settings will create a finder with the name findByCompanyId that will
return a Collection and require a given companyId. It will also generate
several more findByCompanyId methods that take in pagination fields (int begin,
int end) and more sorting options. The easiest way to understand this is to
look at a generated Persistence class. The Service Builder will also generate
removeByCompanyId and countByCompanyId.
See com.liferay.portal.service.persistence.LayoutPersistence for a good example.
The attribute check-array is deprecated and will be removed in the next release.
-->
<!ATTLIST finder-column
name CDATA #REQUIRED
check-array CDATA #IMPLIED
>
<!--
The reference element will automatically populate the ejb-jar.xml and other
required XML files with the proper reference from one service to another
service.
-->
<!ELEMENT reference (#PCDATA)>
<!--
See the comments in reference element.
-->
<!ATTLIST reference
package-path CDATA #REQUIRED
entity CDATA #REQUIRED
>
<!--
The exceptions element contain a list of generated exceptions. This doesn't save
a lot of typing, but can still be helpful.
-->
<!ELEMENT exceptions (exception*)>
<!--
See the comments in exceptions element.
-->
<!ELEMENT exception (#PCDATA)>