Re: [flexcoders] Re: VO Issues

2009-05-26 Thread Tom Chiverton
On Wednesday 20 May 2009, Jake Churchill wrote:
> Struct[__TYPE__] = "com.rottmanj.model.vo.CompanyVO";

Though note this doesn't handle booleans quite right. You need to JavaCast() 
them.

-- 
Helping to revolutionarily facilitate unique technologies as part of the IT 
team of the year, '09 and '08

Tom Chiverton
Developer
Tel: +44 0161 618 5032
Fax: +44 0161 618 5099 
tom.chiver...@halliwells.com
3 Hardman Square, Manchester, M3 3EB
www.Halliwells.com



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at 
Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of 
members is available for inspection at the registered office together with a 
list of those non members who are referred to as partners. We use the word 
?partner? to refer to a member of the LLP, or an employee or consultant with 
equivalent standing and qualifications. Regulated by the Solicitors Regulation 
Authority.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged. If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents. If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 2500.

For more information about Halliwells LLP visit www.Halliwells.com.
 

[flexcoders] Re: VO Issues

2009-05-25 Thread Jeremy Rottman
Bah, I figured it out. 

I had put a ; after the metadata. 



[flexcoders] Re: VO Issues

2009-05-25 Thread Jeremy Rottman
I took your suggestion and use Charles to determine what was being sent.

This is the request that I send.

Parameters  Array   
[0] Object  
person_titleString  
person_type String  
pref_displayString  
is_active   Boolean false
company_person_id   String  
person_id   String  
company_id  String  ABCDEFG
last_name   String  
lang_pref   String  
first_name  String  
mid_nameString

The structure is correct, but the type casting is wrong.

It should look like this.
Parameters  Array   
[0] Object  com.rottmanj.model.vo.CompanyPersonVO
person_titleString  
person_type String  
pref_displayString  
is_active   Boolean false
company_person_id   String  
person_id   String  
company_id  String  ABCDEFG
last_name   String  
lang_pref   String  
first_name  String  
mid_nameString

I am just not sure as to why it is not properly type casting the object 
correctly.

Here is my current AS/VO code.
/*
@brief: Display all company people
*/
private function aGetCompanyPerson():void
{
var personVO:CompanyPersonVO = new 
CompanyPersonVO()
personVO.company_id = "ABCDEFG";

roCompany.sGetPerson_Company(personVO); 

}

/*
@brief: ResultEvent for get keys
*/
private function 
rGetCompanyPerson(event:ResultEvent):void
{
acPerson = new ArrayCollection(event.result as 
Array);
}


VO:
package com.rottmanj.model.vo
{
import mx.collections.ArrayCollection;

[RemoteClass(alias="com.rottmanj.model.vo.CompanyPersonVO")];


[Bindable]
public class CompanyPersonVO
{
public var company_person_id:String 
= "";
public var person_id:String 
= "";
public var company_id:String
= "";
public var person_type:String   
= "";
public var person_title:String  
= "";
public var first_name:String
= "";
public var mid_name:String  
= "";
public var last_name:String 
= "";
public var pref_display:String  
= "";
public var lang_pref:String 
= "";
public var is_active:Boolean
= false;





public function CompanyPersonVO()
{
}

}
}



[flexcoders] Re: VO Issues

2009-05-21 Thread valdhor
Have you tried looking at Charles to see what is actually sent?


--- In flexcoders@yahoogroups.com, "Jeremy Rottman"  wrote:
>
> Ok here is another oddity that I have run into.
> 
> I have these two methods one is the action method used to call the cfc and 
> the other is the result event for the results.
> 
> [Bindable]
> public var acKeys:ArrayCollection;
> public var acPerson:ArrayCollection;
> public var companyVO:CompanyVO;
> private var personVO:CompanyPersonVO = new CompanyPersonVO();
> 
> /*
>   @brief: Display all company people
> */
> private function aGetCompanyPerson():void
> {
>   
>   personVO.company_id = companyVO.alt_id;
>   trace(ObjectUtil.toString(personVO));
>   roCompany.sGetPersons(personVO);
>   
> }
> 
> /*
>   @brief: ResultEvent for get keys
> */
> private function rGetCompanyPerson(event:ResultEvent):void
> {
>   acPerson = new ArrayCollection(event.result as Array);
> }
> 
> Here is the CFC method that I am using.
> 
>returntype="com.rottmanj.model.vo.CompanyPersonVO[]">
>type="com.rottmanj.model.vo.CompanyPersonVO">
>   
>"component", "com.rottmanj.model.dao.CompanyPersonDAO").init( "uis_dev" ) />
>companyDAO.getPerson_CompanyDAO(personVO)>
>   
>   
> 
> Now when I run the action script method above I get the following error. I 
> have verified that the cfc is correctly working.
> 
> [RPC Fault faultString="Unable to invoke CFC - The PERSONVO parameter to the 
> sGetPersons function is required but was not passed in." 
> faultCode="Server.Processing" faultDetail=""]
> 
> Now you can easily see that I am passing in the parameter personVO. When I 
> trace out the personVO, I get the correct resutls of:
> (com.rottmanj.model.vo::CompanyPersonVO)#0
>   company_id = "ALC01051998_0172"
>   company_person_id = ""
>   first_name = ""
>   is_active = false
>   lang_pref = ""
>   last_name = ""
>   mid_name = ""
>   person_id = ""
>   person_title = ""
>   person_type = ""
>   pref_display = ""
>




[flexcoders] Re: VO Issues

2009-05-20 Thread Jeremy Rottman
Ok here is another oddity that I have run into.

I have these two methods one is the action method used to call the cfc and the 
other is the result event for the results.

[Bindable]
public var acKeys:ArrayCollection;
public var acPerson:ArrayCollection;
public var companyVO:CompanyVO;
private var personVO:CompanyPersonVO = new CompanyPersonVO();

/*
@brief: Display all company people
*/
private function aGetCompanyPerson():void
{

personVO.company_id = companyVO.alt_id;
trace(ObjectUtil.toString(personVO));
roCompany.sGetPersons(personVO);

}

/*
@brief: ResultEvent for get keys
*/
private function rGetCompanyPerson(event:ResultEvent):void
{
acPerson = new ArrayCollection(event.result as Array);
}

Here is the CFC method that I am using.









Now when I run the action script method above I get the following error. I have 
verified that the cfc is correctly working.

[RPC Fault faultString="Unable to invoke CFC - The PERSONVO parameter to the 
sGetPersons function is required but was not passed in." 
faultCode="Server.Processing" faultDetail=""]

Now you can easily see that I am passing in the parameter personVO. When I 
trace out the personVO, I get the correct resutls of:
(com.rottmanj.model.vo::CompanyPersonVO)#0
  company_id = "ALC01051998_0172"
  company_person_id = ""
  first_name = ""
  is_active = false
  lang_pref = ""
  last_name = ""
  mid_name = ""
  person_id = ""
  person_title = ""
  person_type = ""
  pref_display = ""



[flexcoders] Re: VO Issues

2009-05-20 Thread Jeremy Rottman
Well I ended up figuring it out, it was a small issue with how the returning 
cfc data was type cast.

Always the small things that you never expect it to be.





[flexcoders] Re: VO Issues

2009-05-20 Thread valdhor
Instead of

companyVO = event.itemRenderer.data as CompanyVO

try

companyVO = event.currentTarget.selectedItem as CompanyVO


HTH


Steve


--- In flexcoders@yahoogroups.com, "Jeremy Rottman"  wrote:
>
> I have written a vo that for some odd reason always comes up null when I try 
> to populate it. Everything I have tried comes up with the same results. I 
> could use an extra set of eyes to see if there is something small I am 
> missing.
> 
> Any help with this is greatly appreciated.
> 
> 
> CompanyVO:
> package com.rottmanj.model.vo
> {
>   import mx.collections.ArrayCollection;
>   
>   [RemoteClass(alias="com.rottmanj.model.vo.CompanyVO")]
>
>   [Bindable]
>   public class CompanyVO
>   {
>   
>   public var company_uuid:String  
> = "";
>   public var company_indst:String 
> = "";
>   public var company_class:String 
> = "";
>   public var description:String   
> = "";
>   public var isPriv:Boolean   
> = false;
>   public var alt_id:String
> = "";
>   public var entity_name:String   
> = "";
>   public var create_who:String
> = "";
>   
>   // address vo 
>   
>   public var address_id:String
> = "";
>   public var address1:String  
> = "";
>   public var unit_type:String 
> = "";
>   public var unit_number:String   
> = "";
>   public var address2:String  
> = "";
>   public var city:String  
> = "";
>   public var state_prov:String
> = "";
>   public var code_zip:String  
> = "";
>   public var country:String   
> = "";
>   public var type:String  
> = "";
>   
>   
>   public function CompanyVO()
>   {
>   }
> 
>   }
> }
> 
> Populating the VO:
> 
> [Bindable]
> public var companyVO:CompanyVO;
> 
> private function sSelectCompany(event:ListEvent):void
> {
>   companyVO = event.itemRenderer.data as CompanyVO
> trace(ObjectUtil.toString(companyVO));
> }
> 
> When a user clicks on a row in a datagrid, sSelectCompany is called via 
> itemDoubleClick="sSelectCompany(event)". This works perfectly fine. 
> 
> This is the result I get from tracing out the event.itemRenderer.data
> (Object)#0
>   address1 = ""
>   address2 = ""
>   address_id = ""
>   alt_id = "ALC05042009_0001"
>   city = ""
>   code_zip = ""
>   company_class = "Schol"
>   company_indst = "Elect"
>   company_uuid = "COM05042009_0001"
>   country = ""
>   create_who = ""
>   description = "This is agreat Company"
>   entity_name = "Test Company"
>   isPriv = 0
>   mx_internal_uid = "F1EC080D-498D-9825-761F-5DF5E33C39DF"
>   state_prov = ""
>   type = ""
>   unit_number = ""
>   unit_type = ""
> 
> I have tested my coldfusion code and it returns the proper VO. I have 
> verified that case is not the issue.
> 
> component com.rottmanj.model.vo.CompanyVO
> ADDRESS1  [empty string]
> ADDRESS2  [empty string]
> STATE_PROV[empty string]
> ALT_IDALC05042009_0001
> DESCRIPTION   This is agreat Company
> CODE_ZIP  [empty string]
> ADDRESS_ID[empty string]
> ISPRIV0
> CITY  [empty string]
> COUNTRY   [empty string]
> COMPANY_UUID  COM05042009_0001
> UNIT_NUMBER   [empty string]
> ENTITY_NAME   Test Company
> TYPE  [empty string]
> COMPANY_INDST Elect
> UNIT_TYPE [empty string]
> COMPANY_CLASS Schol
> CREATE_WHO[empty string]
>




RE: [flexcoders] Re: VO Issues

2009-05-20 Thread Jake Churchill
If you are using ColdFusion for your server, you can return a typed
structure rather than registering the object mappings.  Like this:

 

Struct[__TYPE__] = "com.rottmanj.model.vo.CompanyVO";

 

Jake Churchill
CF Webtools
11204 Davenport, Ste. 100
Omaha, NE  68154
 <http://www.cfwebtools.com> http://www.cfwebtools.com
402-408-3733 x103

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of djhatrick
Sent: Wednesday, May 20, 2009 10:08 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: VO Issues

 






I think we'd need to see more code to help you more. Usually, something is
being casted with as and it doesn't match the data type, it will throw null.
I would try removing the class alias, and see what happens. Also, try
calling 

registerClassAlias("com.rottmanj.model.vo.CompanyVO")

In your startup, if that doesn't work, try just populating a generic object.

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ,
"Jeremy Rottman"  wrote:
>
> I have written a vo that for some odd reason always comes up null when I
try to populate it. Everything I have tried comes up with the same results.
I could use an extra set of eyes to see if there is something small I am
missing.
> 
> Any help with this is greatly appreciated.
> 
> 
> CompanyVO:
> package com.rottmanj.model.vo
> {
> import mx.collections.ArrayCollection;
> 
> [RemoteClass(alias="com.rottmanj.model.vo.CompanyVO")]
> 
> [Bindable]
> public class CompanyVO
> {
> 
> public var company_uuid:String = "";
> public var company_indst:String = "";
> public var company_class:String = "";
> public var description:String = "";
> public var isPriv:Boolean = false;
> public var alt_id:String = "";
> public var entity_name:String = "";
> public var create_who:String = "";
> 
> // address vo 
> 
> public var address_id:String = "";
> public var address1:String = "";
> public var unit_type:String = "";
> public var unit_number:String = "";
> public var address2:String = "";
> public var city:String = "";
> public var state_prov:String = "";
> public var code_zip:String = "";
> public var country:String = "";
> public var type:String = "";
> 
> 
> public function CompanyVO()
> {
> }
> 
> }
> }
> 
> Populating the VO:
> 
> [Bindable] 
> public var companyVO:CompanyVO;
> 
> private function sSelectCompany(event:ListEvent):void
> {
> companyVO = event.itemRenderer.data as CompanyVO
> trace(ObjectUtil.toString(companyVO));
> }
> 
> When a user clicks on a row in a datagrid, sSelectCompany is called via
itemDoubleClick="sSelectCompany(event)". This works perfectly fine. 
> 
> This is the result I get from tracing out the event.itemRenderer.data
> (Object)#0
> address1 = ""
> address2 = ""
> address_id = ""
> alt_id = "ALC05042009_0001"
> city = ""
> code_zip = ""
> company_class = "Schol"
> company_indst = "Elect"
> company_uuid = "COM05042009_0001"
> country = ""
> create_who = ""
> description = "This is agreat Company"
> entity_name = "Test Company"
> isPriv = 0
> mx_internal_uid = "F1EC080D-498D-9825-761F-5DF5E33C39DF"
> state_prov = ""
> type = ""
> unit_number = ""
> unit_type = ""
> 
> I have tested my coldfusion code and it returns the proper VO. I have
verified that case is not the issue.
> 
> component com.rottmanj.model.vo.CompanyVO
> ADDRESS1 [empty string]
> ADDRESS2 [empty string]
> STATE_PROV [empty string]
> ALT_ID ALC05042009_0001
> DESCRIPTION This is agreat Company
> CODE_ZIP [empty string]
> ADDRESS_ID [empty string]
> ISPRIV 0
> CITY [empty string]
> COUNTRY [empty string]
> COMPANY_UUID COM05042009_0001
> UNIT_NUMBER [empty string]
> ENTITY_NAME Test Company
> TYPE [empty string]
> COMPANY_INDST Elect
> UNIT_TYPE [empty string]
> COMPANY_CLASS Schol
> CREATE_WHO [empty string]
>



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.339 / Virus Database: 270.12.34/2122 - Release Date: 05/20/09
06:22:00



[flexcoders] Re: VO Issues

2009-05-20 Thread djhatrick
I think we'd need to see more code to help you more.  Usually, something is 
being casted with as and it doesn't match the data type, it will throw null.  I 
would try removing the class alias, and see what happens.  Also, try calling 

registerClassAlias("com.rottmanj.model.vo.CompanyVO")

In your startup, if that doesn't work, try just populating a generic object.


--- In flexcoders@yahoogroups.com, "Jeremy Rottman"  wrote:
>
> I have written a vo that for some odd reason always comes up null when I try 
> to populate it. Everything I have tried comes up with the same results. I 
> could use an extra set of eyes to see if there is something small I am 
> missing.
> 
> Any help with this is greatly appreciated.
> 
> 
> CompanyVO:
> package com.rottmanj.model.vo
> {
>   import mx.collections.ArrayCollection;
>   
>   [RemoteClass(alias="com.rottmanj.model.vo.CompanyVO")]
>
>   [Bindable]
>   public class CompanyVO
>   {
>   
>   public var company_uuid:String  
> = "";
>   public var company_indst:String 
> = "";
>   public var company_class:String 
> = "";
>   public var description:String   
> = "";
>   public var isPriv:Boolean   
> = false;
>   public var alt_id:String
> = "";
>   public var entity_name:String   
> = "";
>   public var create_who:String
> = "";
>   
>   // address vo 
>   
>   public var address_id:String
> = "";
>   public var address1:String  
> = "";
>   public var unit_type:String 
> = "";
>   public var unit_number:String   
> = "";
>   public var address2:String  
> = "";
>   public var city:String  
> = "";
>   public var state_prov:String
> = "";
>   public var code_zip:String  
> = "";
>   public var country:String   
> = "";
>   public var type:String  
> = "";
>   
>   
>   public function CompanyVO()
>   {
>   }
> 
>   }
> }
> 
> Populating the VO:
> 
> [Bindable]
> public var companyVO:CompanyVO;
> 
> private function sSelectCompany(event:ListEvent):void
> {
>   companyVO = event.itemRenderer.data as CompanyVO
> trace(ObjectUtil.toString(companyVO));
> }
> 
> When a user clicks on a row in a datagrid, sSelectCompany is called via 
> itemDoubleClick="sSelectCompany(event)". This works perfectly fine. 
> 
> This is the result I get from tracing out the event.itemRenderer.data
> (Object)#0
>   address1 = ""
>   address2 = ""
>   address_id = ""
>   alt_id = "ALC05042009_0001"
>   city = ""
>   code_zip = ""
>   company_class = "Schol"
>   company_indst = "Elect"
>   company_uuid = "COM05042009_0001"
>   country = ""
>   create_who = ""
>   description = "This is agreat Company"
>   entity_name = "Test Company"
>   isPriv = 0
>   mx_internal_uid = "F1EC080D-498D-9825-761F-5DF5E33C39DF"
>   state_prov = ""
>   type = ""
>   unit_number = ""
>   unit_type = ""
> 
> I have tested my coldfusion code and it returns the proper VO. I have 
> verified that case is not the issue.
> 
> component com.rottmanj.model.vo.CompanyVO
> ADDRESS1  [empty string]
> ADDRESS2  [empty string]
> STATE_PROV[empty string]
> ALT_IDALC05042009_0001
> DESCRIPTION   This is agreat Company
> CODE_ZIP  [empty string]
> ADDRESS_ID[empty string]
> ISPRIV0
> CITY  [empty string]
> COUNTRY   [empty string]
> COMPANY_UUID  COM05042009_0001
> UNIT_NUMBER   [empty string]
> ENTITY_NAME   Test Company
> TYPE  [empty string]
> COMPANY_INDST Elect
> UNIT_TYPE [empty string]
> COMPANY_CLASS Schol
> CREATE_WHO[empty string]
>