Announcement Announcement Module
Collapse
No announcement yet.
Limit in Array size (10) in context xml? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Limit in Array size (10) in context xml?

    So, we've run into an issue where we are creating an array in our context xml, which works great until we get to the 11th item, then it fails.

    By "fails", I mean it doesn't create the object. No message or exception is raised.

    Any ideas?

    Thanks,
    Glenn

  • #2
    can't reproduce

    Hey Glenn,

    can you post some of your code and configuration, or perhaps post a small application that re-creates the problem.
    I have just done a small test in which I assign an array of 15 objects to an object and all of the objects get instantiated as expected.
    Of course I've been testing with the latest version from the trunk, are you using the 7.1 release?

    cheers,

    Roland

    Comment


    • #3
      We are using 7.1

      It's pretty easy stuff, just have an object that takes an array, so we create the array in the context:
      Code:
      <!-- go to features object -->
      <!--	
      	<object id="gotoAmpObject" class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      	  <constructor-arg value="Amp"/>
      	  <constructor-arg value="Amp"/>
      	  <constructor-arg value="AmpName"/>
      	  <constructor-arg value="Name"/>
      	</object>
      	<object id="gotoNodeObject" class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      	  <constructor-arg value="NodeBoundary"/>
      	  <constructor-arg value="Node"/>
      	  <constructor-arg value="System_Name"/>
      	  <constructor-arg value="System Name"/>
      	</object>
      -->
      
      	<!-- object data for the goto functionality --> 
      	<object id="gotoFeaturesObject" class="Array">
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="AMP"/>
               		<constructor-arg name="name" value="Amp"/>
               		<constructor-arg name="attr" value="AMPNAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="NODE_BOUNDARY"/>
               		<constructor-arg name="name" value="Node"/>
               		<constructor-arg name="attr" value="SYSTEM_NAME"/>
               		<constructor-arg name="attrAlias" value="System Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="POWERSUPPLY"/>
               		<constructor-arg name="name" value="Power Supply"/>
               		<constructor-arg name="attr" value="POWERSUPPLYNAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="SPLICE_ENCLOSURE"/>
               		<constructor-arg name="name" value="Fiber Splice"/>
               		<constructor-arg name="attr" value="NAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="HUB"/>
               		<constructor-arg name="name" value="Hub"/>
               		<constructor-arg name="attr" value="NAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="ACCESS_POINT"/>
               		<constructor-arg name="name" value="Access Point"/>
               		<constructor-arg name="attr" value="NAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="MAPGRID"/>
               		<constructor-arg name="name" value="Map Grid"/>
               		<constructor-arg name="attr" value="NAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="FRANCHISEBOUNDARY"/>
               		<constructor-arg name="name" value="Franchise"/>
               		<constructor-arg name="attr" value="NAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="ADZONE"/>
               		<constructor-arg name="name" value="Ad Zone"/>
               		<constructor-arg name="attr" value="NAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="US_ZIPCODES"/>
               		<constructor-arg name="name" value="Zip Codes"/>
               		<constructor-arg name="attr" value="ZIP"/>
               		<constructor-arg name="attrAlias" value="Zip Code"/>
               	</object>
      		</constructor-arg>
      <!-- if i put these in it stops loading the array -->		
      <!--
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="US_MUNICIPALITY"/>
               		<constructor-arg name="name" value="City"/>
               		<constructor-arg name="attr" value="NAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="US_COUNTY"/>
               		<constructor-arg name="name" value="County"/>
               		<constructor-arg name="attr" value="NAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
          	<constructor-arg>
              	<object class="com.esi.flexviewer.modules.query.vo.GotoItemVO">
      				<constructor-arg name="layer" value="US_RATECENTER"/>
               		<constructor-arg name="name" value="Rate Center"/>
               		<constructor-arg name="attr" value="NAME"/>
               		<constructor-arg name="attrAlias" value="Name"/>
               	</object>
      		</constructor-arg>
      -->		
      	</object>
      any ideas?

      Thanks for the reply..

      Comment


      • #4
        aha, I get it

        Hey there,

        yes, now I understand the problem, I thought you were assigning an array to a property, but you meant an arbitrary amount of constructor arguments.
        This is indeed a limitation of Spring Actionscript, because its not possible to generically call an arbitrary amount of constructor arguments, spring AS has a limitation of 10 constructor args.
        The easiest way to solve this for you is to change your constructor, so it will accept an array of GotoItemVO instances, instead of such a long list of constructor args.

        I hope this helps a little, if you have more issues please feel free to get back to us,

        cheers,

        Roland

        Comment


        • #5
          Same Problem

          But you get exactly the same problem when trying to instantiate the array in XML. I've defined an array as follows:

          <object id="attribs_scc_doc" class="Array">
          <constructor-arg ref="attr_r_object_id" />
          <constructor-arg ref="attr_r_object_type" />
          <constructor-arg ref="attr_object_name" />
          <constructor-arg ref="attr_owner_name" />
          <constructor-arg ref="attr_r_creation_date" />
          <constructor-arg ref="attr_r_creator_name" />
          <constructor-arg ref="attr_r_modify_date" />
          <constructor-arg ref="attr_r_modifier" />
          <constructor-arg ref="attr_r_lock_date" />
          <constructor-arg ref="attr_r_lock_owner" />
          <constructor-arg ref="attr_i_chronicle_id" />
          <constructor-arg ref="attr_r_version_label" />
          <constructor-arg ref="attr_c_doc_type" />
          <constructor-arg ref="attr_c_custom_date" />
          </object>

          This array is injected into another bean. When the array bean has 10 elements or less I can use it just fine (iterate over it, etc). When there's more than 10 elements then I run into problems. It was a bugger to track this bug down as it silently fails - no errors are written to the trace.

          Is there anyway of defining an array of more than 10 elements in Spring ActionScript XML?

          Regards

          Comment


          • #6
            nopes

            Hey there,

            please refer to this documentation section on how to properly define collections in the XML configuration:

            Spring Actionscript docs - Collections

            if you have any other questions, please feel free to ask.

            cheers,

            Roland

            Comment


            • #7
              Thanks for the speedy response. The array syntax works fine where I'm defining a property.

              e.g.

              Code:
                      <property name="attributeDefs">
              		    <array>
              		        <value><ref>attr_r_object_id</ref></value>
              		        <value><ref>attr_r_object_type</ref></value>
              		        <value><ref>attr_object_name</ref></value>
              		        <value><ref>attr_owner_name</ref></value>
              		        <value><ref>attr_r_creation_date</ref></value>
              		        <value><ref>attr_r_creator_name</ref></value>
              		        <value><ref>attr_r_modify_date</ref></value>
              		        <value><ref>attr_r_modifier</ref></value>
              		        <value><ref>attr_r_lock_date</ref></value>
              		        <value><ref>attr_r_lock_owner</ref></value>
              		        <value><ref>attr_i_chronicle_id</ref></value>
              		        <value><ref>attr_r_version_label</ref></value>
              		        <value><ref>attr_c_doc_type</ref></value>
              		        <value><ref>attr_c_custom_date</ref></value>
              		    </array>
                      </property>
              Can collections be defined standalone as well so that I can reuse these beans (e.g. inject to more than one property/bean)?

              e.g.

              Code:
                  <array id="attributes">
                      <value><ref>attr_r_object_id</ref></value>
                      <value><ref>attr_r_object_type</ref></value>
                      <value><ref>attr_object_name</ref></value>
                      <value><ref>attr_owner_name</ref></value>
                      <value><ref>attr_r_creation_date</ref></value>
                      <value><ref>attr_r_creator_name</ref></value>
                      <value><ref>attr_r_modify_date</ref></value>
                      <value><ref>attr_r_modifier</ref></value>
                      <value><ref>attr_r_lock_date</ref></value>
                      <value><ref>attr_r_lock_owner</ref></value>
                      <value><ref>attr_i_chronicle_id</ref></value>
                      <value><ref>attr_r_version_label</ref></value>
                      <value><ref>attr_c_doc_type</ref></value>
                      <value><ref>attr_c_custom_date</ref></value>
                  </array>
              Regards

              Comment


              • #8
                yep

                hey there,

                yes, indeed, 'standalone' collections should work exactly the same way as regular object definitions.

                cheers,

                Roland

                Comment


                • #9
                  Thanks again.

                  Comment


                  • #10
                    Originally posted by ukdavo View Post
                    Thanks for the speedy response. The array syntax works fine where I'm defining a property.

                    e.g.

                    Code:
                            <property name="attributeDefs">
                    		    <array>
                    		        <value><ref>attr_r_object_id</ref></value>
                    		        <value><ref>attr_r_object_type</ref></value>
                    		        <value><ref>attr_object_name</ref></value>
                    		        <value><ref>attr_owner_name</ref></value>
                    		        <value><ref>attr_r_creation_date</ref></value>
                    		        <value><ref>attr_r_creator_name</ref></value>
                    		        <value><ref>attr_r_modify_date</ref></value>
                    		        <value><ref>attr_r_modifier</ref></value>
                    		        <value><ref>attr_r_lock_date</ref></value>
                    		        <value><ref>attr_r_lock_owner</ref></value>
                    		        <value><ref>attr_i_chronicle_id</ref></value>
                    		        <value><ref>attr_r_version_label</ref></value>
                    		        <value><ref>attr_c_doc_type</ref></value>
                    		        <value><ref>attr_c_custom_date</ref></value>
                    		    </array>
                            </property>
                    Can collections be defined standalone as well so that I can reuse these beans (e.g. inject to more than one property/bean)?

                    e.g.

                    Code:
                        <array id="attributes">
                            <value><ref>attr_r_object_id</ref></value>
                            <value><ref>attr_r_object_type</ref></value>
                            <value><ref>attr_object_name</ref></value>
                            <value><ref>attr_owner_name</ref></value>
                            <value><ref>attr_r_creation_date</ref></value>
                            <value><ref>attr_r_creator_name</ref></value>
                            <value><ref>attr_r_modify_date</ref></value>
                            <value><ref>attr_r_modifier</ref></value>
                            <value><ref>attr_r_lock_date</ref></value>
                            <value><ref>attr_r_lock_owner</ref></value>
                            <value><ref>attr_i_chronicle_id</ref></value>
                            <value><ref>attr_r_version_label</ref></value>
                            <value><ref>attr_c_doc_type</ref></value>
                            <value><ref>attr_c_custom_date</ref></value>
                        </array>
                    Regards
                    Hi guys,

                    I run in the same issue of the max number of optional arguments passing, trying to do exactly the same thing.

                    The reason why I was using constructor arguments instead of the provided <array> and other collection facilities is because that objects do NOT allow me to specify the scope. Altering the behaviour of my application and making this collections unusable in my context.

                    In particular the <array> object that I would pass by injection will be scoped singleton by default with no possibility to change this, making all the object in it acting as singletons while they are not. I'm going to find an other solution as this seems to me a limitation we have in this collection objects even if they would be useful.

                    I wrote an other post few months ago but I think I have been misunderstood, probably the person who answered thought I was talking about Spring Java while we are talking about Spring ActionScript. So no solution has been suggested then.

                    this is the post: http://forum.springsource.org/showthread.php?t=88532

                    As I could not specify prototype scope on the collection objects I had to use the constructor arguments. But yesterday I discovered there is a limitation on the number of them.

                    I hope this collection objects can be easily enhanced to accept a scope declaration.


                    Many thanks

                    Regards

                    Comment

                    Working...
                    X