http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/testdrive-update/src/main.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/testdrive-update/src/main.mxml b/attic/apps/samples/WEB-INF/flex-src/testdrive-update/src/main.mxml new file mode 100755 index 0000000..226a032 --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/testdrive-update/src/main.mxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="horizontal" + creationComplete="srv.getProducts()"> + + <mx:RemoteObject id="srv" destination="product"/> + + <mx:Panel title="Catalog" width="100%" height="100%"> + <mx:DataGrid id="list" dataProvider="{srv.getProducts.lastResult}" width="100%" height="100%"/> + </mx:Panel> + + <ProductForm product="{Product(list.selectedItem)}"/> + +</mx:Application> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/testdrive-webservice/build.xml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/testdrive-webservice/build.xml b/attic/apps/samples/WEB-INF/flex-src/testdrive-webservice/build.xml new file mode 100755 index 0000000..166c86a --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/testdrive-webservice/build.xml @@ -0,0 +1,81 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project name="samples.war/build.xml" default="main" basedir="../../../../../"> + + <property environment="env" /> + <property file="${basedir}/build.properties"/> + <property name="samples.war" value="${basedir}/apps/samples"/> + <property name="context.root" value="samples" /> + <property name="application.name" value="Testdrive - WebService" /> + <property name="application.file" value="main" /> + <property name="application.bin.dir" value="${samples.war}/testdrive-webservice" /> + <property name="application.src.dir" value="${samples.war}/WEB-INF/flex-src/testdrive-webservice/src" /> + + <target name="main" depends="clean,compile-swf" /> + + <target name="compile-swf"> + + <taskdef resource="flexTasks.tasks" classpath="${basedir}/ant/lib/flexTasks.jar" /> + + <property name="FLEX_HOME" value="${basedir}"/> + + <mxmlc file="${application.src.dir}/${application.file}.mxml" + output="${application.bin.dir}/${application.file}.swf" + actionscript-file-encoding="UTF-8" + keep-generated-actionscript="false" + incremental="false" + services="${samples.war}/WEB-INF/flex/services-config.xml" + context-root="${context.root}" + locale="en_US"> + <load-config filename="${basedir}/frameworks/flex-config.xml"/> + <license product="flexbuilder3" serial-number="${env.fb3_license}"/> + <source-path path-element="${basedir}/frameworks"/> + <external-library-path/> + <metadata> + <publisher name="${manifest.Implementation-Vendor}" /> + <creator name="${manifest.Implementation-Vendor}" /> + </metadata> + </mxmlc> + + <html-wrapper title="${application.name}" + height="100%" + width="100%" + application="app" + swf="${application.file}" + version-major="10" + version-minor="0" + version-revision="0" + express-install="true" + output="${application.bin.dir}"/> + + <copy todir="${application.bin.dir}"> + <fileset dir="${application.src.dir}" includes="*.jsp"/> + </copy> + + </target> + + <target name="clean" description="--> Removes jars and classes"> + <delete quiet="true" includeemptydirs="true"> + <fileset dir="${application.bin.dir}" includes="*.swf,index.html,*.jsp"/> + <fileset dir="${application.bin.dir}/history" /> + </delete> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/testdrive-webservice/src/main.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/testdrive-webservice/src/main.mxml b/attic/apps/samples/WEB-INF/flex-src/testdrive-webservice/src/main.mxml new file mode 100755 index 0000000..48c1f9f --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/testdrive-webservice/src/main.mxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#FFFFFF"> + + <mx:WebService id="srv" destination="ws-catalog" useProxy="true" showBusyCursor="true"/> + + <mx:DataGrid dataProvider="{srv.getCategories.lastResult}" width="100%" height="100%"> + <mx:columns> + <mx:DataGridColumn dataField="categoryId" headerText="Category Id"/> + <mx:DataGridColumn dataField="categoryName" headerText="Category Name"/> + </mx:columns> + </mx:DataGrid> + + <mx:Button label="Get Data" click="srv.getCategories()"/> + +</mx:Application> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/traderdesktop/build.xml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/traderdesktop/build.xml b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/build.xml new file mode 100755 index 0000000..3e11052 --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/build.xml @@ -0,0 +1,81 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project name="samples.war/build.xml" default="main" basedir="../../../../../"> + + <property environment="env" /> + <property file="${basedir}/build.properties"/> + <property name="samples.war" value="${basedir}/apps/samples"/> + <property name="context.root" value="samples" /> + <property name="application.name" value="Trader Desktop" /> + <property name="application.file" value="traderdesktop" /> + <property name="application.bin.dir" value="${samples.war}/traderdesktop" /> + <property name="application.src.dir" value="${samples.war}/WEB-INF/flex-src/traderdesktop/src" /> + + <target name="main" depends="clean,compile-swf" /> + + <target name="compile-swf"> + + <taskdef resource="flexTasks.tasks" classpath="${basedir}/ant/lib/flexTasks.jar" /> + + <property name="FLEX_HOME" value="${basedir}"/> + + <mxmlc file="${application.src.dir}/${application.file}.mxml" + output="${application.bin.dir}/${application.file}.swf" + actionscript-file-encoding="UTF-8" + keep-generated-actionscript="false" + incremental="false" + services="${samples.war}/WEB-INF/flex/services-config.xml" + context-root="${context.root}" + locale="en_US"> + <load-config filename="${basedir}/frameworks/flex-config.xml"/> + <license product="flexbuilder3" serial-number="${env.fb3_license}"/> + <source-path path-element="${basedir}/frameworks"/> + <external-library-path/> + <metadata> + <publisher name="${manifest.Implementation-Vendor}" /> + <creator name="${manifest.Implementation-Vendor}" /> + </metadata> + </mxmlc> + + <html-wrapper title="${application.name}" + height="100%" + width="100%" + application="app" + swf="${application.file}" + version-major="10" + version-minor="0" + version-revision="0" + express-install="true" + output="${application.bin.dir}"/> + + <copy todir="${application.bin.dir}"> + <fileset dir="${application.src.dir}" includes="*.jsp"/> + </copy> + + </target> + + <target name="clean" description="--> Removes jars and classes"> + <delete quiet="true" includeemptydirs="true"> + <fileset dir="${application.bin.dir}" includes="*.swf,index.html,*.jsp"/> + <fileset dir="${application.bin.dir}/history" /> + </delete> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/BackgroundColorRenderer.as ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/BackgroundColorRenderer.as b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/BackgroundColorRenderer.as new file mode 100755 index 0000000..394a2db --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/BackgroundColorRenderer.as @@ -0,0 +1,55 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package { + + import mx.controls.Label; + import flash.display.Graphics; + + public class BackgroundColorRenderer extends Label { + + public static var symbol:String; + + override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void + { + super.updateDisplayList(unscaledWidth, unscaledHeight); + + var g:Graphics = graphics; + + g.clear(); + + if (data && data.date && data.symbol == symbol) + { + if( data.change && data.change >= 0 ) + { + g.beginFill(0x009900, 0.5); + g.drawRect(0, 0, unscaledWidth, unscaledHeight); + g.endFill(); + } + else + { + g.beginFill(0xFF0000, 0.5); + g.drawRect(0, 0, unscaledWidth, unscaledHeight); + g.endFill(); + } + } + + } + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/ColorRenderer.as ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/ColorRenderer.as b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/ColorRenderer.as new file mode 100755 index 0000000..64bd11c --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/ColorRenderer.as @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package { + + import mx.controls.Label; + import mx.controls.dataGridClasses.*; + + public class ColorRenderer extends Label { + + override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void + { + super.updateDisplayList(unscaledWidth, unscaledHeight); + if (data && listData && data[DataGridListData(listData).dataField] < 0) + { + setStyle("color", 0xFF0000); + } + else + { + setStyle("color", 0x009900); + } + } + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/main.css ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/main.css b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/main.css new file mode 100755 index 0000000..3c66056 --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/main.css @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@namespace mx "library://ns.adobe.com/flex/mx"; + +mx|Application { + padding-top: 16; + padding-bottom: 16; + padding-left: 16; + padding-right: 16; + vertical-gap: 4; +} +mx|Panel +{ + borderColor: #006699; + borderAlpha: 0.6; +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/samples/portfolio/Stock.as ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/samples/portfolio/Stock.as b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/samples/portfolio/Stock.as new file mode 100755 index 0000000..e99d6d7 --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/samples/portfolio/Stock.as @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package samples.portfolio +{ + [RemoteClass(alias="flex.samples.marketdata.Stock")] + [Bindable] + public class Stock + { + public var symbol:String; + public var name:String; + public var low:Number; + public var high:Number; + public var open:Number; + public var last:Number; + public var change:Number = 0; + public var date:Date; + } + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/startfeed.jsp ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/startfeed.jsp b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/startfeed.jsp new file mode 100755 index 0000000..36bdd30 --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/startfeed.jsp @@ -0,0 +1,26 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<%@page import="flex.samples.marketdata.Feed"%> +<% + try { + Feed feed = new Feed(); + feed.start(); + out.println("Feed Started"); + } catch (Exception e) { + out.println("A problem occured while starting the feed: "+e.getMessage()); + } +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/stopfeed.jsp ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/stopfeed.jsp b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/stopfeed.jsp new file mode 100755 index 0000000..01be2b5 --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/stopfeed.jsp @@ -0,0 +1,26 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<%@page import="flex.samples.marketdata.Feed"%> +<% + try { + Feed feed = new Feed(); + feed.stop(); + out.println("Feed Stopped"); + } catch (Exception e) { + out.println("A problem occured while stopping the feed: "+e.getMessage()); + } +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/traderdesktop.mxml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/traderdesktop.mxml b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/traderdesktop.mxml new file mode 100755 index 0000000..95d13c2 --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex-src/traderdesktop/src/traderdesktop.mxml @@ -0,0 +1,241 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" + backgroundGradientColors="[#FFFFFF,#FFFFFF]" + layout="horizontal" horizontalAlign="left" verticalGap="8" + creationComplete="initApp()"> + + <mx:Style source="main.css"/> + + <mx:Script> + <![CDATA[ + import mx.messaging.channels.HTTPChannel; + import mx.messaging.channels.AMFChannel; + import mx.controls.Alert; + import mx.collections.ArrayCollection; + import mx.messaging.Channel; + import mx.messaging.ChannelSet; + import mx.messaging.config.ServerConfig; + import mx.messaging.events.MessageEvent; + import samples.portfolio.Stock; + import mx.messaging.Consumer; + + private var consumers:Object; + + [Bindable] + private var items:ArrayCollection; + + private var stockMap:Object; + + private function initApp():void + { + var channelSet:ChannelSet = ServerConfig.getChannelSet("market-data-feed"); + channels.dataProvider = channelSet.channelIds; + consumers = new Object(); + stockMap = new Object(); + items = new ArrayCollection(); + initializeWatchList(["IBM", "JBLU", "ADBE", "GE", "C"]); + displayChannelInfo(); + } + + private function deleteSymbol():void + { + var symbol:String = dg.selectedItem.symbol; + unsubscribe(symbol); + items.removeItemAt(dg.selectedIndex); + delete stockMap[symbol]; + } + + public function initializeWatchList(list:Array):void + { + for (var i:int=0; i<list.length; i++) + { + addSymbol(list[i]); + } + } + + private function addSymbol(symbol:String):void + { + if (symbol == null || symbol == "") + { + Alert.show("Cannot add an empty symbol"); + return; + } + + symbol = symbol.toUpperCase(); + if (stockMap.hasOwnProperty(symbol)) + { + Alert.show("Symbol '" + symbol + "' is already in the list"); + return; + } + + var stock:Stock = new Stock(); + stock.symbol = symbol; + stockMap[symbol] = stock; + items.addItem(stock); + subscribe(symbol); + } + + private function subscribe(symbol:String):void + { + var consumer:Consumer = new Consumer(); + consumer.destination = "market-data-feed"; + consumer.subtopic = symbol; + consumer.channelSet = new ChannelSet([channels.selectedItem]); + consumer.addEventListener(MessageEvent.MESSAGE, messageHandler); + consumer.subscribe(); + consumers[symbol] = consumer; + } + + private function unsubscribe(symbol:String):void + { + if (consumers[symbol]) + { + var consumer:Consumer = consumers[symbol]; + consumer.removeEventListener(MessageEvent.MESSAGE, messageHandler); + if (consumer.subscribed) + { + consumer.unsubscribe(); + } + consumer.channelSet.disconnectAll(); + consumers[symbol] = null; + } + } + + private function channelChange():void + { + displayChannelInfo(); + + var i:int; + // Get rid of all the subscriptions that use the previously selected channel + for (i=0; i<items.length; i++) + { + unsubscribe(items.getItemAt(i).symbol) + } + + // Subscribe using the newly selected channel + for (i=0; i<items.length; i++) + { + subscribe(items.getItemAt(i).symbol) + } + } + + private function displayChannelInfo():void + { + var channel:Object = ServerConfig.getChannel(channels.selectedItem as String); + channelId.text = channel.id; + channelClass.text = getQualifiedClassName(channel); + endpoint.text = channel.endpoint; + if (channel is AMFChannel || channel is HTTPChannel) + { + pollingEnabled.text = channel.pollingEnabled; + pollingInterval.text = channel.pollingInterval; + } + else + { + pollingEnabled.text = "n/a"; + pollingInterval.text = "n/a"; + } + perClientSettings.visible = channel.id.indexOf("per-client") >= 0; + } + + private function messageHandler(event:MessageEvent):void + { + var changedStock:Stock = event.message.body as Stock; + var stock:Stock = stockMap[changedStock.symbol]; + + BackgroundColorRenderer.symbol = changedStock.symbol; + + if (stock) + { + stock.open = changedStock.open; + stock.change = changedStock.change; + stock.last = changedStock.last; + stock.high = changedStock.high; + stock.low = changedStock.low; + stock.date = changedStock.date; + } + } + + private function formatNumber(item:Object, column:DataGridColumn):String + { + return nf.format(item[column.dataField]); + } + + // Only used for the per-client-qos channels + private function setDelay():void + { + configSrv.setAttribute("market-data-delay", delay.text); + } + + + ]]> + </mx:Script> + + <!-- Only used for the per-client-qos channels to provide per-client config values --> + <mx:RemoteObject id="configSrv" destination="flex-client-qos-config"/> + + <mx:NumberFormatter id="nf" precision="2"/> + + <mx:Panel title="Watch List" width="400" height="400"> + <mx:DataGrid id="dg" dataProvider="{items}" width="100%" height="100%"> + <mx:columns> + <mx:DataGridColumn headerText="Symbol" dataField="symbol" width="80"/> + <mx:DataGridColumn headerText="Open" dataField="open" labelFunction="formatNumber" textAlign="right" width="60"/> + <mx:DataGridColumn headerText="Last" dataField="last" itemRenderer="BackgroundColorRenderer" labelFunction="formatNumber" textAlign="right" width="60"/> + <mx:DataGridColumn headerText="Change" dataField="change" itemRenderer="ColorRenderer" labelFunction="formatNumber" textAlign="right" width="60"/> + <mx:DataGridColumn headerText="High" dataField="high" labelFunction="formatNumber" textAlign="right" width="60"/> + <mx:DataGridColumn headerText="Low" dataField="low" labelFunction="formatNumber" textAlign="right" width="60"/> + </mx:columns> + </mx:DataGrid> + <mx:ControlBar> + <mx:TextInput id="symbol" enter="addSymbol(symbol.text);symbol.text='';" width="50"/> + <mx:Button label="Add Symbol" click="addSymbol(symbol.text);symbol.text='';"/> + <mx:Spacer width="100%"/> + <mx:Button label="Delete Symbol" click="deleteSymbol()" enabled="{dg.selectedItem}"/> + </mx:ControlBar> + </mx:Panel> + + <mx:Form> + <mx:FormItem label="Select a channel"> + <mx:ComboBox id="channels" change="channelChange()"/> + </mx:FormItem> + <mx:FormItem label="Channel Id"> + <mx:Label id="channelId"/> + </mx:FormItem> + <mx:FormItem label="Channel Class"> + <mx:Label id="channelClass"/> + </mx:FormItem> + <mx:FormItem label="Endpoint"> + <mx:Label id="endpoint"/> + </mx:FormItem> + <mx:FormItem label="Polling Enabled"> + <mx:Label id="pollingEnabled"/> + </mx:FormItem> + <mx:FormItem label="Polling Interval (millis)"> + <mx:Label id="pollingInterval"/> + </mx:FormItem> + <mx:FormItem id="perClientSettings" label="Custom (Per Client) Quote Delay" direction="horizontal"> + <mx:TextInput id="delay" width="80" text="5000"/> + <mx:Button label="Apply" click="setDelay()"/> + </mx:FormItem> + </mx:Form> + +</mx:Application> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex/messaging-config.xml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex/messaging-config.xml b/attic/apps/samples/WEB-INF/flex/messaging-config.xml new file mode 100755 index 0000000..7b331c3 --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex/messaging-config.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<service id="message-service" class="flex.messaging.services.MessageService"> + + <adapters> + <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" /> + <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/> + </adapters> + + <default-channels> + <channel ref="my-streaming-amf"/> + <channel ref="my-polling-amf"/> + </default-channels> + + <destination id="feed"> + <!-- Destination specific channel configuration can be defined if needed + <channels> + <channel ref="my-streaming-amf"/> + </channels> + --> + </destination> + + <destination id="chat"/> + + <destination id="dashboard"/> + + <destination id="market-data-feed"> + <properties> + <server> + <allow-subtopics>true</allow-subtopics> + <subtopic-separator>.</subtopic-separator>s + </server> + </properties> + <channels> + <channel ref="my-polling-amf"/> + <channel ref="my-streaming-amf"/> + <channel ref="per-client-qos-polling-amf"/> + </channels> + </destination> + +</service> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex/proxy-config.xml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex/proxy-config.xml b/attic/apps/samples/WEB-INF/flex/proxy-config.xml new file mode 100755 index 0000000..158a059 --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex/proxy-config.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<service id="proxy-service" class="flex.messaging.services.HTTPProxyService"> + + <properties> + <connection-manager> + <max-total-connections>100</max-total-connections> + <default-max-connections-per-host>2</default-max-connections-per-host> + </connection-manager> + + <allow-lax-ssl>true</allow-lax-ssl> + </properties> + + <default-channels> + <channel ref="my-http"/> + <channel ref="my-amf"/> + </default-channels> + + <adapters> + <adapter-definition id="http-proxy" class="flex.messaging.services.http.HTTPProxyAdapter" default="true"/> + <adapter-definition id="soap-proxy" class="flex.messaging.services.http.SOAPProxyAdapter"/> + </adapters> + + <destination id="DefaultHTTP"> + <properties> + </properties> + </destination> + + <destination id="catalog"> + <properties> + <url>/{context.root}/testdrive-httpservice/catalog.jsp</url> + </properties> + </destination> + + <destination id="ws-catalog"> + <properties> + <wsdl>http://feeds.adobe.com/webservices/mxna2.cfc?wsdl</wsdl> + <soap>http://feeds.adobe.com/webservices/mxna2.cfc</soap> + </properties> + <adapter ref="soap-proxy"/> + </destination> + +</service> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex/remoting-config.xml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex/remoting-config.xml b/attic/apps/samples/WEB-INF/flex/remoting-config.xml new file mode 100755 index 0000000..8b0546b --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex/remoting-config.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<service id="remoting-service" + class="flex.messaging.services.RemotingService"> + + <adapters> + <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/> + </adapters> + + <default-channels> + <channel ref="my-amf"/> + </default-channels> + + <destination id="product"> + <properties> + <source>flex.samples.product.ProductService</source> + </properties> + </destination> + + <destination id="productService"> + <properties> + <source>flex.samples.dcd.product.ProductService</source> + </properties> + </destination> + + <destination id="chat-room-service"> + <properties> + <source>flex.samples.runtimeconfig.ChatRoomService</source> + <scope>application</scope> + </properties> + </destination> + + <destination id="flex-client-qos-config" channels="per-client-qos-polling-amf"> + <properties> + <source>flex.samples.qos.FlexClientConfigService</source> + </properties> + </destination> + + </service> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/flex/services-config.xml ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/flex/services-config.xml b/attic/apps/samples/WEB-INF/flex/services-config.xml new file mode 100755 index 0000000..13c4069 --- /dev/null +++ b/attic/apps/samples/WEB-INF/flex/services-config.xml @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<services-config> + + <services> + + <service class="flex.samples.DatabaseCheckService" id="hsqldb" /> + + <service-include file-path="remoting-config.xml" /> + <service-include file-path="proxy-config.xml" /> + <service-include file-path="messaging-config.xml" /> + + <service class="flex.samples.runtimeconfig.EmployeeRuntimeRemotingDestination" id="runtime-employee-ro" /> + + <!-- + Application level default channels. Application level default channels are + necessary when a dynamic destination is being used by a service component + and no ChannelSet has been defined for the service component. In that case, + application level default channels will be used to contact the destination. + --> + <default-channels> + <channel ref="my-amf"/> + </default-channels> + + </services> + + + <security> + <security-constraint id="sample-users"> + <auth-method>Custom</auth-method> + <roles> + <role>sampleusers</role> + </roles> + </security-constraint> + + <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/> + <!-- Uncomment the correct app server + <login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss"/> + <login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/> + <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/> + <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/> + --> + </security> + + <channels> + + <channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf" class="flex.messaging.endpoints.StreamingAMFEndpoint"/> + </channel-definition> + + <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> + <properties> + <polling-enabled>false</polling-enabled> + </properties> + </channel-definition> + + <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel"> + <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/> + <properties> + <add-no-cache-headers>false</add-no-cache-headers> + </properties> + </channel-definition> + + <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/> + <properties> + <polling-enabled>true</polling-enabled> + <polling-interval-seconds>4</polling-interval-seconds> + </properties> + </channel-definition> + + <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/> + </channel-definition> + + <channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel"> + <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/> + <properties> + <add-no-cache-headers>false</add-no-cache-headers> + </properties> + </channel-definition> + + <channel-definition id="per-client-qos-polling-amf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/qosamfpolling" class="flex.messaging.endpoints.AMFEndpoint"/> + <properties> + <polling-enabled>true</polling-enabled> + <polling-interval-millis>500</polling-interval-millis> + <flex-client-outbound-queue-processor class="flex.samples.qos.CustomDelayQueueProcessor"> + <properties> + <flush-delay>5000</flush-delay> + </properties> + </flex-client-outbound-queue-processor> + </properties> + </channel-definition> + + </channels> + + <logging> + <!-- You may also use flex.messaging.log.ServletLogTarget --> + <target class="flex.messaging.log.ConsoleTarget" level="Error"> + <properties> + <prefix>[BlazeDS] </prefix> + <includeDate>false</includeDate> + <includeTime>false</includeTime> + <includeLevel>true</includeLevel> + <includeCategory>false</includeCategory> + </properties> + <filters> + <pattern>Endpoint.*</pattern> + <pattern>Service.*</pattern> + <pattern>Configuration</pattern> + </filters> + </target> + </logging> + + <system> + <redeploy> + <enabled>true</enabled> + <watch-interval>20</watch-interval> + <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file> + <touch-file>{context.root}/WEB-INF/web.xml</touch-file> + </redeploy> + </system> + +</services-config> http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/src/flex/samples/ConnectionHelper.java ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/src/flex/samples/ConnectionHelper.java b/attic/apps/samples/WEB-INF/src/flex/samples/ConnectionHelper.java new file mode 100755 index 0000000..a04fa73 --- /dev/null +++ b/attic/apps/samples/WEB-INF/src/flex/samples/ConnectionHelper.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.samples; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class ConnectionHelper +{ + private String url; + private static ConnectionHelper instance; + + private ConnectionHelper() + { + try { + Class.forName("org.hsqldb.jdbcDriver"); + url = "jdbc:hsqldb:hsql://localhost:9002/flexdemodb"; + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static Connection getConnection() throws SQLException { + if (instance == null) { + instance = new ConnectionHelper(); + } + try { + return DriverManager.getConnection(instance.url); + } catch (SQLException e) { + throw e; + } + } + + public static void close(Connection connection) + { + try { + if (connection != null) { + connection.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/src/flex/samples/DAOException.java ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/src/flex/samples/DAOException.java b/attic/apps/samples/WEB-INF/src/flex/samples/DAOException.java new file mode 100755 index 0000000..3d71e0f --- /dev/null +++ b/attic/apps/samples/WEB-INF/src/flex/samples/DAOException.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.samples; + +public class DAOException extends RuntimeException +{ + static final long serialVersionUID = -1881205326938716446L; + + public DAOException(String message) + { + super(message); + } + + public DAOException(Throwable cause) + { + super(cause); + } + + public DAOException(String message, Throwable cause) + { + super(message, cause); + } + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/src/flex/samples/DatabaseCheckService.java ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/src/flex/samples/DatabaseCheckService.java b/attic/apps/samples/WEB-INF/src/flex/samples/DatabaseCheckService.java new file mode 100755 index 0000000..68f1990 --- /dev/null +++ b/attic/apps/samples/WEB-INF/src/flex/samples/DatabaseCheckService.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.samples; + +import java.sql.Connection; +import java.sql.SQLException; + +import flex.messaging.config.ConfigMap; +import flex.messaging.services.AbstractBootstrapService; + +public class DatabaseCheckService extends AbstractBootstrapService +{ + public void initialize(String id, ConfigMap properties) + { + Connection c = null; + try + { + // Check that the database is running... + c = ConnectionHelper.getConnection(); + // ... if yes return + return; + } + catch (SQLException e) + { + System.out.println("******************************************************************************"); + System.out.println("* *"); + System.out.println("* Unable to connect to the samples database. *"); + System.out.println("* You must start the samples database before you can run the samples. *"); + System.out.println("* To start the samples database: *"); + System.out.println("* 1. Open a command prompt and go to the {install-dir}/sampledb dir *"); + System.out.println("* 2. Run startdb.bat (Windows) or startdb.sh (Unix-based systems) *"); + System.out.println("* *"); + System.out.println("******************************************************************************"); + } + finally + { + ConnectionHelper.close(c); + } + + } + + public void start() + { + } + + + public void stop() + { + } + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/src/flex/samples/crm/ConcurrencyException.java ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/src/flex/samples/crm/ConcurrencyException.java b/attic/apps/samples/WEB-INF/src/flex/samples/crm/ConcurrencyException.java new file mode 100755 index 0000000..c13602a --- /dev/null +++ b/attic/apps/samples/WEB-INF/src/flex/samples/crm/ConcurrencyException.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.samples.crm; + +public class ConcurrencyException extends Exception +{ + private static final long serialVersionUID = -6405818907028247079L; + + public ConcurrencyException(String message) + { + super(message); + } + + public ConcurrencyException(Throwable cause) + { + super(cause); + } + + public ConcurrencyException(String message, Throwable cause) + { + super(message, cause); + } +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/src/flex/samples/crm/DAOException.java ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/src/flex/samples/crm/DAOException.java b/attic/apps/samples/WEB-INF/src/flex/samples/crm/DAOException.java new file mode 100755 index 0000000..2560ca0 --- /dev/null +++ b/attic/apps/samples/WEB-INF/src/flex/samples/crm/DAOException.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.samples.crm; + +public class DAOException extends RuntimeException +{ + private static final long serialVersionUID = -8852593974738250673L; + + public DAOException(String message) + { + super(message); + } + + public DAOException(Throwable cause) + { + super(cause); + } + + public DAOException(String message, Throwable cause) + { + super(message, cause); + } + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/src/flex/samples/crm/company/Company.java ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/src/flex/samples/crm/company/Company.java b/attic/apps/samples/WEB-INF/src/flex/samples/crm/company/Company.java new file mode 100755 index 0000000..8cd5e24 --- /dev/null +++ b/attic/apps/samples/WEB-INF/src/flex/samples/crm/company/Company.java @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.samples.crm.company; + +public class Company +{ + private int companyId; + + private String name; + + private String address; + + private String city; + + private String zip; + + private String state; + + private String industry; + + public String getAddress() + { + return address; + } + + public void setAddress(String address) + { + this.address = address; + } + + public String getCity() + { + return city; + } + + public void setCity(String city) + { + this.city = city; + } + + public int getCompanyId() + { + return companyId; + } + + public void setCompanyId(int companyId) + { + this.companyId = companyId; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getState() + { + return state; + } + + public void setState(String state) + { + this.state = state; + } + + public String getZip() + { + return zip; + } + + public void setZip(String zip) + { + this.zip = zip; + } + + public String getIndustry() + { + return this.industry; + } + + public void setIndustry(String industry) + { + this.industry = industry; + } + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/src/flex/samples/crm/company/CompanyDAO.java ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/src/flex/samples/crm/company/CompanyDAO.java b/attic/apps/samples/WEB-INF/src/flex/samples/crm/company/CompanyDAO.java new file mode 100755 index 0000000..3047319 --- /dev/null +++ b/attic/apps/samples/WEB-INF/src/flex/samples/crm/company/CompanyDAO.java @@ -0,0 +1,228 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.samples.crm.company; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + +import flex.samples.ConnectionHelper; +import flex.samples.crm.ConcurrencyException; +import flex.samples.crm.DAOException; + +public class CompanyDAO +{ + public List findCompanies(String name, String industry) throws DAOException + { + List list = new ArrayList(); + Connection c = null; + try + { + String sql = "SELECT * FROM company"; + if (industry != null && industry != "All") + sql += " WHERE industry = ?"; + if (name != null) + { + if (industry == null) + sql += " WHERE company.name LIKE ?"; + else + sql += " AND company.name LIKE ?"; + } + sql += " ORDER BY company.name"; + + c = ConnectionHelper.getConnection(); + + PreparedStatement ps = c.prepareStatement(sql); + ps.setString(1, industry); + ps.setString(1, "%" + name + "%"); + ResultSet rs = ps.executeQuery(); + Company company; + while (rs.next()) + { + company = new Company(); + company.setCompanyId(rs.getInt("company_id")); + company.setName(rs.getString("name")); + company.setAddress(rs.getString("address")); + company.setCity(rs.getString("city")); + company.setZip(rs.getString("zip")); + company.setState(rs.getString("state")); + company.setIndustry(rs.getString("industry")); + list.add(company); + } + rs.close(); + ps.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e); + } + finally + { + ConnectionHelper.close(c); + } + return list; + } + + public Company getCompany(int companyId) throws DAOException + { + Company company = null; + Connection c = null; + try + { + c = ConnectionHelper.getConnection(); + PreparedStatement ps = c.prepareStatement("SELECT * FROM company WHERE company_id= ?"); + ps.setInt(1, companyId); + ResultSet rs = ps.executeQuery(); + if (rs.next()) + { + company = new Company(); + company.setCompanyId(rs.getInt("company_id")); + company.setName(rs.getString("name")); + company.setAddress(rs.getString("address")); + company.setCity(rs.getString("city")); + company.setZip(rs.getString("zip")); + company.setState(rs.getString("state")); + company.setIndustry(rs.getString("industry")); + } + rs.close(); + ps.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e); + } + finally + { + ConnectionHelper.close(c); + } + return company; + } + + public Company create(Company company) throws DAOException + { + Connection c = null; + PreparedStatement ps = null; + try + { + c = ConnectionHelper.getConnection(); + ps = c.prepareStatement("INSERT INTO company (name, address, city, zip, state, industry) VALUES (?, ?, ?, ?, ?, ?)"); + ps.setString(1, company.getName()); + ps.setString(2, company.getAddress()); + ps.setString(3, company.getCity()); + ps.setString(4, company.getZip()); + ps.setString(5, company.getState()); + ps.setString(6, company.getIndustry()); + ps.execute(); + ps.close(); + ps = null; + Statement s = c.createStatement(); + // HSQLDB Syntax to get the identity (company_id) of inserted row + ResultSet rs = s.executeQuery("CALL IDENTITY()"); + rs.next(); + + // Update the id in the returned object. This is important as this + // value must get returned to the client. + company.setCompanyId(rs.getInt(1)); + + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e); + } + finally + { + ConnectionHelper.close(c); + } + return company; + } + + public void update(Company newVersion, Company previousVersion, List changes) throws DAOException, ConcurrencyException + { + Connection c = null; + PreparedStatement ps = null; + try + { + c = ConnectionHelper.getConnection(); + ps = c.prepareStatement("UPDATE company SET name=?, address=?, city=?, zip=?, state=?, industry=? WHERE company_id=? AND name=? AND address=? AND city=? AND zip=? AND state=?" ); + ps.setString(1, newVersion.getName()); + ps.setString(2, newVersion.getAddress()); + ps.setString(3, newVersion.getCity()); + ps.setString(4, newVersion.getZip()); + ps.setString(5, newVersion.getState()); + ps.setString(6, newVersion.getIndustry()); + ps.setInt(7, newVersion.getCompanyId()); + ps.setString(8, previousVersion.getName()); + ps.setString(9, previousVersion.getAddress()); + ps.setString(10, previousVersion.getCity()); + ps.setString(11, previousVersion.getZip()); + ps.setString(12, previousVersion.getState()); + if (ps.executeUpdate() == 0) + { + throw new ConcurrencyException("Item not found"); + } + ps.close(); + ps = null; + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e); + } + finally + { + ConnectionHelper.close(c); + } + } + + public void delete(Company company) throws DAOException, ConcurrencyException + { + Connection c = null; + PreparedStatement ps = null; + try + { + c = ConnectionHelper.getConnection(); + + ps = c.prepareStatement("DELETE FROM company WHERE company_id=? AND name=? AND address=? AND city=? AND zip=? AND state=?"); + ps.setInt(1, company.getCompanyId()); + ps.setString(2, company.getName()); + ps.setString(3, company.getAddress()); + ps.setString(4, company.getCity()); + ps.setString(5, company.getZip()); + ps.setString(6, company.getState()); + if (ps.executeUpdate() == 0) + { + throw new ConcurrencyException("Item not found"); + } + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e); + } + finally + { + ConnectionHelper.close(c); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/src/flex/samples/crm/employee/Employee.java ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/src/flex/samples/crm/employee/Employee.java b/attic/apps/samples/WEB-INF/src/flex/samples/crm/employee/Employee.java new file mode 100755 index 0000000..7c59871 --- /dev/null +++ b/attic/apps/samples/WEB-INF/src/flex/samples/crm/employee/Employee.java @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.samples.crm.employee; + +import flex.samples.crm.company.Company; + +public class Employee +{ + private int employeeId; + + private String firstName; + + private String lastName; + + private String title; + + private String email; + + private String phone; + + private Company company; + + public String getEmail() + { + return email; + } + + public void setEmail(String email) + { + this.email = email; + } + + public int getEmployeeId() + { + return employeeId; + } + + public void setEmployeeId(int employeeId) + { + this.employeeId = employeeId; + } + + public String getFirstName() + { + return firstName; + } + + public void setFirstName(String firstName) + { + this.firstName = firstName; + } + + public String getLastName() + { + return lastName; + } + + public void setLastName(String lastName) + { + this.lastName = lastName; + } + + public String getPhone() + { + return phone; + } + + public void setPhone(String phone) + { + this.phone = phone; + } + + public String getTitle() + { + return title; + } + + public void setTitle(String title) + { + this.title = title; + } + + public Company getCompany() + { + return company; + } + + public void setCompany(Company company) + { + this.company = company; + } +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/src/flex/samples/crm/employee/EmployeeDAO.java ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/src/flex/samples/crm/employee/EmployeeDAO.java b/attic/apps/samples/WEB-INF/src/flex/samples/crm/employee/EmployeeDAO.java new file mode 100755 index 0000000..273dee5 --- /dev/null +++ b/attic/apps/samples/WEB-INF/src/flex/samples/crm/employee/EmployeeDAO.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.samples.crm.employee; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.Statement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.ArrayList; +import java.util.List; + +import flex.samples.ConnectionHelper; +import flex.samples.DAOException; +import flex.samples.crm.ConcurrencyException; +import flex.samples.crm.company.Company; + +public class EmployeeDAO +{ + public List getEmployees() throws DAOException + { + List list = new ArrayList(); + Connection c = null; + try + { + c = ConnectionHelper.getConnection(); + Statement s = c.createStatement(); + ResultSet rs = s.executeQuery("SELECT * FROM employee ORDER BY last_name"); + Employee employee; + while (rs.next()) + { + employee = new Employee(); + employee.setEmployeeId(rs.getInt("employee_id")); + employee.setFirstName(rs.getString("first_name")); + employee.setLastName(rs.getString("last_name")); + employee.setTitle(rs.getString("title")); + employee.setEmail(rs.getString("email")); + employee.setPhone(rs.getString("phone")); + Company company = new Company(); + company.setCompanyId(rs.getInt("company_id")); + employee.setCompany(company); + list.add(employee); + } + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e); + } + finally + { + ConnectionHelper.close(c); + } + return list; + } + + public List findEmployeesByCompany(Integer companyId) throws DAOException + { + List list = new ArrayList(); + Connection c = null; + try + { + Company company = new Company(); + company.setCompanyId(companyId.intValue()); + c = ConnectionHelper.getConnection(); + PreparedStatement ps = c.prepareStatement("SELECT * FROM employee WHERE company_id = ? ORDER BY last_name"); + ps.setInt(1, companyId.intValue()); + ResultSet rs = ps.executeQuery(); + while (rs.next()) + { + Employee employee = new Employee(); + employee.setEmployeeId(rs.getInt("employee_id")); + employee.setFirstName(rs.getString("first_name")); + employee.setLastName(rs.getString("last_name")); + employee.setTitle(rs.getString("title")); + employee.setEmail(rs.getString("email")); + employee.setPhone(rs.getString("phone")); + employee.setCompany(company); + list.add(employee); + } + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e); + } + finally + { + ConnectionHelper.close(c); + } + return list; + } + + public List findEmployeesByName(String name) throws DAOException + { + List list = new ArrayList(); + Connection c = null; + + try + { + c = ConnectionHelper.getConnection(); + PreparedStatement ps = c.prepareStatement("SELECT * FROM employee WHERE first_name LIKE ? OR last_name LIKE ? ORDER BY last_name"); + ps.setString(1, "%" + name + "%"); + ps.setString(2, "%" + name + "%"); + ResultSet rs = ps.executeQuery(); + + Employee employee; + while (rs.next()) + { + employee = new Employee(); + employee.setEmployeeId(rs.getInt("employee_id")); + employee.setFirstName(rs.getString("first_name")); + employee.setLastName(rs.getString("last_name")); + employee.setTitle(rs.getString("title")); + employee.setEmail(rs.getString("email")); + employee.setPhone(rs.getString("phone")); + Company company = new Company(); + company.setCompanyId(rs.getInt("company_id")); + + list.add(employee); + } + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e); + } + finally + { + ConnectionHelper.close(c); + } + return list; + } + + public Employee getEmployee(int employeeId) throws DAOException + { + Employee employee = null; + Connection c = null; + + try + { + c = ConnectionHelper.getConnection(); + PreparedStatement ps = c.prepareStatement("SELECT * FROM employee WHERE employee_id= ?"); + ps.setInt(1, employeeId); + ResultSet rs = ps.executeQuery(); + + if (rs.next()) + { + employee = new Employee(); + employee.setEmployeeId(rs.getInt("employee_id")); + employee.setFirstName(rs.getString("first_name")); + employee.setLastName(rs.getString("last_name")); + employee.setTitle(rs.getString("title")); + employee.setEmail(rs.getString("email")); + employee.setPhone(rs.getString("phone")); + } + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e.getMessage()); + } + finally + { + ConnectionHelper.close(c); + } + return employee; + } + + public Employee createEmployee(Employee employee) throws DAOException + { + Connection c = null; + PreparedStatement ps = null; + try + { + c = ConnectionHelper.getConnection(); + ps = c.prepareStatement("INSERT INTO employee (first_name, last_name, title, email, phone, company_id) VALUES (?, ?, ?, ?, ?, ?)"); + ps.setString(1, employee.getFirstName()); + ps.setString(2, employee.getLastName()); + ps.setString(3, employee.getTitle()); + ps.setString(4, employee.getEmail()); + ps.setString(5, employee.getPhone()); + if (employee.getCompany() != null) + ps.setInt(6, employee.getCompany().getCompanyId()); + else + ps.setNull(6, Types.INTEGER); + ps.execute(); + ps.close(); + Statement s = c.createStatement(); + // HSQLDB Syntax to get the identity (employee_id) of inserted row + ResultSet rs = s.executeQuery("CALL IDENTITY()"); + rs.next(); + // Update the id in the returned object. This is important as this + // value must get returned to the client. + employee.setEmployeeId(rs.getInt(1)); + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e); + } + finally + { + ConnectionHelper.close(c); + } + return employee; + } + + + public void updateEmployee(Employee newVersion, Employee previousVersion, List changes) throws DAOException, ConcurrencyException + { + Connection c = null; + try + { + c = ConnectionHelper.getConnection(); + PreparedStatement ps = c.prepareStatement("UPDATE employee SET first_name=?, last_name=?, title=?, email=?, phone=?, company_id=? WHERE employee_id=? AND first_name=? AND last_name=? AND title=? AND email=? AND phone=? AND company_id=?"); + ps.setString(1, newVersion.getFirstName()); + ps.setString(2, newVersion.getLastName()); + ps.setString(3, newVersion.getTitle()); + ps.setString(4, newVersion.getEmail()); + ps.setString(5, newVersion.getPhone()); + if (newVersion.getCompany() != null) + ps.setInt(6, newVersion.getCompany().getCompanyId()); + else + ps.setNull(6,Types.INTEGER); + ps.setInt(7, newVersion.getEmployeeId()); + ps.setString(8, previousVersion.getFirstName()); + ps.setString(9, previousVersion.getLastName()); + ps.setString(10, previousVersion.getTitle()); + ps.setString(11, previousVersion.getEmail()); + ps.setString(12, previousVersion.getPhone()); + if (previousVersion.getCompany() != null) + ps.setInt(13, previousVersion.getCompany().getCompanyId()); + else + ps.setNull(13, Types.INTEGER); + if (ps.executeUpdate() == 0) + { + throw new ConcurrencyException("Item not found"); + } + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e.getMessage()); + } + finally + { + ConnectionHelper.close(c); + } + } + + public void deleteEmployee(Employee employee) throws DAOException, ConcurrencyException + { + Connection c = null; + try + { + c = ConnectionHelper.getConnection(); + PreparedStatement ps = c.prepareStatement("DELETE FROM employee WHERE employee_id=? AND first_name=? AND last_name=? AND title=? AND email=? AND phone=? AND company_id=?"); + ps.setInt(1, employee.getEmployeeId()); + ps.setString(2, employee.getFirstName()); + ps.setString(3, employee.getLastName()); + ps.setString(4, employee.getTitle()); + ps.setString(5, employee.getEmail()); + ps.setString(6, employee.getPhone()); + if (employee.getCompany() != null) + ps.setInt(7, employee.getCompany().getCompanyId()); + else + ps.setNull(7, Types.INTEGER); + if (ps.executeUpdate() == 0) + { + throw new ConcurrencyException("Item not found"); + } + } + catch (SQLException e) + { + e.printStackTrace(); + throw new DAOException(e.getMessage()); + } + finally + { + ConnectionHelper.close(c); + } + } + +} http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/75229759/attic/apps/samples/WEB-INF/src/flex/samples/dcd/product/Product.java ---------------------------------------------------------------------- diff --git a/attic/apps/samples/WEB-INF/src/flex/samples/dcd/product/Product.java b/attic/apps/samples/WEB-INF/src/flex/samples/dcd/product/Product.java new file mode 100755 index 0000000..be6d992 --- /dev/null +++ b/attic/apps/samples/WEB-INF/src/flex/samples/dcd/product/Product.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package flex.samples.dcd.product; +import java.io.Serializable; + +public class Product implements Serializable { + + static final long serialVersionUID = 103844514947365244L; + + private int productId; + private String name; + private String description; + private String image; + private String category; + private double price; + private int qtyInStock; + + public Product() { + + } + + public Product(int productId, String name, String description, String image, String category, double price, int qtyInStock) { + this.productId = productId; + this.name = name; + this.description = description; + this.image = image; + this.category = category; + this.price = price; + this.qtyInStock = qtyInStock; + } + + public String getCategory() { + return category; + } + public void setCategory(String category) { + this.category = category; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getImage() { + return image; + } + public void setImage(String image) { + this.image = image; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public double getPrice() { + return price; + } + public void setPrice(double price) { + this.price = price; + } + public int getProductId() { + return productId; + } + public void setProductId(int productId) { + this.productId = productId; + } + public int getQtyInStock() { + return qtyInStock; + } + public void setQtyInStock(int qtyInStock) { + this.qtyInStock = qtyInStock; + } + +} \ No newline at end of file
