Thank you for visiting! If you liked the site, please add a bookmark, else add a critical comment! Would you like to visit Greece? Traditional Greek flag This real estate site is only available in Greek! The holy mountain
Showing posts with label Fusion ADF JDeveloper 11g. Show all posts
Showing posts with label Fusion ADF JDeveloper 11g. Show all posts

Saturday 1 February 2014

JDeveloper 12c to 11g backwards migration

In case you could not wait to migrate your last project to the currently newer version of JDeveloper 12c, you might have been disappointed with several recurring  errors, or an entire EJB 3 application not running at all.
Familiar or not?


In this new post a solution for returning to the older version will be presented, for those who receive an error message that the workspace cannot open any more with JDeveloper 11g . The exact phrasing is: " Unable to load application file. Workspace already migrated to newer version (12.1.2.0.0)".

Migration can still be undone!

One needs to edit the .jws workspace with an editor, first commenting out the lines mentioning the 12.1.2.0.0 version like this:

<?xml version = '1.0' encoding = 'UTF-8'?>
<jws:workspace xmlns:jws="http://xmlns.oracle.com/ide/project">
   <hash n="adrs-workspace-properties">
      <value n="adrs-instance-binding" v="DefaultServer"/>
      <value n="deploy-timeout" v="0"/>
      <value n="runtime-application-name" v="ejb3inaction"/>
   </hash>
   <hash n="adrs-workspace-weblogic-properties">
      <value n="hot-class-reload" v="ide-default"/>
   </hash>
   <value n="application-package-prefix" v="actionbazaar"/>
   <url n="application-source-directory" path="src/"/>
   <value n="appTemplateId" v="#genericApplicationTemplate"/>
   <hash n="appWebServicePolicy">
      <value n="location"/>
      <value n="LOCATION_TYPE" v="policy.config.PolicyOptions.LocationType.FILE_STORE"/>
      <value n="SERVER_LOCATION" v="IntegratedWebLogicServer"/>
   </hash>
   <hash n="component-versions">
      <value n="oracle.adf.share.dt.migration.jps.JaznCredStoreMigratorHelper" v="11.1.1.1.0"/>
      <!--value n="oracle.adf.share.dt.migration.wsm.PolicyAttachmentMigratorHelper" v="12.1.2.0.0"/-->
<value n="oracle.adf.share.dt.migration.wsm.PolicyAttachmentMigratorHelper" v="11.1.2.0.0"/>     
<value n="oracle.adfdt.controller.adfc.source.migration.SavePointDataSourceForWLSMigrator" v="11.1.1.1.0"/>
      <value n="oracle.adfdtinternal.model.ide.security.extension.AdfSecurityMigrator" v="11.1.1.1.0.13"/>
      <value n="oracle.adfdtinternal.model.ide.security.wizard.AdfSecurityMigrator" v="11.1.1.1.0.13"/>
      <value n="oracle.ide.model.Project" v="11.1.1.1.0;11.1.2.0.0"/>
<!--value n="oracle.ide.model.Project" v="11.1.1.1.0;11.1.2.0.0;12.1.2.0.0"/-->     
<value n="oracle.jbo.dt.jdevx.deployment.JbdProjectMigrator" v="11.1.2.0.0"/>
      <value n="oracle.jdevimpl.appresources.ApplicationSrcDirMigrator" v="11.1.2.0.0"/>
      <value n="oracle.jdevimpl.deploy.ear.OarMigratorHelper" v="11.1.1.1.0"/>
      <value n="oracle.jdevimpl.deploy.mar.MarMigratorHelper" v="11.1.1.1.0"/>
      <value n="oracle.jdevimpl.deploy.migrators.JeeDeploymentMigrator" v="11.1.2.0.0"/>
      <value n="oracle.jdevimpl.xml.oc4j.ds.DataSourcesMigratorHelper" v="10.1.3.5.0"/>
      <value n="oracle.jdevimpl.xml.oc4j.jps.JpsConfigMigratorHelper" v="11.1.1.1.0.1"/>
      <value n="oracle.jdevimpl.xml.wl.WeblogicMigratorHelper" v="11.1.1.1.0"/>
      <value n="oracle.mds.internal.dt.deploy.base.MarMigratorHelper" v="11.1.1.1.0"/>
      <value n="oracle.mds.internal.dt.ide.migrator.MDSConfigMigratorHelper" v="11.1.1.0.5313"/>
   </hash>
   <list n="contentSets">
      <string v="oracle.mds.internal.dt.ide.appresources.MDSAppResourceCSProvider/MDSAppContentSet"/>
      <string v="oracle.jdeveloper.model.PathsConfiguration/ADFContentSet"/>
      <string v="oracle.jdeveloper.model.PathsConfiguration/ApplicationSrcContentSet"/>
      <string v="oracle.jdeveloper.model.PathsConfiguration/ApplicationLevelMavenPOMContentSet"/>
      <string v="oracle.jdeveloper.model.PathsConfiguration/ApplicationBuildToolContentSet"/>
      <string v="oracle.jdeveloper.model.PathsConfiguration/ResourceBundlesContentSet"/>
   </list>
   <list n="listOfChildren">
      <hash><url n="URL" path="Model/Model.jpr"/></hash>
      <hash><url n="URL" path="UserInterface/UserInterface.jpr"/></hash>
   </list>
   <hash n="oracle.jdeveloper.deploy.dt.DeploymentProfiles">
      <hash n="profileDefinitions">
         <hash n="ejb3inActionV2">
            <hash n="archiveOptions">
               <value n="compressed" v="true"/>
               <value n="hasManifest" v="true"/>
            </hash>
            <value n="defaultConnection" v="standalone"/>
            <hash n="dependencies">
               <list n="dependencyList">
                  <hash>
                     <value n="adapterClass" v="oracle.jdevimpl.deploy.common.ArchiveProfileDependable"/>
                     <url n="ownerURL" path="Model/Model.jpr"/>
                     <value n="pathInEar" v=""/>
                     <value n="profileName" v="ejb3inactionModel"/>
                  </hash>
                  <hash>
                     <value n="adapterClass" v="oracle.jdevimpl.deploy.common.ArchiveProfileDependable"/>
                     <url n="ownerURL" path="UserInterface/UserInterface.jpr"/>
                     <value n="pathInEar" v=""/>
                     <value n="profileName" v="ejb3inActionV2"/>
                  </hash>
               </list>
            </hash>
            <url n="earURL" path="deploy/ejb3inActionV2.ear"/>
            <value n="enterpriseAppName" v="ejb3inActionV2"/>
            <hash n="fileGroups">
               <list n="groups">
                  <hash>
                     <list n="contributors">
                        <hash>
                           <value n="type" v="9"/>
                        </hash>
                     </list>
                     <value n="displayName" v="Application Descriptors"/>
                     <hash n="filters">
                        <list n="rules">
                           <hash>
                              <value n="pattern" v="**"/>
                              <value n="type" v="0"/>
                           </hash>
                        </list>
                     </hash>
                     <value n="internalName" v="ear-metainf"/>
                     <value n="type" v="1"/>
                  </hash>
                  <hash>
                     <value n="displayName" v="Application Libraries"/>
                     <hash n="filters">
                        <list n="rules">
                           <hash>
                              <value n="pattern" v="xml.jar"/>
                              <value n="type" v="1"/>
                           </hash>
                           <hash>
                              <value n="pattern" v="xmlparserv2.jar"/>
                              <value n="type" v="1"/>
                           </hash>
                           <hash>
                              <value n="pattern" v="adf-controller-rt-common.jar"/>
                              <value n="type" v="1"/>
                           </hash>
                           <hash>
                              <value n="pattern" v="adf-controller-api.jar"/>
                              <value n="type" v="1"/>
                           </hash>
                           <hash>
                              <value n="pattern" v="adf-controller.jar"/>
                              <value n="type" v="1"/>
                           </hash>
                           <hash>
                              <value n="pattern" v="**"/>
                           </hash>
                        </list>
                     </hash>
                     <value n="internalName" v="libraries"/>
                     <list n="selectedLibraries"/>
                     <value n="targetWithinJar" v="lib"/>
                     <value n="type" v="3"/>
                  </hash>
               </list>
            </hash>
            <hash n="libraryDependencies">
               <list n="unselectedLibraries"/>
            </hash>
            <value n="profileClass" v="oracle.jdeveloper.deploy.ear.EarProfile"/>
            <value n="profileName" v="ejb3inActionV2"/>
         </hash>
      </hash>
      <list n="profileList">
         <string v="ejb3inActionV2"/>
      </list>
   </hash>
   <hash n="oracle.jdeveloper.deploy.SecurityDeploymentSettings">
      <value n="Security-Deployment-Migrate-Users-And-Groups-Key" v="true"/>
      <value n="Security-Deployment-Overwrite-Application-Policies-Key" v="true"/>
      <value n="Security-Deployment-Overwrite-Credentials-Key" v="true"/>
   </hash>
   <hash n="oracle.jdeveloper.model.PathsConfiguration">
      <hash n="ApplicationSrcContentSet">
         <list n="pattern-filters">
            <string v="+**"/>
         </list>
         <list n="url-path">
            <url path="src/"/>
         </list>
      </hash>
   </hash>
   <hash n="oracle.mds.internal.dt.ide.CustOptions">
      <list n="customizationLibraries">
         <hash/>
      </list>
   </hash>
   <hash n="Weblogic JDBC">
      <value n="Weblogic-JDBC-Auto-Sync-Key" v="false"/>
   </hash>
</jws:workspace>


Thus, by removing the references to  version 12.1.2.0.0 one can continue development with the older version and postpone the migration, if necessary. Finally, one can find  further migration details as usual here.




Thursday 19 April 2012

Farewell to ...ANT?

Following the articles by J.Stegeman and E.Biemond about building via ant scripts,  external to JDeveloper, one can quickly find out that the former does show how to create a war file, out of mostly .xml files, but not an ear; and the latter  misses on creating a war file out of the ViewController project! This article comes as supplement of both, showing how to jar the ejb3 model project,  to war the  ViewController, and lastly the external log4j library jar, assemble them in an ADF application ear and finally deploy to weblogic 10.3.4 application server.

First,  comes the model ant script:

<?xml version="1.0" encoding="UTF-8" ?>
<!--Ant buildfile runs only outside of JDeveloper-->
<!--Generated Apr 7, 2012 8:59:13 AM-->
<project name="Model" default="all" basedir=".">
  <property file="../Model/build.properties"/>
  <import file="../JDeveloperLibs/jdev-libs.xml"/>
  <path id="model.classpath">
    <pathelement location="classes"/>
    <pathelement location="../lib/log4j-1.2.15.jar"/>

    <path refid="JDeveloperLibs.library.EJB.3.0"/>
    <path refid="JDeveloperLibs.library.TopLink"/>
    <path refid="JDeveloperLibs.library.Java.EE.1.5.API"/>
    <path refid="JDeveloperLibs.library.WebLogic.10.3.Remote-Client"/>
    <path refid="JDeveloperLibs.library.ADF.Model.Runtime"/>
    <path refid="JDeveloperLibs.library.ADF.Model.Generic.Runtime"/>
    <path refid="JDeveloperLibs.library.Resource.Bundle.Support"/>
    <path refid="JDeveloperLibs.library.ADF.Common.Runtime"/>
    <!--path refid="JDeveloperLibs.library.Log4j-1.2.15.jar"/-->
    <path refid="JDeveloperLibs.library.Oracle.JDBC"/>
    <path refid="JDeveloperLibs.library.MDS.Runtime"/>
    <path refid="JDeveloperLibs.library.Oracle.XML.Parser.v2"/>
  </path>
  <target name="model.init">
    <tstamp/>
    <mkdir dir="${model.output.dir}"/>
    <mkdir dir="${model.deploy.dir}"/>
  </target>
  <target name="model.all" description="Build the project"
          depends="model.compile,model.copy"/>
  <target name="model.clean" description="Clean the project">
    <delete includeemptydirs="true" quiet="true">
      <fileset dir="${model.output.dir}" includes="**/*"/>
      <fileset dir="${model.deploy.dir}" includes="**/*"/>
    </delete>
  </target>
  <target name="model.compile" description="Compile Java source files"
          depends="model.init">
    <javac destdir="${model.output.dir}" classpathref="model.classpath"
           debug="${javac.debug}" nowarn="${javac.nowarn}"
           deprecation="${javac.deprecation}" encoding="UTF-8" source="1.6"
           target="1.6">
      <src path="../lib"/>
    </javac>
    <javac destdir="${model.output.dir}" classpathref="model.classpath"
           debug="${javac.debug}" nowarn="${javac.nowarn}"
           deprecation="${javac.deprecation}" encoding="UTF-8" source="1.6"
           target="1.6">
      <src path="${model.src.dir}"/>
    </javac>
  </target>
  <target name="model.copy" description="Copy files to output directory"
          depends="model.init">
    <patternset id="copy.patterns">
      <include name="**/*.gif"/>
      <include name="**/*.jpg"/>
      <include name="**/*.jpeg"/>
      <include name="**/*.png"/>
      <include name="**/*.properties"/>
      <include name="**/*.xml"/>
      <include name="**/*.ejx"/>
      <include name="**/*.xcfg"/>
      <include name="**/*.cpx"/>
      <include name="**/*.dcx"/>
      <include name="**/*.sva"/>
      <include name="**/*.wsdl"/>
      <include name="**/*.ini"/>
      <include name="**/*.tld"/>
      <include name="**/*.tag"/>
      <include name="**/*.xlf"/>
      <include name="**/*.xsl"/>
      <include name="**/*.xsd"/>
      <exclude name="**/persistence.xml"/>
        <exclude name="**/weblogic-ejb-jar.xml"/>
    </patternset>
    <copy todir="${model.output.dir}">
      <fileset dir="${model.src.dir}">
        <patternset refid="copy.patterns"/>
      </fileset>
      <fileset dir="../lib">
        <patternset refid="copy.patterns"/>
      </fileset>
    </copy>
    <copy todir="${model.output.dir}">
      <fileset dir="../Model/adfmsrc">
        <patternset refid="copy.patterns"/>
         <include name="../Model/adfmsrc/actionbazaar/DataControls.dcx"/>
      </fileset>
    </copy>
  </target>
  <target name="model.jar" depends="model.compile,model.copy">
    <jar destfile="${model.deploy.dir}/${model.jar.file}" >
      <fileset dir="${model.output.dir}">
        <include name="**/*.class"/>
        <include name="**/*.xml"/>
        <include name="**/*.dcx"/>
         <exclude name="**/*.java"/>
        <exclude name="**/**/actionbazaar/buslogic/client/**"/>
      </fileset>
      <fileset dir="${model.src.dir}/">
        <include name="META-INF/persistence.xml"/>
        <include name="META-INF/**"/>
        <include name="**/*.xml"/>
        <include name="**/*.dcx"/>
        <include name="**/*.properties"/>
        <exclude name="**/*.java"/>
        <exclude name="**/build.xml"/>
        <exclude name="**/build.properties"/>
      </fileset>
    </jar>
  </target>
</project>

Second, the userinterface or ViewController one:

<?xml version="1.0" encoding="UTF-8" ?>
<!--Generated Apr 7, 2012 9:24:35 AM-->
<project name="UserInterface" default="UserInterface.ear" basedir=".">
  <taskdef name="wldeploy"
           classname="weblogic.ant.taskdefs.management.WLDeploy"/>
  <taskdef resource="net/sf/antcontrib/antlib.xml">
    <classpath>
      <pathelement location="${ant.lib.folder}/lib/ant-contrib.jar"/>
    </classpath>
  </taskdef>
  <property file="../UserInterface/build.properties"/>
  <import file="../JDeveloperLibs/jdev-libs.xml"/>
  <import file="../Model/build.xml"/>
  <import file="Datasource.xml"/>
  <path id="UserInterface.classpath">
    <pathelement location="../Model/classes"/>
    <pathelement location="../lib/log4j-1.2.15.jar"/>
    <!--path refid="JDeveloperLibs.library.JSTL.1.2"/-->
    <path refid="JDeveloperLibs.library.JSTL.1.2.Tags"/>
    <path refid="JDeveloperLibs.library.JSF.1.2"/>
    <path refid="JDeveloperLibs.library.ADF.Faces.Runtime.11"/>
    <path refid="JDeveloperLibs.library.ADF.Common.Runtime"/>
    <path refid="JDeveloperLibs.library.JSP.Runtime"/>
    <path refid="JDeveloperLibs.library.ADF.DVT.Core.Runtime"/>
    <path refid="JDeveloperLibs.library.ADF.DVT.Faces.Runtime"/>
    <path refid="JDeveloperLibs.library.ADF.DVT.Faces.Databinding.Runtime"/>
    <path refid="JDeveloperLibs.library.ADF.Faces.Databinding.Runtime"/>
    <path refid="JDeveloperLibs.library.ADF.Page.Flow.Runtime"/>
    <path refid="JDeveloperLibs.library.ADF.Model.Runtime"/>
    <path refid="JDeveloperLibs.library.ADF.Controller.Runtime"/>
    <path refid="JDeveloperLibs.library.ADF.Web.Runtime"/>
    <path refid="JDeveloperLibs.library.MDS.Runtime"/>
    <path refid="JDeveloperLibs.library.EJB.Data.Control"/>
    <path refid="JDeveloperLibs.library.EJB.3.0"/>
    <path refid="JDeveloperLibs.library.TopLink"/>
    <path refid="JDeveloperLibs.library.Java.EE.1.5.API"/>
    <path refid="JDeveloperLibs.library.WebLogic.10.3.Remote-Client"/>
    <path refid="JDeveloperLibs.library.Resource.Bundle.Support"/>
    <path refid="JDeveloperLibs.library.ADF.Controller.Schema"/>
    <path refid="JDeveloperLibs.library.MDS.Runtime.Dependencies"/>
    <path refid="JDeveloperLibs.library.Commons.Beanutils.1.6"/>
    <path refid="JDeveloperLibs.library.Commons.Logging.1.0.4"/>
    <path refid="JDeveloperLibs.library.Commons.Collections.3.1"/>
    <path refid="JDeveloperLibs.library.ADF.DVT.Faces.Databinding.MDS.Runtime"/>
    <path refid="JDeveloperLibs.library.Oracle.JDBC"/>
    <path refid="JDeveloperLibs.library.Oracle.JEWT"/>
    <path refid="JDeveloperLibs.library.BC4J.Security"/>
    <path refid="JDeveloperLibs.library.ADF.Common.Web.Runtime"/>
    <path refid="JDeveloperLibs.library.Servlet.Runtime"/>
    <path refid="JDeveloperLibs.library.Resource.Bundle.Variable.Resolver"/>
    <path refid="JDeveloperLibs.library.Trinidad.Runtime.11"/>
    <path refid="JDeveloperLibs.library.Trinidad.Databinding.Runtime"/>
  </path>
  <target name="UserInterface.init">
    <tstamp/>
    <mkdir dir="${UserInterface.output.dir}"/>
    <mkdir dir="${UserInterface.deploy.dir}"/>
  </target>
  <target name="UserInterface.all" description="Build the project"
          depends="UserInterface.compile,UserInterface.copy"/>
  <target name="UserInterface.clean" description="Clean the project">
    <delete includeemptydirs="true" quiet="true">
      <fileset dir="${UserInterface.output.dir}" includes="**/*"/>
      <fileset dir="${UserInterface.deploy.dir}" includes="**/*"/>
      <fileset dir="${model.output.dir}" includes="**/*"/>
      <fileset dir="${model.deploy.dir}" includes="**/*"/>
    </delete>
  </target>
  <target name="UserInterface.compile" description="Compile Java source files"
          depends="UserInterface.init,model.compile">
    <javac destdir="${UserInterface.output.dir}"
           classpathref="UserInterface.classpath" debug="${javac.debug}"
           nowarn="${javac.nowarn}" deprecation="${javac.deprecation}"
           encoding="UTF-8" source="1.6" target="1.6">
      <src path="../lib"/>
    </javac>
    <javac destdir="${UserInterface.output.dir}"
           classpathref="UserInterface.classpath" debug="${javac.debug}"
           nowarn="${javac.nowarn}" deprecation="${javac.deprecation}"
           encoding="UTF-8" source="1.6" target="1.6">
      <src path="${UserInterface.src.dir}"/>
    </javac>
  </target>
  <target name="UserInterface.copy" description="Copy files to output directory"
          depends="UserInterface.init">
    <patternset id="copy.patterns">
      <include name="**/*.jspx"/>
      <include name="**/*.gif"/>
      <include name="**/*.jpg"/>
      <include name="**/*.jpeg"/>
      <include name="**/*.png"/>
      <include name="**/*.properties"/>
      <include name="**/*.xml"/>
      <include name="**/*.ejx"/>
      <include name="**/*.xcfg"/>
      <include name="**/*.cpx"/>
      <include name="**/*.dcx"/>
      <include name="**/*.sva"/>
      <include name="**/*.wsdl"/>
      <include name="**/*.ini"/>
      <include name="**/*.tld"/>
      <include name="**/*.tag"/>
      <include name="**/*.xlf"/>
      <include name="**/*.xsl"/>
      <include name="**/*.xsd"/>
      <include name="**/*.sso"/>
    </patternset>
    <patternset id="webfile.patterns">
      <include name="**/*.html"/>
      <include name="**/*.jspx"/>
      <include name="**/images/*.jpg"/>
    </patternset>
    <patternset id="webinf.patterns">
      <include name="WEB-INF/**/*.xml"/>
      <include name="**/WEB-INF/lib/*.jar"/>
    </patternset>
    <patternset id="library.patterns">
      <!--include name="**/glassfish.jsf_1.0.0.0_1-2-15.jar"/>
      <include name="**/glassfish.jstl_1.2.0.1.jar"/>
      <include name="**/javax.jsf_1.1.0.0_1-2.jar"/>
      <include name="**/wls.jsf.di.jar"/-->
      <include name="**/log4j-1.2.15.jar"/>
      <include name="**/adf-loc.jar"/>
      <exclude name="**/modules/javax.jsf_1.1.0.0_1-2.jar"/>
    </patternset>
    <copy todir="${UserInterface.output.dir}">
      <fileset dir="${UserInterface.src.dir}">
        <patternset refid="copy.patterns"/>
      </fileset>
      <fileset dir="../lib">
        <patternset refid="copy.patterns"/>
      </fileset>
    </copy>
    <copy todir="${UserInterface.output.dir}">
      <fileset dir="../UserInterface/adfmsrc">
        <patternset refid="copy.patterns"/>
      </fileset>
    </copy>
  </target>
  <target name="UserInterface.war"
          depends="UserInterface.copy,UserInterface.compile,model.copy">
    <war destfile="${UserInterface.deploy.dir}/${UserInterface.war.file}"
         webxml="${UserInterface.html.dir}/WEB-INF/web.xml">
      <zipfileset dir="${UserInterface.html.dir}">
        <patternset refid="webinf.patterns"/>
      </zipfileset>
      <zipfileset dir="${UserInterface.html.dir}">
        <patternset refid="webfile.patterns"/>
      </zipfileset>
      <zipfileset dir="${UserInterface.output.dir}" prefix="WEB-INF/classes">
        <exclude name=".data/**"/>
        <exclude name="**/*.cdi"/>
        <exclude name="**/build.xml"/>
        <exclude name="**/build.properties"/>
        <exclude name="**/*.java"/>
        <exclude name="**/log4j-1.2.15.jar"/>
        <exclude name="**/WEB-INF/temp/**"/>
      </zipfileset>
    </war>
  </target>
  <target name="UserInterface.ear" depends="UserInterface.war,model.jar">
    <mkdir dir="${UserInterface.deploy.dir}\META-INF"/>
    <mkdir dir="${UserInterface.deploy.dir}\lib"/>
    <copy todir="${UserInterface.deploy.dir}\lib">
      <zipfileset file="..\lib\*.jar" prefix="lib"/>
    </copy>
      <copy todir="${UserInterface.deploy.dir}\META-INF">
         <fileset dir="${project.src.dir}\META-INF" excludes="application.xml"
               includes="cwallet.sso">
        <patternset refid="copy.patterns"/>
      </fileset>
    </copy>
    <copy todir="${UserInterface.deploy.dir}\adf\META-INF">
      <fileset dir="..\.adf\META-INF">
        <patternset refid="copy.patterns"/>
      </fileset>
    </copy>
    <copy file="${UserInterface.deploy.dir}/${UserInterface.war.file}"
          todir="${UserInterface.deploy.dir}"/>
    <copy file="${model.deploy.dir}/${model.jar.file}"
          todir="${UserInterface.deploy.dir}"/>
    <ear basedir="${UserInterface.deploy.dir}"
         destfile="${UserInterface.deploy.dir}/${UserInterface.ear.file}"
         appxml="${project.src.dir}/META-INF/application.xml">
      <zipfileset dir="../JDeveloperLibs" prefix="lib">
        <patternset refid="library.patterns"/>
      </zipfileset>
          </ear>
  </target>
  <target name="UserInterface.autodeploy" depends="UserInterface.ear">
    <copy file="${UserInterface.deploy.dir}/${UserInterface.ear.file}"
          todir="${weblogic.home}/${weblogic.deploy.dir}"/>
  </target>
  <target name="UserInterface.deploy"
          depends="UserInterface.clean,UserInterface.ear,JDBC">
    <echo message="Start undeploying application..."></echo>
    <wldeploy action="undeploy" verbose="true" debug="true" name="${project}"
              adminurl="t3://${host}:${port}" user="${username}"
              password="${password}" targets="${target.server}"
              failonerror="false"/>
    <wldeploy action="deploy" verbose="true" debug="true" name="${project}"
              adminurl="t3://${host}:${port}" user="${username}"
              password="${password}" targets="${target.server}"
              failonerror="false"
              source="${UserInterface.deploy.dir}/${UserInterface.ear.file}"
              remote="true" upload="true"/>
    <echo message="END OF DEPLOYING APPLICATION"></echo>
  </target>
</project>


Finally, a word of caution: using ant nowdays seems to many people a waste of time or efford, when compared to modern solutions such as maven, well presented here by Dana Singleterry. As usual, one can find far more information, including source code, below.

REFERENCES
http://biemond.blogspot.com/2009/04/weblogic-jdeveloper-ant-tasks.html
http://www.oracle.com/technetwork/articles/adf/part4-098813.html
http://tompeez.wordpress.com/2012/02/07/jdeveloper-gem-debug-ant-scripts by Timo Hahn

Tuesday 20 March 2012

Obtaining the selected values of a selectManyChoice component

Searching for selectManyChoice  in the J2EE or fusion  11g developer guides does not return more than a series of drag and drop instructions. Again, the programmer is left at one's own devises, to improvise in order to find the solution. This is no exception to the rule that when in need or emergency, the only thing one is certain to find in a technical guide document is missing information! Even the difference in the  number of pages between the two guides is huge; showing a heavy bias to using ADF based on business components, only. 
This post is a jsf and ejb 3 full source code example, including necessary import statements; showing how to snag the user selections, when a selectManyChoice component  is used.  It could be considered as a complement to the article named:

How to access selected rows in an af:selectManyChoice component, by Frank Nimphius


which focuses only on ADF business components. Two versions of the code will follow, a ADF (licensed) and an open source one. 

First, the ADF version:

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
  <jsp:directive.page contentType="text/html;charset=UTF-8"/>
  <f:view>
    <af:document id="d1" title="Create new order"
                 binding="#{backingBeanScope.backing_createOrder.d1}">
      <af:messages id="m1"
                   binding="#{backingBeanScope.backing_createOrder.m1}"/>
      <af:form id="f1" binding="#{backingBeanScope.backing_createOrder.f1}">
        <af:pageTemplate viewId="/WEB-INF/templates/templateABDef.jspx"
                         id="pt1">
          <f:facet name="content">
            <af:panelStretchLayout id="psl1"
                                   binding="#{backingBeanScope.backing_createOrder.psl1}">
              <f:facet name="center">
                <af:panelFormLayout id="pfl1"
                                    binding="#{backingBeanScope.backing_createOrder.pfl1}">
                  <af:selectManyChoice label="Select one or more items"
                                       binding="#{backingBeanScope.backing_createOrder.smc1}"
                                       id="smc1">
                    <f:selectItems value="#{backingBeanScope.backing_createOrder.allItems}"
                                   binding="#{backingBeanScope.backing_createOrder.si1}"
                                   id="si1"/>
                  </af:selectManyChoice>
                  <af:selectOneChoice label="Billing Info"
                                      binding="#{backingBeanScope.backing_createOrder.soc1}"
                                      id="soc1">
                    <f:selectItems value="#{backingBeanScope.backing_createOrder.allBillingInfos}"
                                   binding="#{backingBeanScope.backing_createOrder.si2}"
                                   id="si2"/>
                  </af:selectOneChoice>
                  <af:inputText value="#{securityContext.userName}"
                                label="#{bindings.bidderId.hints.label}"
                                required="#{bindings.bidderId.hints.mandatory}"
                                columns="#{bindings.bidderId.hints.displayWidth}"
                                maximumLength="#{bindings.bidderId.hints.precision}"
                                shortDesc="#{bindings.bidderId.hints.tooltip}"
                                id="it3"
                                binding="#{backingBeanScope.backing_createOrder.it3}"
                                rendered="true">
                    <f:validator binding="#{bindings.bidderId.validator}"/>
                  </af:inputText>
                  <af:selectOneChoice label="Shipping info"
                                      binding="#{backingBeanScope.backing_createOrder.soc2}"
                                      id="soc2">
                    <f:selectItems value="#{backingBeanScope.backing_createOrder.allShippingInfos}"
                                   binding="#{backingBeanScope.backing_createOrder.si3}"
                                   id="si3"/>
                  </af:selectOneChoice>
                  <af:commandButton text="create order"
                                    binding="#{backingBeanScope.backing_createOrder.cb1}"
                                    id="cb1"
                                    action="#{backingBeanScope.backing_createOrder.createNewOrder}"/>
                </af:panelFormLayout>
              </f:facet>
            </af:panelStretchLayout>
          </f:facet>
        </af:pageTemplate>
      </af:form>
    </af:document>
  </f:view>
  <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_createOrder-->
</jsp:root>

The bean:

package actionbazaar.view.backing;


import actionbazaar.buslogic.PlaceBillingInfo;
import actionbazaar.buslogic.PlaceItem;
import actionbazaar.buslogic.PlaceOrder;
import actionbazaar.buslogic.PlaceShippingInfo;

import actionbazaar.persistence.BillingInfo;
import actionbazaar.persistence.Item;
import actionbazaar.persistence.ShippingInfo;

import actionbazaar.view.CustomBackingBean;

import java.util.ArrayList;
import java.util.List;

import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;

import javax.faces.application.Application;
import javax.faces.component.UISelectItems;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;

import javax.naming.InitialContext;
import javax.naming.NamingException;

import oracle.adf.share.ADFContext;
import oracle.adf.view.rich.component.rich.RichDocument;
import oracle.adf.view.rich.component.rich.RichForm;
import oracle.adf.view.rich.component.rich.input.RichInputText;
import oracle.adf.view.rich.component.rich.input.RichSelectManyChoice;
import oracle.adf.view.rich.component.rich.input.RichSelectOneChoice;
import oracle.adf.view.rich.component.rich.layout.RichPanelFormLayout;
import oracle.adf.view.rich.component.rich.layout.RichPanelStretchLayout;
import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
import oracle.adf.view.rich.component.rich.output.RichMessages;


public class CreateOrder extends CustomBackingBean {
    private RichInputText it3;
    private RichPanelFormLayout pfl1;
    private RichPanelStretchLayout psl1;
    private RichForm f1;
    private RichMessages m1;
    private RichDocument d1;
   
    private String bidderId ;
    private ArrayList<SelectItem> allItems;
    private ArrayList<SelectItem> orderItems;
    private ArrayList<SelectItem> shippingInfos;
    private ArrayList<SelectItem> billingInfos;

    private RichCommandButton cb1;
    private RichSelectOneChoice soc1;
    private UISelectItems si2;
    private RichSelectOneChoice soc2;
    private UISelectItems si3;
    private RichSelectManyChoice smc1;
    private UISelectItems si1;

    public CreateOrder() {
      bidderId = ADFContext.getCurrent().getSecurityContext().getUserName();
     // getAllBillingInfos();
      //getAllShippingInfos();
    }

  public ArrayList<SelectItem> getAllItems() {
   try {
       InitialContext context = new InitialContext();
       PlaceItem beanRemote = (PlaceItem) context.lookup( "ejb3inaction-Model-PlaceItem#actionbazaar.buslogic.PlaceItem");
       List<Item> allItems = beanRemote.getItemFindAll();
       orderItems = new ArrayList<SelectItem>(allItems.size());
       for (Item item : allItems) {
             Long itemId = item.getItemId();
             String itemName= item.getItemName();
             SelectItem selectItem = new SelectItem(itemId, itemName);
             orderItems.add(selectItem);
       }
         logger.debug("orderItems.size() " + orderItems.size());
         this.setOrderItems(orderItems);
       } catch (NamingException e) {
           System.err.println(e.getMessage());
   }
     return orderItems;
   }
 
  public ArrayList<SelectItem> getAllBillingInfos() {
   try {
         InitialContext context = new InitialContext();
         PlaceBillingInfo beanRemote1 = (PlaceBillingInfo)context.lookup("ejb3inaction-Model-PlaceBillingInfo#actionbazaar.buslogic.PlaceBillingInfo");
                      
         List<BillingInfo> alllBillingInfos = beanRemote1.getBillingInfoFindByUserId(bidderId);
         billingInfos = new ArrayList<SelectItem>(alllBillingInfos.size());
         for (BillingInfo bi : alllBillingInfos) {
             Long billingId = bi.getBillingId();
             String billingName= bi.getAccountNo() + " " + bi.getCardType() + " " + bi.getExpiryDate() +" " + bi.getSecretCode();
             SelectItem selectItem1 = new SelectItem(billingId, billingName);
             billingInfos.add(selectItem1);
       }
         logger.debug("billingInfos.size() " + billingInfos.size());
       this.setBillingInfos(billingInfos);
       } catch (NamingException e) {
           System.err.println(e.getMessage());
   }
   return billingInfos;
   }

   public ArrayList<SelectItem> getAllShippingInfos() {
   try {
       InitialContext context = new InitialContext();
       PlaceShippingInfo beanRemote2 = (PlaceShippingInfo)context.lookup("ejb3inaction-Model-PlaceShippingInfo#actionbazaar.buslogic.PlaceShippingInfo");
       List<ShippingInfo> allShippingInfos = beanRemote2.getShippingInfoFindAll();
       shippingInfos = new ArrayList<SelectItem>(allShippingInfos.size());
       for (ShippingInfo si : allShippingInfos) {
             Long ShippingInfoId = si.getShippingId();
             String ShippingInfoName= si.getStreet() + " " + si.getCity() + " " + si.getState();
             SelectItem selectItem2 = new SelectItem(ShippingInfoId, ShippingInfoName);
             shippingInfos.add(selectItem2);
       }
         logger.debug("shippingInfos.size() " + shippingInfos.size());
         this.setShippingInfos(shippingInfos);
       } catch (NamingException e) {
           System.err.println(e.getMessage());
   }
   return shippingInfos;
   }
 
  public Object createNewOrder() {
        try {
                              
                  FacesContext ctx = FacesContext.getCurrentInstance();
                  ELContext ectx =ctx.getELContext();
                  Application app = ctx.getApplication();
                  ExpressionFactory factory = app.getExpressionFactory();
                /*  An alternate way which works too*/
                /*
                 java.util.ArrayList billingIdUIComponents = (java.util.ArrayList)si2.getValue();
                 SelectItem billingIdItem=(SelectItem)billingIdUIComponents.get(0);
                 Long billingId = new Long( billingIdItem.getValue().toString() );
                 */
                  ValueExpression ve =   factory.createValueExpression(ectx,   "#{backingBeanScope.backing_createOrder.soc1.value}",Object.class );
                  Long billingId = new Long(ve.getValue(ectx).toString());
                  ValueExpression ve1= factory.createValueExpression(ectx,   "#{backingBeanScope.backing_createOrder.soc2.value}",Object.class );
                  Long shippingId = new Long( ve1.getValue(ectx).toString());
                 ValueExpression ve2= factory.createValueExpression(ectx,   "#{backingBeanScope.backing_createOrder.smc1.value}",Object.class );
                 /*selectManyChoice working alternate*/
               /*   ArrayList<Object> selectedItemsId =  (ArrayList<Object>)ve2.getValue(ectx);
                 ArrayList<Long> itemsId = new ArrayList<Long>(selectedItemsId.size());
                 for (int i = 0; i < selectedItemsId.size(); i++) {
                      Long val = new Long(selectedItemsId.get(i).toString());
                      logger.debug( "itemId " + val);
                      itemsId.add(val);
                  }
               */
                   
                 ArrayList itemIdUIComponents = (java.util.ArrayList)si1.getValue();
                 ArrayList<Long> itemsId = new ArrayList<Long>(itemIdUIComponents.size());
                 for (int i = 0; i < itemIdUIComponents.size(); i++) {
                      SelectItem selectedItemsId =(SelectItem)itemIdUIComponents.get(i);
                      Long itemId = new Long( selectedItemsId.getValue().toString() );
                      itemsId.add(itemId);
                }
               
         
       
                 if (logger.isDebugEnabled())
                         logger.debug(  "bidderId " + bidderId +"  billingId " + billingId +  " shippingId " + shippingId);
                 InitialContext context = new InitialContext();
                 PlaceOrder facadeSessionEJB = (PlaceOrder)context.lookup("ejb3inaction-Model-PlaceOrder#actionbazaar.buslogic.PlaceOrder");
                 facadeSessionEJB.addOrder(bidderId, itemsId, shippingId, billingId );
                 if (logger.isDebugEnabled())
                         logger.debug(  "itemsId " + itemsId.get(0) +"  billingId " +  " shippingId " );
               } catch (NamingException e) {
                    System.err.println(e.getMessage());
               }
         return null;
    }


    public void setIt3(RichInputText it3) {
        this.it3 = it3;
    }

    public RichInputText getIt3() {
        return it3;
    }


    public void setPfl1(RichPanelFormLayout pfl1) {
        this.pfl1 = pfl1;
    }

    public RichPanelFormLayout getPfl1() {
        return pfl1;
    }

    public void setPsl1(RichPanelStretchLayout psl1) {
        this.psl1 = psl1;
    }

    public RichPanelStretchLayout getPsl1() {
        return psl1;
    }

    public void setF1(RichForm f1) {
        this.f1 = f1;
    }

    public RichForm getF1() {
        return f1;
    }

    public void setM1(RichMessages m1) {
        this.m1 = m1;
    }

    public RichMessages getM1() {
        return m1;
    }

    public void setD1(RichDocument d1) {
        this.d1 = d1;
    }

    public RichDocument getD1() {
        return d1;
    }

    public void setAllItems(ArrayList<SelectItem> allItems) {
        this.allItems = allItems;
    }

    public void setOrderItems(ArrayList<SelectItem> orderItems) {
        this.orderItems = orderItems;
    }


    public void setCb1(RichCommandButton cb1) {
        this.cb1 = cb1;
    }

    public RichCommandButton getCb1() {
        return cb1;
    }

    public void setShippingInfos(ArrayList<SelectItem> shippingInfos) {
        this.shippingInfos = shippingInfos;
    }

    public void setBillingInfos(ArrayList<SelectItem> billingInfos) {
        this.billingInfos = billingInfos;
    }

    public void setSoc1(RichSelectOneChoice soc1) {
        this.soc1 = soc1;
    }

    public RichSelectOneChoice getSoc1() {
        return soc1;
    }

    public void setSi2(UISelectItems si2) {
        this.si2 = si2;
    }

    public UISelectItems getSi2() {
        return si2;
    }

    public void setSoc2(RichSelectOneChoice soc2) {
        this.soc2 = soc2;
    }

    public RichSelectOneChoice getSoc2() {
        return soc2;
    }

    public void setSi3(UISelectItems si3) {
        this.si3 = si3;
    }

    public UISelectItems getSi3() {
        return si3;
    }

    public void setSmc1(RichSelectManyChoice smc1) {
        this.smc1 = smc1;
    }

    public RichSelectManyChoice getSmc1() {
        return smc1;
    }

    public void setSi1(UISelectItems si1) {
        this.si1 = si1;
    }

    public UISelectItems getSi1() {
        return si1;
    }
}


Second, the J2EE open source version, starting with the page:

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html">
    <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
                doctype-system="http://www.w3.org/TR/html4/loose.dtd"
                doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
        <html>
            <head>
                <meta http-equiv="Content-Type"
                      content="text/html; charset=UTF-8"/>
                <h:messages/>
            </head>
            <body>
                <div align="center">
                    <h:form>
                        <h:panelGrid columns="2"
                                     binding="#{backing_createOrder.panelGrid11}"
                                     id="panelGrid11"
                                     style="vertical-align:middle;">
                            <h:outputLabel value="Select items"
                                           binding="#{backing_createOrder.outputLabel31}"
                                           id="outputLabel31"/>
                            <h:selectManyListbox binding="#{backing_createOrder.selectManyListbox11}"
                                                 id="selectManyListbox11"
                                                 required="true">
                                <f:selectItems value="#{backing_createOrder.allItems}"
                                               binding="#{backing_createOrder.selectItems41}"
                                               id="selectItems41"/>
                            </h:selectManyListbox>
                            <h:outputLabel value="Bidder"
                                           binding="#{backing_createOrder.outputLabel11}"
                                           id="outputLabel11"/>
                            <h:inputText binding="#{backing_createOrder.inputText11}"
                                         id="inputText11"
                                         value="#{backing_createOrder.bidderId}"/>
                            <h:outputLabel value="Billing details"
                                           binding="#{backing_createOrder.outputLabel21}"
                                           id="outputLabel21"/>
                            <h:selectOneListbox label="BillingInfo"
                                                binding="#{backing_createOrder.selectOneListbox11}"
                                                id="selectOneListbox11"
                                                required="true">
                                <f:selectItems value="#{backing_createOrder.allBillingInfos}"
                                               binding="#{backing_createOrder.selectItems21}"
                                               id="selectItems21"/>
                            </h:selectOneListbox>
                            <h:outputLabel value="Shipping details"
                                           binding="#{backing_createOrder.outputLabel41}"
                                           id="outputLabel41"/>
                            <h:selectOneListbox label="ShippingInfo"
                                                binding="#{backing_createOrder.selectOneListbox21}"
                                                id="selectOneListbox21"
                                                required="true">
                                <f:selectItems value="#{backing_createOrder.allShippingInfos}"
                                               binding="#{backing_createOrder.selectItems31}"
                                               id="selectItems31"/>
                            </h:selectOneListbox>
                            <f:facet name="footer">
                                <h:panelGroup binding="#{backing_createOrder.panelGroup1}"
                                              id="panelGroup1">
                                    <input type="reset" name="Reset"
                                           value="Reset"/>
                                    <h:commandButton value="create Order"
                                                     binding="#{backing_createOrder.commandButton11}"
                                                     id="commandButton11"
                                                     action="#{backing_createOrder.createNewOrder}"/>
                                </h:panelGroup>
                            </f:facet>
                            <f:facet name="header">
                                <h:outputFormat value="Create new order"
                                                binding="#{backing_createOrder.outputFormat11}"
                                                id="outputFormat11"/>
                            </f:facet>
                        </h:panelGrid>
                    </h:form>
                </div>
            </body>
        </html>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_createOrder-->
</jsp:root>

Finally, the bean:

package actionbazaar.backing;


import actionbazaar.buslogic.PlaceBillingInfo;
import actionbazaar.buslogic.PlaceItem;
import actionbazaar.buslogic.PlaceOrder;
import actionbazaar.buslogic.PlaceShippingInfo;

import actionbazaar.persistence.BillingInfo;
import actionbazaar.persistence.Item;
import actionbazaar.persistence.Order;
import actionbazaar.persistence.ShippingInfo;

import java.util.ArrayList;
import java.util.List;

import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;

import javax.faces.application.Application;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.component.UISelectItems;
import javax.faces.component.html.HtmlCommandButton;
import javax.faces.component.html.HtmlInputText;
import javax.faces.component.html.HtmlOutputFormat;
import javax.faces.component.html.HtmlOutputLabel;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.component.html.HtmlPanelGroup;
import javax.faces.component.html.HtmlSelectManyListbox;
import javax.faces.component.html.HtmlSelectOneListbox;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;

import javax.naming.InitialContext;
import javax.naming.NamingException;

import javax.servlet.http.HttpServletRequest;


@ManagedBean(name="backing_createOrder")
@RequestScoped
public class CreateOrder extends CustomBackingBean{
   
    private ArrayList<SelectItem> allItems;
    private ArrayList<SelectItem> orderItems;
    private ArrayList<SelectItem> shippingInfos;
    private ArrayList<SelectItem> billingInfos;
    private String bidderId  ;
    private FacesContext ctx;
    private ExternalContext ectx;
    private HtmlPanelGrid panelGrid1;
    private HtmlOutputLabel outputLabel1;
    private HtmlInputText inputText1;
    private HtmlSelectOneListbox selectOneListbox1;
    private UISelectItems selectItems2;
    private HtmlCommandButton commandButton1;
    private HtmlSelectOneListbox selectOneListbox2;
    private UISelectItems selectItems3;
    private HtmlOutputLabel outputLabel2;
    private HtmlOutputLabel outputLabel3;
    private HtmlOutputLabel outputLabel4;
    private HtmlSelectManyListbox selectManyListbox1;
    private UISelectItems selectItems4;
    private HtmlOutputFormat outputFormat1;
    private HtmlPanelGrid panelGrid11;
    private HtmlOutputLabel outputLabel31;
    private HtmlSelectManyListbox selectManyListbox11;
    private UISelectItems selectItems41;
    private HtmlOutputLabel outputLabel11;
    private HtmlInputText inputText11;
    private HtmlOutputLabel outputLabel21;
    private HtmlSelectOneListbox selectOneListbox11;
    private UISelectItems selectItems21;
    private HtmlOutputLabel outputLabel41;
    private HtmlSelectOneListbox selectOneListbox21;
    private UISelectItems selectItems31;
    private HtmlCommandButton commandButton11;
    private HtmlOutputFormat outputFormat11;
    private HtmlPanelGroup panelGroup1;

    public CreateOrder() {
            getAllItems();
            getAllShippingInfos();
            ctx = FacesContext.getCurrentInstance();
            ectx =ctx.getExternalContext();
            getAllBillingInfos();
    }
    public ArrayList<SelectItem> getAllItems() {
    try {
        InitialContext context = new InitialContext();
        PlaceItem beanRemote = (PlaceItem) context.lookup( "ejb3inaction-Model-PlaceItem#actionbazaar.buslogic.PlaceItem");
        List<Item> allItems = beanRemote.getItemFindAll();
        orderItems = new ArrayList<SelectItem>(allItems.size());
        for (Item item : allItems) {
              Long itemId = item.getItemId();
              String itemName= item.getItemName();
              SelectItem selectItem = new SelectItem(itemId, itemName);
              orderItems.add(selectItem);
        }
          logger.debug("orderItems.size() " + orderItems.size());
          this.setOrderItems(orderItems);
        } catch (NamingException e) {
            System.err.println(e.getMessage());
    }
    return orderItems;
    }
    public ArrayList<SelectItem> getAllBillingInfos() {
    try {
          InitialContext context = new InitialContext();
          PlaceBillingInfo beanRemote1 = (PlaceBillingInfo)context.lookup("ejb3inaction-Model-PlaceBillingInfo#actionbazaar.buslogic.PlaceBillingInfo");
                       
          List<BillingInfo> alllBillingInfos = beanRemote1.getBillingInfoFindByUserId( bidderId); //
          billingInfos = new ArrayList<SelectItem>(alllBillingInfos.size());
          for (BillingInfo bi : alllBillingInfos) {
              Long billingId = bi.getBillingId();
              String billingName= bi.getAccountNo() + " " + bi.getCardType() + " " + bi.getExpiryDate() +" " + bi.getSecretCode();
              SelectItem selectItem1 = new SelectItem(billingId, billingName);
              billingInfos.add(selectItem1);
        }
          logger.debug("billingInfos.size() " + billingInfos.size());
        this.setBillingInfos(billingInfos);
        } catch (NamingException e) {
            System.err.println(e.getMessage());
    }
    return billingInfos;
    }

    public ArrayList<SelectItem> getAllShippingInfos() {
    try {
        InitialContext context = new InitialContext();
        PlaceShippingInfo beanRemote2 = (PlaceShippingInfo)context.lookup("ejb3inaction-Model-PlaceShippingInfo#actionbazaar.buslogic.PlaceShippingInfo");
        List<ShippingInfo> allShippingInfos = beanRemote2.getShippingInfoFindAll();
        shippingInfos = new ArrayList<SelectItem>(allShippingInfos.size());
        for (ShippingInfo si : allShippingInfos) {
              Long ShippingInfoId = si.getShippingId();
              String ShippingInfoName= si.getStreet() + " " + si.getCity() + " " + si.getState();
              SelectItem selectItem2 = new SelectItem(ShippingInfoId, ShippingInfoName);
              shippingInfos.add(selectItem2);
        }
          logger.debug("shippingInfos.size() " + shippingInfos.size());
          this.setShippingInfos(shippingInfos);
        } catch (NamingException e) {
            System.err.println(e.getMessage());
    }
    return shippingInfos;
    }
  
    public Object createNewOrder() {
        try {
                                     
                   bidderId = (String)inputText11.getValue();           
                                                    
                   java.util.ArrayList billingIdUIComponents = (java.util.ArrayList)selectItems21.getValue();
                   SelectItem billingIdItem=(SelectItem)billingIdUIComponents.get(0);
                   Long billingId = new Long( billingIdItem.getValue().toString() );
                   /*
                   java.util.ArrayList shippingIdUIComponents = (java.util.ArrayList)selectItems31.getValue();
                   SelectItem shippingIdItem=(SelectItem)shippingIdUIComponents.get(0);
                   Long shippingId = new Long( shippingIdItem.getValue().toString());
                 */
                   ELContext elctx =ctx.getELContext();
                  Application app = ctx.getApplication();
                   ExpressionFactory factory = app.getExpressionFactory();
                   ValueExpression ve =   factory.createValueExpression(elctx,   "#{backing_createOrder.selectOneListbox21.value}",Object.class );
                   Long shippingId = new Long( ve.getValue(elctx).toString());
                
                  HttpServletRequest request =    (HttpServletRequest)ctx.getExternalContext().getRequest();
                  String[] selectedItemsId = request.getParameterValues("j_id_id2:selectManyListbox11");
                  
                 ArrayList<Long> itemsId = new ArrayList<Long>(selectedItemsId.length);
                 
                  for (int i = 0; i < selectedItemsId.length; i++) {
                      Long val = new Long(selectedItemsId[i].toString());
                       logger.debug( "itemId " + val);
                       itemsId.add(val);
                   }
                 if (logger.isDebugEnabled())
                         logger.debug(  "bidderId " + getBidderId() +"  billingId " + billingId +  " shippingId " + shippingId);
                 InitialContext context = new InitialContext();
                 PlaceOrder facadeSessionEJB = (PlaceOrder)context.lookup("ejb3inaction-Model-PlaceOrder#actionbazaar.buslogic.PlaceOrder");
                 facadeSessionEJB.addOrder(getBidderId(), itemsId, shippingId, billingId );
                             
               } catch (NamingException e) {
                    System.err.println(e.getMessage());
                    return null;
               }
         return "queryOrders";
    }


    public void setAllItems(ArrayList<SelectItem> allItems) {
        this.allItems = allItems;
    }

    public void setOrderItems(ArrayList<SelectItem> orderItems) {
        this.orderItems = orderItems;
    }

    public void setShippingInfos(ArrayList<SelectItem> shippingInfos) {
        this.shippingInfos = shippingInfos;
    }

    public void setBillingInfos(ArrayList<SelectItem> billingInfos) {
        this.billingInfos = billingInfos;
    }

    public void setBidderId(String bidderId) {
        this.bidderId = bidderId;
    }

    public String getBidderId() {
        return ectx.getRemoteUser();
    }


    public void setPanelGrid1(HtmlPanelGrid panelGrid1) {
        this.panelGrid1 = panelGrid1;
    }

    public HtmlPanelGrid getPanelGrid1() {
        return panelGrid1;
    }


    public void setOutputLabel1(HtmlOutputLabel outputLabel1) {
        this.outputLabel1 = outputLabel1;
    }

    public HtmlOutputLabel getOutputLabel1() {
        return outputLabel1;
    }

    public void setInputText1(HtmlInputText inputText1) {
        this.inputText1 = inputText1;
    }

    public HtmlInputText getInputText1() {
        return inputText1;
    }

    public void setSelectOneListbox1(HtmlSelectOneListbox selectOneListbox1) {
        this.selectOneListbox1 = selectOneListbox1;
    }

    public HtmlSelectOneListbox getSelectOneListbox1() {
        return selectOneListbox1;
    }

    public void setSelectItems2(UISelectItems selectItems2) {
        this.selectItems2 = selectItems2;
    }

    public UISelectItems getSelectItems2() {
        return selectItems2;
    }

    public void setCommandButton1(HtmlCommandButton commandButton1) {
        this.commandButton1 = commandButton1;
    }

    public HtmlCommandButton getCommandButton1() {
        return commandButton1;
    }


    public void setSelectOneListbox2(HtmlSelectOneListbox selectOneListbox2) {
        this.selectOneListbox2 = selectOneListbox2;
    }

    public HtmlSelectOneListbox getSelectOneListbox2() {
        return selectOneListbox2;
    }

    public void setSelectItems3(UISelectItems selectItems3) {
        this.selectItems3 = selectItems3;
    }

    public UISelectItems getSelectItems3() {
        return selectItems3;
    }

    public void setOutputLabel2(HtmlOutputLabel outputLabel2) {
        this.outputLabel2 = outputLabel2;
    }

    public HtmlOutputLabel getOutputLabel2() {
        return outputLabel2;
    }

    public void setOutputLabel3(HtmlOutputLabel outputLabel3) {
        this.outputLabel3 = outputLabel3;
    }

    public HtmlOutputLabel getOutputLabel3() {
        return outputLabel3;
    }

    public void setOutputLabel4(HtmlOutputLabel outputLabel4) {
        this.outputLabel4 = outputLabel4;
    }

    public HtmlOutputLabel getOutputLabel4() {
        return outputLabel4;
    }


    public ArrayList<SelectItem> getBillingInfos() {
        return billingInfos;
    }

    public void setSelectManyListbox1(HtmlSelectManyListbox selectManyListbox1) {
        this.selectManyListbox1 = selectManyListbox1;
    }

    public HtmlSelectManyListbox getSelectManyListbox1() {
        return selectManyListbox1;
    }

    public void setSelectItems4(UISelectItems selectItems4) {
        this.selectItems4 = selectItems4;
    }

    public UISelectItems getSelectItems4() {
        return selectItems4;
    }

    public void setOutputFormat1(HtmlOutputFormat outputFormat1) {
        this.outputFormat1 = outputFormat1;
    }

    public HtmlOutputFormat getOutputFormat1() {
        return outputFormat1;
    }

    public void setPanelGrid11(HtmlPanelGrid panelGrid11) {
        this.panelGrid11 = panelGrid11;
    }

    public HtmlPanelGrid getPanelGrid11() {
        return panelGrid11;
    }

    public void setOutputLabel31(HtmlOutputLabel outputLabel31) {
        this.outputLabel31 = outputLabel31;
    }

    public HtmlOutputLabel getOutputLabel31() {
        return outputLabel31;
    }

    public void setSelectManyListbox11(HtmlSelectManyListbox selectManyListbox11) {
        this.selectManyListbox11 = selectManyListbox11;
    }

    public HtmlSelectManyListbox getSelectManyListbox11() {
        return selectManyListbox11;
    }

    public void setSelectItems41(UISelectItems selectItems41) {
        this.selectItems41 = selectItems41;
    }

    public UISelectItems getSelectItems41() {
        return selectItems41;
    }

    public void setOutputLabel11(HtmlOutputLabel outputLabel11) {
        this.outputLabel11 = outputLabel11;
    }

    public HtmlOutputLabel getOutputLabel11() {
        return outputLabel11;
    }

    public void setInputText11(HtmlInputText inputText11) {
        this.inputText11 = inputText11;
    }

    public HtmlInputText getInputText11() {
        return inputText11;
    }

    public void setOutputLabel21(HtmlOutputLabel outputLabel21) {
        this.outputLabel21 = outputLabel21;
    }

    public HtmlOutputLabel getOutputLabel21() {
        return outputLabel21;
    }

    public void setSelectOneListbox11(HtmlSelectOneListbox selectOneListbox11) {
        this.selectOneListbox11 = selectOneListbox11;
    }

    public HtmlSelectOneListbox getSelectOneListbox11() {
        return selectOneListbox11;
    }

    public void setSelectItems21(UISelectItems selectItems21) {
        this.selectItems21 = selectItems21;
    }

    public UISelectItems getSelectItems21() {
        return selectItems21;
    }

    public void setOutputLabel41(HtmlOutputLabel outputLabel41) {
        this.outputLabel41 = outputLabel41;
    }

    public HtmlOutputLabel getOutputLabel41() {
        return outputLabel41;
    }

    public void setSelectOneListbox21(HtmlSelectOneListbox selectOneListbox21) {
        this.selectOneListbox21 = selectOneListbox21;
    }

    public HtmlSelectOneListbox getSelectOneListbox21() {
        return selectOneListbox21;
    }

    public void setSelectItems31(UISelectItems selectItems31) {
        this.selectItems31 = selectItems31;
    }

    public UISelectItems getSelectItems31() {
        return selectItems31;
    }

    public void setCommandButton11(HtmlCommandButton commandButton11) {
        this.commandButton11 = commandButton11;
    }

    public HtmlCommandButton getCommandButton11() {
        return commandButton11;
    }

    public void setOutputFormat11(HtmlOutputFormat outputFormat11) {
        this.outputFormat11 = outputFormat11;
    }

    public HtmlOutputFormat getOutputFormat11() {
        return outputFormat11;
    }

    public void setPanelGroup1(HtmlPanelGroup panelGroup1) {
        this.panelGroup1 = panelGroup1;
    }

    public HtmlPanelGroup getPanelGroup1() {
        return panelGroup1;
    }
}