Details
-
Type:
Feature Request
-
Status:
Contributed Solution
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 6.1.0 CE RC1
-
Fix Version/s: None
-
Component/s: Tools, Tools > Service Builder
-
Labels:None
-
Environment:At revision 70596
-
Branch Version/s:6.0.x
-
Liferay Contributor's Agreement:Accept
-
Similar Issues:
Description
applying convert-null element to service generator
LEP-1353: Add convert-null element to service generator
Service generator currently converts null strings to "". Add this tag to <column convert-null="false" to make it optional. Defaults to true to keep existing behavior.
That's cool!
The Service-Builder should be able to apply convert-null element on data type like "int", "Integer", "long", "short" etc.

Example:
<?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">
<service-builder package-path="com.liferay.sampleservicebuilder">
<namespace>SSB</namespace>
<entity name="Foo" uuid="true" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="fooId" type="long" primary="true" />
<!-- Group instance -->
<column name="groupId" type="long" />
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<!-- Other fields -->
<column name="field0" type="Integer" convert-null="false" />
<column name="field1" type="String" />
<column name="field2" type="boolean" />
<column name="field3" type="int" />
<column name="field4" type="Date" />
<column name="field5" type="String" />
<column name="field6" type="long" convert-null="false" />
<column name="field7" type="long" convert-null="true" />
<column name="field8" type="short" convert-null="false" />
<column name="field9" type="short" convert-null="true" />
<column name="fieldA" type="int" convert-null="false" />
<!-- Order -->
<order by="asc">
<order-column name="field1" />
</order>
<!-- Finder methods -->
<finder name="Field2" return-type="Collection">
<finder-column name="field2" />
</finder>
<!-- References -->
<reference package-path="com.liferay.portlet.asset" entity="AssetEntry" />
<reference package-path="com.liferay.portlet.asset" entity="AssetTag" />
</entity>
</service-builder>
Default values of "fieldA", "field8", "field6", and "field0" should be NULL instead of 0.
By the way, a fix patch will be provided here shortly.