|
Modified: ofbiz/branches/20120329_portletWidget/framework/common/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/common/widget/CommonScreens.xml?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/common/widget/CommonScreens.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/common/widget/CommonScreens.xml Sat Aug 4 18:11:00 2012 @@ -150,7 +150,6 @@ under the License. <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/validate/jquery.validate.min.js" global="true" /> <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/fjTimer/jquerytimer-min.js" global="true" /> <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/development-bundle/ui/jquery.ui.datepicker.js" global="true" /> - <set field="layoutSettings.javaScripts[+0]" value="/images/portlet.js" global="true"/><!--#Eam# portletWidget --> <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.7.2.min.js" global="true" /> <!-- jQuery CSSs --> <set field="layoutSettings.styleSheets[+0]" value="/images/jquery/plugins/asmselect/jquery.asmselect-1.0.4a-beta.css" global="true" /> @@ -185,10 +184,6 @@ under the License. <set field="appbarOpenTemplateLocation" from-field="layoutSettings.VT_NAV_OPEN_TMPLT[0]" /> <set field="appbarCloseTemplateLocation" from-field="layoutSettings.VT_NAV_CLOSE_TMPLT[0]" /> <set field="messagesTemplateLocation" from-field="layoutSettings.VT_MSG_TMPLT_LOC[0]" /> - <!--#Bam# icons-purpose--> - <set field="iconsPurposeProp" from-field="layoutSettings.VT_ICONS_PURP[0]" default-value="iconsPurpose"/> - <property-map resource="${iconsPurposeProp}" map-name="iconsPurpose" global="true" /> - <!--#Eam# icons-purpose--> <set field="layoutSettings.suppressTab" value="ofbizsetup"/><!-- diseable ofbiz setup by default --> </actions> <widgets /> @@ -392,10 +387,6 @@ under the License. <set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true"/> <set field="messagesTemplateLocation" from-field="layoutSettings.VT_MSG_TMPLT_LOC[0]" default-value="component://common/webcommon/includes/messages.ftl"/> - <!--#Bam# icons-purpose--> - <set field="iconsPurposeProp" from-field="layoutSettings.VT_ICONS_PURP[0]" default-value="iconsPurpose"/> - <property-map resource="${iconsPurposeProp}" map-name="iconsPurpose" global="true" /> - <!--#Eam# icons-purpose--> </actions> <widgets> <section> @@ -486,7 +477,6 @@ under the License. <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/fjTimer/jquerytimer-min.js" global="true"/> <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/validate/jquery.validate.min.js" global="true"/> <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/development-bundle/ui/jquery.ui.datepicker.js" global="true"/> - <set field="layoutSettings.javaScripts[+0]" value="/images/portlet.js" global="true"/><!--#Eam# portletWidget --> <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.7.2.min.js" global="true"/> <!-- jQuery CSSs --> <set field="layoutSettings.styleSheets[+0]" value="/images/jquery/plugins/asmselect/jquery.asmselect-1.0.4a-beta.css" global="true"/> @@ -501,10 +491,6 @@ under the License. <!-- The settings below are used for xsl-fo screens --> <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/> <set field="logoImageUrl" value="/images/ofbiz_logo.gif"/> - <!--#Bam# icons-purpose--> - <set field="iconsPurposeProp" from-field="layoutSettings.VT_ICONS_PURP[0]" default-value="iconsPurpose"/> - <property-map resource="${iconsPurposeProp}" map-name="iconsPurpose" global="true" /> - <!--#Eam# icons-purpose--> <!--<set field="defaultFontFamily" value="Arial"/>--> </actions> <widgets> @@ -711,71 +697,4 @@ under the License. </widgets> </section> </screen> - - <!--#Bam# portletUiLabelDecorator : manage standard portlet decorator --> - <screen name="uiLabelDecorator"> - <section> - <actions> - <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true" /> - <property-map resource="general" map-name="generalProperties" global="true"/> - <set field="defaultVisualThemeId" from-field="generalProperties.defaultVisualThemeId" default-value="SMOOTH_FEATHER"/> - <set field="visualThemeId" from-field="userPreferences.VISUAL_THEME" default-value="${defaultVisualThemeId}" global="true"/> - <service service-name="getVisualThemeResources"> - <field-map field-name="visualThemeId"/> - <field-map field-name="themeResources" from-field="layoutSettings"/> - </service> - <set field="layoutSettings" from-field="themeResources" default-value="${layoutSettings}" global="true"/> - <set field="iconsLocation" from-field="layoutSettings.VT_ICONS_LOC[0]" default-value="/images/icons/famfamfam" global="true"/> - <set field="iconsPurposeProp" from-field="layoutSettings.VT_ICONS_PURP[0]" default-value="iconsPurpose"/> - <property-map resource="${iconsPurposeProp}" map-name="iconsPurpose" global="true" /> - </actions> - <widgets> - <section> - <condition> - <if-empty field="includedInPage"/> - </condition> - <widgets> - <platform-specific> - <html> - <html-template location="component://common/webcommon/includes/messages.ftl" /> - </html> - </platform-specific> - </widgets> - </section> - </widgets> - </section> - </screen> - - <screen name="portletUiLabelDecorator"> - <section> - <widgets> - <decorator-screen name="uiLabelDecorator" location="${parameters.mainDecoratorLocation}"> - <decorator-section name="body"> - <decorator-section-include name="body" /> - </decorator-section> - </decorator-screen> - </widgets> - </section> - </screen> - <!-- can be use for all portalPage build like exampleMgmt --> - <screen name="ShowCommonDetailPortlet"> - <section> - <actions> - <set field="defaultdetailPortletId" from-field="detailCommonPortletId" from-scope="user" default-value="CommonInfo"/> - <set field="portalPortletId" from-field="parameters.portalPortletId" default-value="${defaultdetailPortletId}"/> - <set field="detailCommonPortletId" from-field="portalPortletId" to-scope="user"/> - <set field="portalPageId" from-field="parameters.portalPageId"/> - <set field="parameters.areaId" value="PP_${portalPageId}CommonDetail00001"/> - <set field="portletSeqId" from-field="parameters.portletSeqId" default-value="00001"/> - </actions> - <widgets> - <decorator-screen name="portletUiLabelDecorator"> - <decorator-section name="body"> - <include-portal-page id="${portalPageId}" portalPortletId="${portalPortletId}" portletSeqId="${portletSeqId}"/> - </decorator-section> - </decorator-screen> - </widgets> - </section> - </screen> - <!--#Eam# portletUiLabelDecorator --> </screens> Propchange: ofbiz/branches/20120329_portletWidget/framework/common/widget/HelpScreens.xml ------------------------------------------------------------------------------ Merged /ofbiz/trunk/framework/common/widget/HelpScreens.xml:r1307080-1307082,1340380-1340445,1340638-1340641,1347751-1347754,1351866,1356000-1369352 Modified: ofbiz/branches/20120329_portletWidget/framework/common/widget/PortalPageForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/common/widget/PortalPageForms.xml?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/common/widget/PortalPageForms.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/common/widget/PortalPageForms.xml Sat Aug 4 18:11:00 2012 @@ -123,18 +123,10 @@ under the License. <field-map field-name="portalPageId" from-field="parameters.portalPageId"/> </entity-and> </actions> - <!--#Bam# exampleHelp --> - <row-actions> - <entity-one entity-name="PortalPortlet" value-field="portlet"></entity-one> - <set field="helpTopicName" from-field="helpName" default-value="HELP_${portalPortletId}"/> - </row-actions> - <field name="portletName" > - <hyperlink also-hidden="false" target="showHelp?helpTopic=${helpTopicName}" description="${portlet.portletName}"></hyperlink> + <field name="portletName"> + <hyperlink also-hidden="false" target="showHelp?helpTopic=HELP_${portalPortletId}" description="${portletName}" ></hyperlink> </field> - <field name="description" title="${uiLabelMap.CommonDescription}"><display description="${portlet.description}"/></field> - <!--#Eam# exampleHelp --> - - + <field name="description"><display/></field> </form> <form name="FindGenericEntity" type="single" target="list${entity}" title="" focus-field-name="idName"> @@ -154,7 +146,6 @@ under the License. <field name="columnSeqId"><hidden/></field> <field name="columnWidthPixels"><text/></field> <field name="columnWidthPercentage"><text/></field> - <field name="newLine"><check/></field> <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field> </form> </forms> Modified: ofbiz/branches/20120329_portletWidget/framework/common/widget/PortalPageScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/common/widget/PortalPageScreens.xml?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/common/widget/PortalPageScreens.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/common/widget/PortalPageScreens.xml Sat Aug 4 18:11:00 2012 @@ -21,24 +21,28 @@ under the License. <screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd"> - - - <!--#Bam# portletWidget replace call showPortlet.ftl --> <screen name="showPortlet"> <section> <widgets> <section> <actions> - <set field="portalPortletId" from-field="portalPortletId" default-value="${parameters.portalPortletId}"/> + <entity-one entity-name="PortalPortlet" value-field="portlet" /> </actions> <widgets> - <include-portal-page id="${parameters.portalPageId}" portalPortletId="${portalPortletId}" portletSeqId="${parameters.portletSeqId}"/> + <!-- + label text=" id: ${parameters.portalPortletId} location: + ${portlet.screenLocation} screen: ${portlet.screenName}"></label + --> + <platform-specific> + <html> + <html-template location="component://common/webcommon/portal/showPortlet.ftl" /> + </html> + </platform-specific> </widgets> </section> </widgets> </section> </screen> - <!--#Eam# portletWidget --> <screen name="showPortletMainDecorator"> <section> <widgets> @@ -192,7 +196,6 @@ under the License. <section> <actions> <entity-one entity-name="PortalPortlet" value-field="portalPortlet"/> - <property-map map-name="uiLabelMap" resource="PortalAdminUiLabels"/><!--#Bam# portletExample --> </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> Modified: ofbiz/branches/20120329_portletWidget/framework/common/widget/PortletEditForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/common/widget/PortletEditForms.xml?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/common/widget/PortletEditForms.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/common/widget/PortletEditForms.xml Sat Aug 4 18:11:00 2012 @@ -37,53 +37,6 @@ under the License. <field name="pageId" required-field="true"><text/></field> <field name="submit" widget-style="smallSubmit"><submit button-type="button"/></field> </form> - <!--#Bam# portletEditForm --> - <!-- use by portlet throws an extend form--> - <!-- mgmtPageId : portal page with research and quick vision --> - <!-- recapPageId : portal page to see associate data --> - <!-- newPageId : portal page to create new entity value --> - <!-- targetPageId : portal page to retrieve information present on calling portlet --> - <form name="CommonListPageParam" extends="CommonPortletEdit"> - <field name="mgmtPageId"><lookup target-form-name="LookupPortalPage"/></field> - <field name="newPageId"><lookup target-form-name="LookupPortalPage"/></field> - <field name="recapPageId"><lookup target-form-name="LookupPortalPage"/></field> - </form> - <form name="CommonMgmtPageParam" extends="CommonPortletEdit"> - <field name="mgmtPageId"><lookup target-form-name="LookupPortalPage"/></field> - </form> - <form name="CommonRecapPageParam" extends="CommonPortletEdit"> - <field name="recapPageId"><lookup target-form-name="LookupPortalPage"/></field> - </form> - <form name="CommonTargetPageParam" extends="CommonPortletEdit"> - <field name="targetPageId"><lookup target-form-name="LookupPortalPage"/></field> - </form> - <!--#Bam# use directly by portlet without extends form--> - <form name="GenericMgmtPageParam" extends="CommonMgmtPageParam"> - <field name="submit" widget-style="smallSubmit"><submit button-type="button"/></field> - </form> - <form name="GenericRecapPageParam" extends="CommonRecapPageParam"> - <field name="submit" widget-style="smallSubmit"><submit button-type="button"/></field> - </form> - <form name="GenericSelectPageParam" extends="CommonPortletEdit"> - <field name="lookupName"><text/></field> - <field name="submit" widget-style="smallSubmit"><submit button-type="button"/></field> - </form> - <form name="GenericFindPageParam" extends="CommonTargetPageParam"> - <field name="submit" widget-style="smallSubmit"><submit button-type="button"/></field> - </form> - <form name="GenericListPageParam" extends="CommonListPageParam"> - <field name="submit" widget-style="smallSubmit"><submit button-type="button"/></field> - </form> - <form name="GenericShowMenu" extends="CommonPortletEdit"> - <field name="showMenu"><radio><option key="Y"/><option key="N"/></radio></field> - <field name="submit" widget-style="smallSubmit"><submit button-type="button"/></field> - </form> - <form name="GenericEditEditOrShowParam" extends="CommonPortletEdit"> - <field name="showEditButton"><radio><option key="Y"/><option key="N"/></radio></field> - <field name="showScreenletMenu"><radio><option key="Y"/><option key="N"/></radio></field> - <field name="submit" widget-style="smallSubmit"><submit button-type="button"/></field> - </form> - <!--#Eam# portletEditForm --> <form name="FindGenericEntityParam" extends="CommonPortletEdit"> <field name="titleLabel" required-field="true"><text/></field> <field name="entity" required-field="true"><text/></field> Modified: ofbiz/branches/20120329_portletWidget/framework/component-load.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/component-load.xml?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/component-load.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/component-load.xml Sat Aug 4 18:11:00 2012 @@ -24,16 +24,15 @@ under the License. <load-component component-location="geronimo"/> <load-component component-location="sql"/> <load-component component-location="entity"/> - <load-component component-location="catalina"/> - <!-- <load-component component-location="jetty"/> --> <load-component component-location="security"/> <load-component component-location="datafile"/> <load-component component-location="minilang"/> <load-component component-location="common"/> <load-component component-location="service"/> + <!-- <load-component component-location="jetty"/> --> + <load-component component-location="catalina"/> <load-component component-location="entityext"/> <load-component component-location="bi"/> - <load-component component-location="birt"/> <load-component component-location="webapp"/> <load-component component-location="widget"/> <load-component component-location="appserver"/> Modified: ofbiz/branches/20120329_portletWidget/framework/entity/build.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/build.xml?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/build.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/build.xml Sat Aug 4 18:11:00 2012 @@ -41,8 +41,6 @@ under the License. </path> <patternset id="src.exc.set"> - <exclude name="org/ofbiz/entity/connection/XaPoolConnectionFactory.java"/> - <exclude name="org/ofbiz/entity/connection/TyrexConnectionFactory.java"/> </patternset> <target name="jar" depends="classes"> Modified: ofbiz/branches/20120329_portletWidget/framework/entity/dtd/entitymodel.xsd URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/dtd/entitymodel.xsd?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/dtd/entitymodel.xsd (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/dtd/entitymodel.xsd Sat Aug 4 18:11:00 2012 @@ -92,6 +92,15 @@ under the License. <xs:attribute name="never-cache" default="false" type="boolean"/> <xs:attribute name="never-check" default="false" type="boolean"/> <xs:attribute name="auto-clear-cache" default="true" type="boolean"/> + <xs:attribute name="redefinition" type="boolean"> + <xs:annotation> + <xs:documentation> + Indicates if this entity redefines an existing entity. + When set to "true" it will suppress "Entity is defined more than once" warnings. + Defaults to "false". + </xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute name="title" type="xs:string"/> <xs:attribute name="copyright" type="xs:string"/> <xs:attribute name="author" type="xs:string"/> Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/Delegator.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/Delegator.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/Delegator.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/Delegator.java Sat Aug 4 18:11:00 2012 @@ -844,7 +844,7 @@ public interface Delegator { * * @throws IllegalArgumentException * if the list found has more than one item - * @deprecated use {@link #getRelatedOne(String, GenericValue, boolean) + * @deprecated use {@link #getRelatedOne(String, GenericValue, boolean)} */ @Deprecated public GenericValue getRelatedOne(String relationName, GenericValue value) throws GenericEntityException; @@ -856,7 +856,7 @@ public interface Delegator { * * @throws IllegalArgumentException * if the list found has more than one item - * @deprecated use {@link #getRelatedOne(String, GenericValue, boolean) + * @deprecated use {@link #getRelatedOne(String, GenericValue, boolean)} */ @Deprecated public GenericValue getRelatedOneCache(String relationName, GenericValue value) throws GenericEntityException; Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java Sat Aug 4 18:11:00 2012 @@ -26,13 +26,12 @@ import org.ofbiz.base.util.UtilXml; import org.w3c.dom.Element; /** - * Misc. utility method for dealing with the entityengine.xml file + * A model for the <datasource> element. * */ -public class DatasourceInfo { +public class DatasourceInfo extends NamedInfo { public static final String module = DatasourceInfo.class.getName(); - public String name; public String helperClass; public String fieldTypeName; public List<? extends Element> sqlLoadPaths; @@ -79,7 +78,7 @@ public class DatasourceInfo { public int maxWorkerPoolSize = 1; public DatasourceInfo(Element element) { - this.name = element.getAttribute("name"); + super(element); this.helperClass = element.getAttribute("helper-class"); this.fieldTypeName = element.getAttribute("field-type-name"); Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/DelegatorInfo.java Sat Aug 4 18:11:00 2012 @@ -21,12 +21,11 @@ package org.ofbiz.entity.config; import java.util.HashMap; import java.util.Map; -import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.w3c.dom.Element; /** - * Misc. utility method for dealing with the entityengine.xml file + * A model for the <delegator> element. * */ public class DelegatorInfo extends NamedInfo { @@ -57,15 +56,15 @@ public class DelegatorInfo extends Named // this defaults to false, ie anything but true is false this.useDistributedCacheClear = "true".equalsIgnoreCase(element.getAttribute("distributed-cache-clear-enabled")); this.distributedCacheClearClassName = element.getAttribute("distributed-cache-clear-class-name"); - if (UtilValidate.isEmpty(this.distributedCacheClearClassName)) this.distributedCacheClearClassName = "org.ofbiz.entityext.cache.EntityCacheServices"; + if (this.distributedCacheClearClassName.isEmpty()) this.distributedCacheClearClassName = "org.ofbiz.entityext.cache.EntityCacheServices"; this.distributedCacheClearUserLoginId = element.getAttribute("distributed-cache-clear-user-login-id"); - if (UtilValidate.isEmpty(this.distributedCacheClearUserLoginId)) this.distributedCacheClearUserLoginId = "system"; + if (this.distributedCacheClearUserLoginId.isEmpty()) this.distributedCacheClearUserLoginId = "system"; this.sequencedIdPrefix = element.getAttribute("sequenced-id-prefix"); this.defaultGroupName = element.getAttribute("default-group-name"); - if (UtilValidate.isEmpty(this.defaultGroupName)) this.defaultGroupName = "org.ofbiz"; + if (this.defaultGroupName.isEmpty()) this.defaultGroupName = "org.ofbiz"; for (Element groupMapElement: UtilXml.childElementList(element, "group-map")) { groupMap.put(groupMapElement.getAttribute("group-name"), groupMapElement.getAttribute("datasource-name")); Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityDataReaderInfo.java Sat Aug 4 18:11:00 2012 @@ -21,7 +21,7 @@ package org.ofbiz.entity.config; import org.w3c.dom.Element; /** - * Misc. utility method for dealing with the entityengine.xml file + * A model for the <entity-data-reader> element. * */ public class EntityDataReaderInfo extends ResourceInfo { Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityEcaReaderInfo.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityEcaReaderInfo.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityEcaReaderInfo.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityEcaReaderInfo.java Sat Aug 4 18:11:00 2012 @@ -21,8 +21,7 @@ package org.ofbiz.entity.config; import org.w3c.dom.Element; /** - * Misc. utility method for dealing with the entityengine.xml file - * + * A model for the <entity-eca-reader> element. */ public class EntityEcaReaderInfo extends ResourceInfo { public EntityEcaReaderInfo(Element element) { Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityGroupReaderInfo.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityGroupReaderInfo.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityGroupReaderInfo.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityGroupReaderInfo.java Sat Aug 4 18:11:00 2012 @@ -18,11 +18,10 @@ *******************************************************************************/ package org.ofbiz.entity.config; -import org.ofbiz.base.util.UtilValidate; import org.w3c.dom.Element; /** - * Misc. utility method for dealing with the entityengine.xml file + * A model for the <entity-group-reader> element. * */ public class EntityGroupReaderInfo extends ResourceInfo { @@ -30,8 +29,7 @@ public class EntityGroupReaderInfo exten super(element); String loader = element.getAttribute("loader"); String location = element.getAttribute("location"); - - if (UtilValidate.isNotEmpty(loader) && UtilValidate.isNotEmpty(location)) { + if (!loader.isEmpty() && !location.isEmpty()) { resourceElements.add(0, element); } } Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityModelReaderInfo.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityModelReaderInfo.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityModelReaderInfo.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/EntityModelReaderInfo.java Sat Aug 4 18:11:00 2012 @@ -21,7 +21,7 @@ package org.ofbiz.entity.config; import org.w3c.dom.Element; /** - * Misc. utility method for dealing with the entityengine.xml file + * A model for the <entity-model-reader> element. * */ public class EntityModelReaderInfo extends ResourceInfo { Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/FieldTypeInfo.java Sat Aug 4 18:11:00 2012 @@ -21,10 +21,11 @@ package org.ofbiz.entity.config; import org.w3c.dom.Element; /** - * Misc. utility method for dealing with the entityengine.xml file + * A model for the <field-type> element. * */ public class FieldTypeInfo extends NamedInfo { + // FIXME: Do not keep a reference to the DOM Element. public Element resourceElement; public FieldTypeInfo(Element element) { Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/NamedInfo.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/NamedInfo.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/NamedInfo.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/NamedInfo.java Sat Aug 4 18:11:00 2012 @@ -21,7 +21,7 @@ package org.ofbiz.entity.config; import org.w3c.dom.Element; /** - * Misc. utility method for dealing with the entityengine.xml file + * A base class for entity engine element models. * */ public abstract class NamedInfo { Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/config/ResourceInfo.java Sat Aug 4 18:11:00 2012 @@ -26,10 +26,11 @@ import org.ofbiz.base.util.UtilXml; import javolution.util.FastList; /** - * Misc. utility method for dealing with the entityengine.xml file + * A container for <resource> elements. * */ public abstract class ResourceInfo extends NamedInfo { + // FIXME: Do not keep a reference to DOM Elements. public List<Element> resourceElements = FastList.newInstance(); public ResourceInfo(Element element) { Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Sat Aug 4 18:11:00 2012 @@ -96,7 +96,7 @@ public class GenericDAO { this.helperInfo = helperInfo; this.modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperInfo.getHelperBaseName()); this.datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperInfo.getHelperBaseName()); - this.executor = ExecutionPool.getExecutor(GENERIC_DAO_THREAD_GROUP, "entity-datasource(" + helperInfo.getHelperFullName() + ")", datasourceInfo.maxWorkerPoolSize, false); + this.executor = ExecutionPool.getExecutor(GENERIC_DAO_THREAD_GROUP, "OFBiz-entity-datasource(" + helperInfo.getHelperFullName() + ")", datasourceInfo.maxWorkerPoolSize, false); } public <T> Future<T> submitWork(Callable<T> callable) throws GenericEntityException { Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/datasource/MemoryHelper.java Sat Aug 4 18:11:00 2012 @@ -281,7 +281,7 @@ public class MemoryHelper implements Gen this.helperName = helperName; modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName); DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); - this.executor = ExecutionPool.getExecutor(MEMORY_HELPER_THREAD_GROUP, "entity-datasource(" + helperName + ")", datasourceInfo.maxWorkerPoolSize, false); + this.executor = ExecutionPool.getExecutor(MEMORY_HELPER_THREAD_GROUP, "OFBiz-entity-datasource(" + helperName + ")", datasourceInfo.maxWorkerPoolSize, false); } public String getHelperName() { Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java Sat Aug 4 18:11:00 2012 @@ -21,19 +21,20 @@ package org.ofbiz.entity.finder; import static org.ofbiz.base.util.UtilGenerics.cast; import java.io.Serializable; +import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; -import javolution.util.FastMap; +import javolution.util.FastList; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.ObjectType; import org.ofbiz.base.util.StringUtil; -import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; @@ -63,24 +64,24 @@ public class EntityFinderUtil { Map<FlexibleMapAccessor<Object>, Object> fieldMap = null; List<? extends Element> fieldMapElementList = UtilXml.childElementList(element, "field-map"); if (fieldMapElementList.size() > 0) { - fieldMap = FastMap.newInstance(); + fieldMap = new HashMap<FlexibleMapAccessor<Object>, Object>(fieldMapElementList.size()); for (Element fieldMapElement: fieldMapElementList) { // set the env-name for each field-name, noting that if no field-name is specified it defaults to the env-name String fieldName = fieldMapElement.getAttribute("field-name"); String envName = fieldMapElement.getAttribute("from-field"); - if (UtilValidate.isEmpty(envName)) { + if (envName.isEmpty()) { envName = fieldMapElement.getAttribute("env-name"); } String value = fieldMapElement.getAttribute("value"); - if (UtilValidate.isEmpty(fieldName)) { + if (fieldName.isEmpty()) { // no fieldName, use envName for both fieldMap.put(FlexibleMapAccessor.getInstance(envName), FlexibleMapAccessor.getInstance(envName)); } else { - if (UtilValidate.isNotEmpty(value)) { + if (!value.isEmpty()) { fieldMap.put(FlexibleMapAccessor.getInstance(fieldName), FlexibleStringExpander.getInstance(value)); } else { // at this point we have a fieldName and no value, do we have a envName? - if (UtilValidate.isNotEmpty(envName)) { + if (!envName.isEmpty()) { fieldMap.put(FlexibleMapAccessor.getInstance(fieldName), FlexibleMapAccessor.getInstance(envName)); } else { // no envName, use fieldName for both @@ -116,7 +117,7 @@ public class EntityFinderUtil { List<FlexibleStringExpander> selectFieldExpanderList = null; List<? extends Element> selectFieldElementList = UtilXml.childElementList(element, "select-field"); if (selectFieldElementList.size() > 0) { - selectFieldExpanderList = new LinkedList<FlexibleStringExpander>(); + selectFieldExpanderList = new ArrayList<FlexibleStringExpander>(selectFieldElementList.size()); for (Element selectFieldElement: selectFieldElementList) { selectFieldExpanderList.add(FlexibleStringExpander.getInstance(selectFieldElement.getAttribute("field-name"))); } @@ -138,7 +139,7 @@ public class EntityFinderUtil { public static List<String> makeOrderByFieldList(List<FlexibleStringExpander> orderByExpanderList, Map<String, Object> context) { List<String> orderByFields = null; if (UtilValidate.isNotEmpty(orderByExpanderList)) { - orderByFields = new LinkedList<String>(); + orderByFields = new ArrayList<String>(orderByExpanderList.size()); for (FlexibleStringExpander orderByExpander: orderByExpanderList) { orderByFields.add(orderByExpander.expandString(context)); } @@ -149,30 +150,37 @@ public class EntityFinderUtil { public static interface Condition extends Serializable { public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader); } + @SuppressWarnings("serial") - public static class ConditionExpr implements Condition { - protected FlexibleStringExpander fieldNameExdr; - protected FlexibleStringExpander operatorExdr; - protected FlexibleMapAccessor<Object> envNameAcsr; - protected FlexibleStringExpander valueExdr; - protected FlexibleStringExpander ignoreExdr; - protected boolean ignoreIfNull; - protected boolean ignoreIfEmpty; - protected boolean ignoreCase; + public static final class ConditionExpr implements Condition { + private final String fieldName; + private final EntityOperator<?,?,?> operator; + private final FlexibleMapAccessor<Object> envNameAcsr; + private final FlexibleStringExpander valueExdr; + private final FlexibleStringExpander ignoreExdr; + private final boolean ignoreIfNull; + private final boolean ignoreIfEmpty; + private final boolean ignoreCase; public ConditionExpr(Element conditionExprElement) { - this.fieldNameExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("field-name")); - if (this.fieldNameExdr.isEmpty()) { - // no "field-name"? try "name" - this.fieldNameExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("name")); - } - - this.operatorExdr = FlexibleStringExpander.getInstance(UtilFormatOut.checkEmpty(conditionExprElement.getAttribute("operator"), "equals")); - if (UtilValidate.isNotEmpty(conditionExprElement.getAttribute("from-field"))) { - this.envNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("from-field")); - } else { - this.envNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("env-name")); + String fieldNameAttribute = conditionExprElement.getAttribute("field-name"); + if (fieldNameAttribute.isEmpty()) { + fieldNameAttribute = conditionExprElement.getAttribute("name"); + } + this.fieldName = fieldNameAttribute; + String operatorAttribute = conditionExprElement.getAttribute("operator"); + if (operatorAttribute.isEmpty()) { + operatorAttribute = "equals"; + } + this.operator = EntityOperator.lookup(operatorAttribute); + if (this.operator == null) { + throw new IllegalArgumentException("Could not find an entity operator for the name: " + operatorAttribute); + } + String fromFieldAttribute = conditionExprElement.getAttribute("from-field"); + if (fromFieldAttribute.isEmpty()) { + fromFieldAttribute = conditionExprElement.getAttribute("env-name"); } + this.envNameAcsr = FlexibleMapAccessor.getInstance(fromFieldAttribute); this.valueExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("value")); this.ignoreIfNull = "true".equals(conditionExprElement.getAttribute("ignore-if-null")); this.ignoreIfEmpty = "true".equals(conditionExprElement.getAttribute("ignore-if-empty")); @@ -181,22 +189,19 @@ public class EntityFinderUtil { } public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) { - String fieldName = fieldNameExdr.expandString(context); - - Object value = null; - // start with the environment variable, will override if exists and a value is specified - if (envNameAcsr != null) { - value = envNameAcsr.get(context); + if ("true".equals(this.ignoreExdr.expandString(context))) { + return null; } - // no value so far, and a string value is specified, use that - if (value == null && valueExdr != null) { - value = valueExdr.expandString(context); + if (modelEntity.getField(fieldName) == null) { + throw new IllegalArgumentException("Error in Entity Find: could not find field [" + fieldName + "] in entity with name [" + modelEntity.getEntityName() + "]"); } - String operatorName = operatorExdr.expandString(context); - EntityOperator<?,?,?> operator = EntityOperator.lookup(operatorName); - if (operator == null) { - throw new IllegalArgumentException("Could not find an entity operator for the name: " + operatorName); + Object value = envNameAcsr.get(context); + if (value == null && !valueExdr.isEmpty()) { + value = valueExdr.expandString(context); + } + if (this.ignoreIfNull && value == null) { + return null; } // If IN or BETWEEN operator, see if value is a literal list and split it @@ -208,15 +213,11 @@ public class EntityFinderUtil { } else if (((String)value).indexOf(",") >= 0) { delim = ","; } - if (UtilValidate.isNotEmpty(delim)) { + if (delim != null) { value = StringUtil.split((String)value, delim); } } - if (modelEntity.getField(fieldName) == null) { - throw new IllegalArgumentException("Error in Entity Find: could not find field [" + fieldName + "] in entity with name [" + modelEntity.getEntityName() + "]"); - } - // don't convert the field to the desired type if this is an IN or BETWEEN operator and we have a Collection if (!((operator.equals(EntityOperator.IN) || operator.equals(EntityOperator.BETWEEN) || operator.equals(EntityOperator.NOT_IN)) && value instanceof Collection<?>)) { @@ -226,17 +227,10 @@ public class EntityFinderUtil { if (Debug.verboseOn()) Debug.logVerbose("Got value for fieldName [" + fieldName + "]: " + value, module); - if (this.ignoreIfNull && value == null) { - return null; - } if (this.ignoreIfEmpty && ObjectType.isEmpty(value)) { return null; } - if ("true".equals(this.ignoreExdr.expandString(context))) { - return null; - } - if (operator == EntityOperator.NOT_EQUAL && value != null) { // since some databases don't consider nulls in != comparisons, explicitly include them // this makes more sense logically, but if anyone ever needs it to not behave this way we should add an "or-null" attribute that is true by default @@ -263,68 +257,72 @@ public class EntityFinderUtil { } @SuppressWarnings("serial") - public static class ConditionList implements Condition { - List<Condition> conditionList = new LinkedList<Condition>(); - FlexibleStringExpander combineExdr; + public static final class ConditionList implements Condition { + private final List<Condition> conditionList; + private final EntityOperator<?,?,?> operator; public ConditionList(Element conditionListElement) { - this.combineExdr = FlexibleStringExpander.getInstance(conditionListElement.getAttribute("combine")); - + String operatorAttribute = conditionListElement.getAttribute("combine"); + if (operatorAttribute.isEmpty()) { + operatorAttribute = "and"; + } + this.operator = EntityOperator.lookup(operatorAttribute); + if (this.operator == null) { + throw new IllegalArgumentException("Could not find an entity operator for the name: " + operatorAttribute); + } List<? extends Element> subElements = UtilXml.childElementList(conditionListElement); - for (Element subElement: subElements) { - if ("condition-expr".equals(subElement.getNodeName())) { - conditionList.add(new ConditionExpr(subElement)); - } else if ("condition-list".equals(subElement.getNodeName())) { - conditionList.add(new ConditionList(subElement)); - } else if ("condition-object".equals(subElement.getNodeName())) { - conditionList.add(new ConditionObject(subElement)); - } else { - throw new IllegalArgumentException("Invalid element with name [" + subElement.getNodeName() + "] found under a condition-list element."); + if (subElements.isEmpty()) { + this.conditionList = null; + } else { + List<Condition> conditionList = new ArrayList<Condition>(subElements.size()); + for (Element subElement : subElements) { + if ("condition-expr".equals(subElement.getNodeName())) { + conditionList.add(new ConditionExpr(subElement)); + } else if ("condition-list".equals(subElement.getNodeName())) { + conditionList.add(new ConditionList(subElement)); + } else if ("condition-object".equals(subElement.getNodeName())) { + conditionList.add(new ConditionObject(subElement)); + } else { + throw new IllegalArgumentException("Invalid element with name [" + subElement.getNodeName() + "] found under a condition-list element."); + } } + this.conditionList = Collections.unmodifiableList(conditionList); } } public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) { - if (this.conditionList.size() == 0) { + if (this.conditionList == null) { return null; } if (this.conditionList.size() == 1) { Condition condition = this.conditionList.get(0); return condition.createCondition(context, modelEntity, modelFieldTypeReader); } - - List<EntityCondition> entityConditionList = new LinkedList<EntityCondition>(); - for (Condition curCondition: conditionList) { + List<EntityCondition> entityConditionList = new ArrayList<EntityCondition>(this.conditionList.size()); + for (Condition curCondition: this.conditionList) { EntityCondition econd = curCondition.createCondition(context, modelEntity, modelFieldTypeReader); if (econd != null) { entityConditionList.add(econd); } } - - String operatorName = combineExdr.expandString(context); - EntityOperator<?,?,?> operator = EntityOperator.lookup(operatorName); - if (operator == null) { - throw new IllegalArgumentException("Could not find an entity operator for the name: " + operatorName); - } - return EntityCondition.makeCondition(entityConditionList, UtilGenerics.<EntityJoinOperator>cast(operator)); } } + @SuppressWarnings("serial") - public static class ConditionObject implements Condition { - protected FlexibleMapAccessor<Object> fieldNameAcsr; + public static final class ConditionObject implements Condition { + private final FlexibleMapAccessor<Object> fieldNameAcsr; public ConditionObject(Element conditionExprElement) { - this.fieldNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("field")); - if (this.fieldNameAcsr.isEmpty()) { - // no "field"? try "field-name" - this.fieldNameAcsr = FlexibleMapAccessor.getInstance(conditionExprElement.getAttribute("field-name")); + String fieldNameAttribute = conditionExprElement.getAttribute("field"); + if (fieldNameAttribute.isEmpty()) { + fieldNameAttribute = conditionExprElement.getAttribute("field-name"); } + this.fieldNameAcsr = FlexibleMapAccessor.getInstance(fieldNameAttribute); } public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) { - EntityCondition condition = (EntityCondition) fieldNameAcsr.get(context); - return condition; + return (EntityCondition) fieldNameAcsr.get(context); } } @@ -332,6 +330,7 @@ public class EntityFinderUtil { public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr); public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr); } + @SuppressWarnings("serial") public static class LimitRange implements OutputHandler { FlexibleStringExpander startExdr; @@ -365,7 +364,7 @@ public class EntityFinderUtil { } public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { - int start = getStart(context); + int start = getStart(context) + 1; // ELI index is one-based. int size = getSize(context); try { listAcsr.put(context, eli.getPartialList(start, size)); @@ -378,15 +377,22 @@ public class EntityFinderUtil { } public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { + List<GenericValue> result = null; int start = getStart(context); - int size = getSize(context); - - int end = start + size; - if (end > results.size()) end = results.size(); - - listAcsr.put(context, results.subList(start, end)); + if (start < results.size()) { + int size = getSize(context); + int end = start + size; + if (end > results.size()) { + end = results.size(); + } + result = results.subList(start, end); + } else { + result = FastList.newInstance(); + } + listAcsr.put(context, result); } } + @SuppressWarnings("serial") public static class LimitView implements OutputHandler { FlexibleStringExpander viewIndexExdr; @@ -422,9 +428,8 @@ public class EntityFinderUtil { public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { int index = this.getIndex(context); int size = this.getSize(context); - try { - listAcsr.put(context, eli.getPartialList(((index - 1) * size) + 1, size)); + listAcsr.put(context, eli.getPartialList(((index - 1) * size) + 1, size)); // ELI index is one-based. eli.close(); } catch (GenericEntityException e) { String errMsg = "Error getting partial list in limit-view with index=" + index + " and size=" + size + ": " + e.toString(); @@ -434,16 +439,23 @@ public class EntityFinderUtil { } public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr) { + List<GenericValue> result = null; int index = this.getIndex(context); int size = this.getSize(context); - - int begin = index * size; - int end = index * size + size; - if (end > results.size()) end = results.size(); - - listAcsr.put(context, results.subList(begin, end)); + int begin = (index - 1) * size; + if (begin < results.size()) { + int end = begin + size; + if (end > results.size()) { + end = results.size(); + } + result = results.subList(begin, end); + } else { + result = FastList.newInstance(); + } + listAcsr.put(context, result); } } + @SuppressWarnings("serial") public static class UseIterator implements OutputHandler { public UseIterator(Element useIteratorElement) { Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/model/ModelReader.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/model/ModelReader.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/model/ModelReader.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/model/ModelReader.java Sat Aug 4 18:11:00 2012 @@ -98,7 +98,7 @@ public class ModelReader implements Seri return reader; } - public ModelReader(String modelName) throws GenericEntityException { + private ModelReader(String modelName) throws GenericEntityException { this.modelName = modelName; entityResourceHandlers = FastList.newInstance(); resourceHandlerEntities = FastMap.newInstance(); @@ -127,6 +127,7 @@ public class ModelReader implements Seri private ModelEntity buildEntity(ResourceHandler entityResourceHandler, Element curEntityElement, int i, ModelInfo def) throws GenericEntityException { boolean isEntity = "entity".equals(curEntityElement.getNodeName()); String entityName = UtilXml.checkEmpty(curEntityElement.getAttribute("entity-name")).intern(); + boolean redefinedEntity = "true".equals(curEntityElement.getAttribute("redefinition")); // add entityName to appropriate resourceHandlerEntities collection Collection<String> resourceHandlerEntityNames = resourceHandlerEntities.get(entityResourceHandler); @@ -138,7 +139,7 @@ public class ModelReader implements Seri resourceHandlerEntityNames.add(entityName); // check to see if entity with same name has already been read - if (entityCache.containsKey(entityName)) { + if (entityCache.containsKey(entityName) && !redefinedEntity) { Debug.logWarning("WARNING: Entity " + entityName + " is defined more than once, most recent will over-write " + "previous definition(s)", module); Modified: ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java Sat Aug 4 18:11:00 2012 @@ -264,7 +264,8 @@ public class XmlSerializer { } else { String byteHex = StringUtil.toHexString(objBytes); Element element = document.createElement("cus-obj"); - element.appendChild(document.createCDATASection(byteHex)); + // this is hex encoded so does not need to be in a CDATA block + element.appendChild(document.createTextNode(byteHex)); return element; } } else { @@ -499,4 +500,4 @@ public class XmlSerializer { } return formatter; } -} \ No newline at end of file +} Modified: ofbiz/branches/20120329_portletWidget/framework/entityext/src/org/ofbiz/entityext/EntityServiceFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entityext/src/org/ofbiz/entityext/EntityServiceFactory.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entityext/src/org/ofbiz/entityext/EntityServiceFactory.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entityext/src/org/ofbiz/entityext/EntityServiceFactory.java Sat Aug 4 18:11:00 2012 @@ -20,8 +20,8 @@ package org.ofbiz.entityext; import org.ofbiz.entity.Delegator; import org.ofbiz.service.DispatchContext; -import org.ofbiz.service.GenericDispatcher; import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ServiceContainer; /** * EntityEcaUtil @@ -31,7 +31,7 @@ public class EntityServiceFactory { public static final String module = EntityServiceFactory.class.getName(); public static LocalDispatcher getLocalDispatcher(Delegator delegator) { - LocalDispatcher dispatcher = GenericDispatcher.getLocalDispatcher("entity-" + delegator.getDelegatorName(), delegator); + LocalDispatcher dispatcher = ServiceContainer.getLocalDispatcher("entity-" + delegator.getDelegatorName(), delegator); return dispatcher; } Modified: ofbiz/branches/20120329_portletWidget/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java Sat Aug 4 18:11:00 2012 @@ -84,7 +84,7 @@ public class EntityDataLoadContainer imp } /** - * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String) + * @see org.ofbiz.base.container.Container#init(String[] args, String name, String configFile) */ public void init(String[] args, String name, String configFile) throws ContainerException { this.name = name; Modified: ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/fieldlookup.js URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/fieldlookup.js?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/fieldlookup.js (original) +++ ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/fieldlookup.js Sat Aug 4 18:11:00 2012 @@ -449,7 +449,7 @@ var FieldLookupCounter = function() { }; }; -var GLOBAL_LOOKUP_REF = new FieldLookupCounter; +var GLOBAL_LOOKUP_REF = new FieldLookupCounter(); /******************************************************************************* * Button Modifier Object @@ -474,8 +474,8 @@ var ButtonModifier = function(lookupDiv) var slTitleBars = jQuery("#" + lookupDiv + " .screenlet-title-bar"); - jQuery.each(slTitleBars, function(i) { - var slTitleBar = slTitleBars[i]; + jQuery.each(slTitleBars, function(index) { + var slTitleBar = slTitleBars[index]; var ul = slTitleBar.firstChild; if ((typeof ul) != 'object') { return true; @@ -610,10 +610,10 @@ var ButtonModifier = function(lookupDiv) jQuery.each(cellChilds, function(child) { if (cellChilds[child].tagName == "A") { var link = cellChilds[child].href; - var liSub = link.substring(link.lastIndexOf('/') + 1, (link.length)); - if (liSub.indexOf("javascript:set_") != -1) { + if (link.indexOf("javascript:set_") != -1) { cellChilds[child].href = link; } else { + var liSub = link.substring(link.lastIndexOf('/') + 1, (link.length)); cellChilds[child].href = "javascript:lookupAjaxRequest('" + liSub + "&presentation=layer')"; } } Modified: ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/getDependentDropdownValues.js URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/getDependentDropdownValues.js?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/getDependentDropdownValues.js (original) +++ ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/getDependentDropdownValues.js Sat Aug 4 18:11:00 2012 @@ -52,7 +52,7 @@ function getDependentDropdownValues(requ jQuery.each(list, function(key, value){ if (typeof value == 'string') { values = value.split(': '); - if (values[1].indexOf(selected) >= 0) { + if (values[1].indexOf(selected) >= 0 && selected.length > 0) { optionList += "<option selected='selected' value = " + values[1] + " >" + values[0] + "</option>"; } else { optionList += "<option value = " + values[1] + " >" + values[0] + "</option>"; Modified: ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/selectall.js URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/selectall.js?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/selectall.js (original) +++ ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/selectall.js Sat Aug 4 18:11:00 2012 @@ -269,27 +269,6 @@ function ajaxUpdateAreas(areaCsvString) // not nice but works targetParams = targetParams.replace('#',''); targetParams = targetParams.replace('?',''); - /*#Bam# portletWidget wait-spinner working*/ - var UPDATE_OP = {}; - UPDATE_OP.areaId = areaId; - UPDATE_OP.target = target; - UPDATE_OP.targetParams = targetParams; - UPDATE_OP.update = function(){ - var _op = this; - jQuery.ajax({ - url: _op.target, - type: "POST", - data: _op.targetParams, - success: function(data) { - jQuery("#" + _op.areaId).html(data); - evalScripts(jQuery("#" + _op.areaId)); - waitSpinnerHide(); - }, - error: function(data) {waitSpinnerHide()} - }); - } - UPDATE_OP.update(); - /* jQuery.ajax({ url: target, async: false, @@ -301,8 +280,6 @@ function ajaxUpdateAreas(areaCsvString) }, error: function(data) {waitSpinnerHide()} }); - */ - /*#Eam# portletWidget wait-spinner working*/ } } @@ -375,14 +352,10 @@ function submitFormInBackground(form, ar function ajaxSubmitFormUpdateAreas(form, areaCsvString) { waitSpinnerShow(); hideErrorContainer = function() { - jQuery('#content-messages').remove(); + jQuery('#content-messages').removeClass('errorMessage').fadeIn('fast'); } updateFunction = function(data) { - /*#Bam# portletWidget*/ - if ((data._ERROR_MESSAGE_LIST_ != undefined || data._ERROR_MESSAGE_ != undefined) - && (data.responseMessage == undefined || data.responseMessage != "fail")) { - showMessages('errorMessage',data._ERROR_MESSAGE_,data._ERROR_MESSAGE_LIST_); - /* + if (data._ERROR_MESSAGE_LIST_ != undefined || data._ERROR_MESSAGE_ != undefined) { if(!jQuery('#content-messages')) { //add this div just after app-navigation if(jQuery('#content-main-section')){ @@ -398,18 +371,9 @@ function ajaxSubmitFormUpdateAreas(form, jQuery('#content-messages' ).html(data._ERROR_MESSAGE_); } jQuery('#content-messages').fadeIn('fast'); - */ }else { - // now show message if needed - if (data.responseMessage != undefined && data.responseMessage == "fail") { - showMessages('failMessage',data._ERROR_MESSAGE_,data._ERROR_MESSAGE_LIST_); - } - else if (data._EVENT_MESSAGE_LIST_ != undefined || data._EVENT_MESSAGE_ != undefined){ - showMessages('eventMessage',data._EVENT_MESSAGE_,data._EVENT_MESSAGE_LIST_); - } - else if(jQuery('#content-messages').text()) { - jQuery('#content-messages').remove(); - /*#Eam# portletWidget*/ + if(jQuery('#content-messages')) { + jQuery('#content-messages').removeClass('errorMessage').fadeIn("fast"); } ajaxUpdateAreas(areaCsvString); } @@ -845,21 +809,6 @@ function waitSpinnerHide() { jQuery("#wait-spinner").hide() } -// #Bam# validate-form -function clickLink(linkDivId) { - var div = document.getElementById(linkDivId); - if(!div ) return; - var aNodeList = div.getElementsByTagName("A"); - link = aNodeList.item(0); - target =link.href; - if(target.match(new RegExp("javascript:.*"))){ - eval(target); - } else { - window.location.href = target; - } -} -// #Eam# validate-form - /** * Reads the requiered uiLabels from the uiLabelXml Files * @param requiredLabels JSON Object {resource : [label1, label2 ...], resource2 : [label1, label2, ...]} Modified: ofbiz/branches/20120329_portletWidget/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java Sat Aug 4 18:11:00 2012 @@ -62,7 +62,7 @@ public class JettyContainer implements C private Map<String, Server> servers = new HashMap<String, Server>(); /** - * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String) + * @see org.ofbiz.base.container.Container#init(String[] args, String name, String configFile) */ public void init(String[] args, String name, String configFile) throws ContainerException { this.name = name; Modified: ofbiz/branches/20120329_portletWidget/framework/minilang/config/minilang.properties URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/minilang/config/minilang.properties?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/minilang/config/minilang.properties (original) +++ ofbiz/branches/20120329_portletWidget/framework/minilang/config/minilang.properties Sat Aug 4 18:11:00 2012 @@ -26,3 +26,7 @@ validation.level=none # to correct common syntax errors. The corrections are saved in the original # source file. autocorrect=false + +# Enable trace statements in mini-language unit tests. If set to true, mini-language +# unit tests will log trace messages. Log messages will be INFO. +unit.tests.trace.enabled=false |
| Free forum by Nabble | Edit this page |
