Troubleshooting: Custom methods and handlers not supported while migrating Management Center
Custom methods and handlers in OpenLaszlo (.lzx) files cannot be migrated when migrating the Management Center from WebSphere Commerce Version 7 or from WebSphere Commerce Version 7 Feature Pack 1 to a higher feature pack version.
Problem
You can see the following information in the enable Feature Pack 2 Management Center log:
runPortUtility:
........
WARNING: method init cannot be promoted in file C:\IBM\WCDE_P~1\components\management-center\backup\LOBToolsCustom\WebContent\WEB-INF\src\lzx\commerce\catalog\propertiesViews\CatalogPropertyPane.lzx
.........
Custom methods and handlers in OpenLaszlo files
are not supported when migrating Management Center using the port
utility.Solution
The original IBM code does not use any of the following tags in classes within OpenLaszlo files since they are difficult to migrate:- method
- handler
- setter
- state
- attribute
Example
The following code
snippet shows a class within the
LOBTools\WebContent\WEB-INF\src\lzx\commerce\catalog\propertiesViews\CatalogPropertyPane.lzx
file
that is customized by adding a new init method:
<class extends="wcfPropertyGroup" groupTitle="${catalogResources.generalProductInformationSection.string}"
name="catManageGeneralProductInformation" open="true">
<method name="init">
<![CDATA[
super.init();
this.content.yspacing = 200;
]]>
</method>
<!-- Property: Code. An input box for the code property. -->
<wcfPropertyInputText
extendedHelpText="${catalogResources.extendedHelpText_Code.string}"
promptText="${catalogResources.codePrompt.string}"
propertyName="partnumber" required="true"/>
<!-- Property: Name. An input box for the name property. -->
...................
</class>
After you install WebSphere Commerce
Version 7 Feature Pack 2 and enable the Management Center feature,
this OpenLaszlo (.lzx) file is converted to a definition (.def) file:
LOBTools\WebContent\config\commerce\catalog\propertiesViews\CatalogPropertyPane.def
.
The custom init method is lost during this conversion:
<PropertyGroup definitionName="catManageGeneralProductInformation" groupTitle="${catalogResources.generalProductInformationSection}" open="true">
<!-- Property: Code. An input box for the code property. -->
<PropertyInputText extendedHelpText="${catalogResources.extendedHelpText_Code}" promptText="${catalogResources.codePrompt}" propertyName="partnumber" required="true"/>
<!-- Property: Name. An input box for the name property. -->
...................
</PropertyGroup>
To recover your customization:
- Create the LOBTools\WebContent\WEB-INF\src\lzx\mycompany\catalog\propertiesViews\extCatalogPropertyPane.lzx file.
-
Add the following code to the extCatalogPropertyPane.lzx file:
<library> <class extends="wcfPropertyGroup" groupTitle="${catalogResources.generalProductInformationSection.string}" name="extPropertyGroup" open="true"> <method name="init"> <![CDATA[ super.init(); this.content.yspacing = 200; ]]> </method> </class> </library>
-
Register the extCatalogPropertyPane.lzx file by adding the highlighted
line to the
LOBTools\WebContent\WEB-INF\src\lzx\commerce\catalog\CatalogExtensionsLibrary.lzx
file:
<library> ........... <include href="../../mycompany/catalog/propertiesViews/extCatalogPropertyPane.lzx"/> </library>
-
In the
LOBTools\WebContent\config\commerce\catalog\propertiesViews\CatalogPropertyPane.def
file,
change:
to:<PropertyGroup baseDefinitionName="catManageGeneralProductInformation"/>
<PropertyGroup baseDefinitionName="catManageGeneralProductInformation" package="ext"/>
- Save your changes.
- Right-click LOBTools Project ; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory. This is the default environment setting.