Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-83

ServiceBuilder does not handle entity parameters in method correctly for Soap file generation

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Expired
    • Affects Version/s: 5.2.0
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Windows XP

      Description

      If a service method call passes as its arguments entities which are outside the scope of the current object, the parameters passed to the Soap method are not constructed correctly.

      Example:

      import com.liferay.portal.model.User;
      import com.liferay.portal.model.Group;

      public class com.ext.portlet.foo.ObjectLocalServiceImpl {
      public void myServiceMethod( User user, Group group ) {
      }
      }

      is generated by the ServiceBuilder as:

      public static com.ext.portlet.foo.model.ObjectSoap myServiceMethod(
      com.liferay.portal.model.UserSoap user,
      com.liferay.portal.model.GroupSoap group) throws RemoteException {
      try

      { com.ext.portlet.foo.model.Object returnValue = ObjectServiceUtil.myServiceMethod( * com.liferay.portal.model.impl.GroupModelImpl.toModel(user), * com.liferay.portal.model.impl.GroupModelImpl.toModel(group)); return com.ext.portlet.foo.model.ObjectSoap.toSoapModel(returnValue); }

      catch (Exception e)

      { _log.error(e, e); throw new RemoteException(e.getMessage()); }

      }

      The two lines above should be generating as:
      com.liferay.portal.model.impl.UserModelImpl.toModel(user),
      com.liferay.portal.model.impl.GroupModelImpl.toModel(group));

      The fix comes in the file portal-impl/src/com/liferay/portal/tools/servicebuilder/dependencies/service_soap.ftl.

      The lines which appear (around line 130) as:
      <#elseif (parameter.type.value == "java.util.List") && serviceBuilder.hasEntityByGenericsName(parameter.genericsName)>
      $

      {parameterEntity.packagePath}.model.impl.${parameterEntity.name}ModelImpl.toModels(
      <#elseif serviceBuilder.hasEntityByParameterTypeValue(parameter.type.value)>
      ${parameterEntity.packagePath}

      .model.impl.$

      {parameterEntity.name}ModelImpl.toModel(

      should appear as:

      <#elseif (parameter.type.value == "java.util.List") && serviceBuilder.hasEntityByGenericsName(parameter.genericsName)>
      <#assign parameterEntity = serviceBuilder.getEntityByGenericsName(parameter.genericsName)>
      ${parameterEntity.packagePath}.model.impl.${parameterEntity.name}

      ModelImpl.toModels(
      <#elseif serviceBuilder.hasEntityByParameterTypeValue(parameter.type.value)>
      <#assign parameterEntity = serviceBuilder.getEntityByParameterTypeValue(parameter.type.value)>
      $

      {parameterEntity.packagePath}

      .model.impl.$

      {parameterEntity.name}

      ModelImpl.toModel(

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                9 years, 2 weeks, 2 days ago