Announcement Announcement Module
Collapse
No announcement yet.
Querying through spring beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Querying through spring beans

    Hello,

    I hope I will be able to explain my question clearly.

    In our application we have search pages which uses a predefined list of items users can query using. For e.g. If you are looking for a person you can choose to search using either First Name, Last Name, City, State, Type.


    These search parameters are defined in a spring bean file which is wired in @ startup. And some of these search parameters use a query to bring back a list of values that are used for the query. For eg When looking for a person, if you want to search for a person from a type you get a list of types you can choose from.

    The sql query to get back these results are defined in the bean factory as well.

    Now if we add a new type runtime. This new one does not show up on the list until i reload the application. I was wondering if there is any way I could refresh this list.

    Samples of code
    Code:
    Search_params.xml
    <bean id="lastName"
    		class="com.netmemex.netmx.util.impl.JdbcSearchPropertyImpl">
    		<property name="name">
    			<value>lastName</value>
    		</property>
    		<property name="display">
    			<value>Last Name</value>
    		</property>
    		<property name="dataType">
    			<value>String</value>
    		</property>
    		<property name="operators">
    			<set>
    			    <ref bean="iStartsWithOperator" />
    			    <ref bean="iContainsOperator" />
    				<ref bean="iEqualsOperator" />
    			</set>
    		</property>
    		<property name="listOfValues">
    			<set>
    				<ref bean="blank" />
    			</set>
    		</property>
    		<property name="htmlTag">
    			<bean
    				class="com.aitworks.util.html.impl.HtmlTagImpl">
    				<property name="tag">
    					<value>input</value>
    				</property>
    				<property name="attributes">
    					<map>
    						<entry key="type" value="text"></entry>
    					</map>
    				</property>
    			</bean>
    		</property>
    	</bean>
    	
    	<bean id="firstName"
    		class="com.netmemex.netmx.util.impl.JdbcSearchPropertyImpl">
    		<property name="name">
    			<value>firstName</value>
    		</property>
    		<property name="display">
    			<value>First Name</value>
    		</property>
    		<property name="dataType">
    			<value>String</value>
    		</property>
    		<property name="operators">
    			<set>
    			    <ref bean="iStartsWithOperator" />
    			    <ref bean="iContainsOperator" />
    				<ref bean="iEqualsOperator" />
    			</set>
    		</property>
    		<property name="listOfValues">
    			<set>
    				<ref bean="blank" />
    			</set>
    		</property>
    		<property name="htmlTag">
    			<bean
    				class="com.aitworks.util.html.impl.HtmlTagImpl">
    				<property name="tag">
    					<value>input</value>
    				</property>
    				<property name="attributes">
    					<map>
    						<entry key="type" value="text"></entry>
    					</map>
    				</property>
    			</bean>
    		</property>
    	</bean>
    	
    	<bean id="memberType"
    		class="com.netmemex.netmx.util.impl.JdbcSearchPropertyImpl">
    		<property name="name">
    			<value>memberTypeCode</value>
    		</property>
    		<property name="display">
    			<value>Member Type</value>
    		</property>
    		<property name="dataType">
    			<value>String</value>
    		</property>
    		<property name="operators">
    			<set>
    				<ref bean="equalsOperator" />
    			</set>
    		</property>
    		<property name="listOfValuesQuery">
    			<value>from MemberType where indOrg.code=?</value>
    		</property>
    		<property name="listOfValues">
    			<set>
    				<ref bean="blank" />
    			</set>
    		</property>
    		<property name="listOfValuesQueryParameters">
    		<set>
    		   <value>I</value>
    		</set>
    		</property>
    		<property name="displayFieldName">
    			<value>desc</value>
    		</property>
    		<property name="valueFieldName">
    			<value>code</value>
    		</property>
    		<property name="htmlTag">
    			<bean
    				class="com.aitworks.util.html.impl.HtmlTagImpl">
    				<property name="tag">
    					<value>select</value>
    				</property>
    			</bean>
    		</property>
    	</bean>
    	
    	<bean id="state"
    		class="com.netmemex.netmx.util.impl.JdbcSearchPropertyImpl">
    		<property name="name">
    			<value>stateCode</value>
    		</property>
    		<property name="display">
    			<value>State</value>
    		</property>
    		<property name="dataType">
    			<value>String</value>
    		</property>
    		<property name="operators">
    			<set>
    				<ref bean="equalsOperator" />
    			</set>
    		</property>
    		<property name="listOfValues">
    			<set>
    				<ref bean="blank" />
    			</set>
    		</property>
    		<property name="listOfValuesQuery">
    			<value>from State</value>
    		</property>
    		<property name="displayFieldName">
    			<value>name</value>
    		</property>
    		<property name="valueFieldName">
    			<value>code</value>
    		</property>
    		<property name="htmlTag">
    			<bean
    				class="com.aitworks.util.html.impl.HtmlTagImpl">
    				<property name="tag">
    					<value>select</value>
    				</property>
    			</bean>
    		</property>
    	</bean>
    
    	<bean id="blank"
    		class="com.aitworks.util.impl.PropertyValueImpl">
    		<property name="value">
    			<value></value>
    		</property>
    		<property name="sequence">
    			<value>1</value>
    		</property>
    	</bean>
    I would really appreciate any suggestions. Thanks for reading

    ~s.
Working...
X