I have attached a small project, I don't know very well flash remoting,
but I am trying to use to integrate me to it with a j2ee architecture.
I wanted to ask you two things out of politeness,
1)se look the file Test.mxml, according to you it is all right as I
approach for popolore one "Pojo ActionScrtipt"
2)Ma the true problem, is that flex when I try to use the class pojo
"vopf[0]. stagione.cdc_stag" it lifts me some wornings telling me that
cdc_Stag is not a known type,
but he works well the same,??? about you it's a bug????
Last very important thing, is that in the function
"function Aggiorna(vo:PfVO):Void
{
Campionario.Lista(vo);
}
"
flex throws "Method Lista not found", but the think that macaws to
problem with to cast?

3) is it possible to use editField with a class "pojo ActionScript", can
you explain me as?
Khan you give me your help, also of the suggestions, on as to resolve
these problems
Thanks thousand to everybody
Devis

package vo.as400;



public class CStagione implements java.io.Serializable {

private String cdc_stag;
private String dsc_stag;



public String _remoteClass = "vo.as400.CStagione";
public String getCdc_stag() {
return cdc_stag;
}

public void setDsc_stag(String dsc_stag) {
this.dsc_stag = dsc_stag;
}

public void setCdc_stag(String cdc_stag) {
this.cdc_stag = cdc_stag;
}


public String getDsc_stag() {
return dsc_stag;
}


}

package vo.as400;






public class PfVO

implements java.io.Serializable {

private String strepf;
private String de50pf;
private String fl20pf;
private PfVOPK pfvopk;
private CStagione stagione;

public String _remoteClass = "vo.as400.PfVO";



public String getFl20pf() {
return fl20pf;
}

public String getStrepf() {
return strepf;
}

public void setDe50pf(String de50pf) {
this.de50pf = de50pf;
}



public void setFl20pf(String fl20pf) {
this.fl20pf = fl20pf;
}

public void setStrepf(String strepf) {
this.strepf = strepf;
}

public void setPfvopk(PfVOPK pfvopk) {
this.pfvopk = pfvopk;
}

public void setStagione(CStagione stagione) {
this.stagione = stagione;
}

public String getDe50pf() {
return de50pf;
}

public PfVOPK getPfvopk() {
return pfvopk;
}

public CStagione getStagione() {

return stagione;
}

public PfVO() {

}



}

package vo.as400;

import java.io.Serializable;
import util.*;

public class PfVOPK implements Serializable {

private String stagpf;
private String modepf;
private String matepf;
public String getStagpf() {
return stagpf;
}

public String getModepf() {
return modepf;
}

public void setMatepf(String matepf) {
this.matepf = matepf;
}

public void setStagpf(String stagpf) {
this.stagpf = stagpf;
}

public void setModepf(String modepf) {
this.modepf = modepf;
}

public String getMatepf() {
return matepf;
}

public PfVOPK(String stagpf,String modepf,String matepf) {
this.stagpf=stagpf;
this.modepf=modepf;
this.matepf=matepf;
}
public PfVOPK()
{

}

public boolean equals(Object other) {
if (this == other)
return true;
if (! (other instanceof PfVOPK))return false;
PfVOPK that = (PfVOPK) other;
return
EqualsUtil.areEqual(this.stagpf, that.stagpf)&&
EqualsUtil.areEqual(this.modepf, that.modepf)&&
EqualsUtil.areEqual(this.matepf, that.matepf);
}

public int hashCode() {
return this.hashCode();

}

}

class vo.as400.CStagione {

public var cdc_stag : String;
public var dsc_stag : String;

public var _remoteClass : String;

public function CStagione() {
_remoteClass="vo.as400.CStagione";
}






}
class vo.as400.PfVO {

public var de50pf : String;
public var fl20pf : String;
public var pfvopk : PfVOPK;
public var stagione : CStagione;
public var strepf : String;

public var _remoteClass : String;

public function PfVO() {
_remoteClass="vo.as400.PfVO";
}


}
class vo.as400.PfVOPK {

public var matepf : String;
public var modepf : String;
public var stagpf : String;

public var _remoteClass : String;

public function PfVOPK() {
_remoteClass="vo.as400.PfVOPK";
}


}



package workflow;

import java.sql.*;
import java.util.*;
import org.hibernate.*;
import dao.*;
import dao.as400.*;
import dao.concetto.*;
import database.*;
import exception.*;
import util.*;
import vo.*;
import vo.as400.*;

public class WFCampionario {

public Collection getListaConcetti(String stagione, String tipo, String flash) {
try {
IConcetto iconcetto = CDaoFactory.getConcettoDAO();
return iconcetto.groupConcetti(stagione, tipo, flash);
}
catch (DaoException ex) {
return null;
}
}

public CStagione[] getAllSeasons() {
try {

IStagione stagione = CDaoFactory.getStagioneDAO();
return stagione.getAllSeason();
}
catch (DaoException ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
}
return null;
}

public PfVO[] getProduct() {
try {

IStagione stagione = CDaoFactory.getStagioneDAO();
return stagione.getAllProduct();
}
catch (DaoException ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
}
return null;
}

public void Lista(PfVO pf)
{
System.out.print(pf.getDe50pf());
}


public PfVO[] Test(int Start,int End) {
try {
Session session = FirebirdSession.currentSession();
//Transaction tx = session.beginTransaction();
//Query q = session.createQuery("from ModeVO as ay where ay.stagmo=?");
//q.setString(0, cdc_stag);
//ModeVO vos[] = new ModeVO[q.list().size()];
//q.list().toArray(vos);
/* PfVO pf = new PfVO();
pf.setStagpf("2005");
pf.setModepf("C018700036");
pf.setMatepf("00000");
//PfVO vo = (PfVO)session.load(PfVO.class,pf);

PfVOPK pfpk = new PfVOPK();
pfpk.setStagpf("1900");
pfpk.setModepf("00DEVIS");
pfpk.setMatepf("0000");
PfVO vo = (PfVO)session.load(PfVO.class,pfpk);
*/
// System.out.println(vo.getStagione().getDsc_stag()); Now Work
/* PfVO t = new PfVO();
CStagione stag = new CStagione();
stag.setCdc_stag("de");
stag.setDsc_stag("prova");
t.setPfvopk(pfpk);
t.setDe50pf("Articolo");
t.setFl20pf("1");
session.saveOrUpdate(t);*/
Query q = session.createQuery("from PfVO as ay");
q.setFirstResult(Start);
q.setMaxResults(End);


ArrayList list = new ArrayList();
list=(ArrayList)q.list();
PfVO vos[] = new PfVO[list.size()];
list.toArray(vos);
FirebirdSession.closeSession();
return vos;

}
catch (Exception ex) {
ex.printStackTrace();
System.out.println("Devis Msg " + ex.getMessage());
return null;
}

}

public String CiaoMondo(){
return "Cia Mondo";
}

public ModeVO[] getProducts(String cdc_stag, String tipo, String flash,
String concetto) {
try {
// getProducts(cdc_stag);
Connection conn = ConnectionFactory.getInstance().getConn_Access();
PreparedStatement stmt = conn.prepareStatement("Select modello,tessuto,note_ from concetto where trim(stagione)=? and trim(tipo)=? and trim(flash)=? and trim(concetto)=? Order by 1,2 asc");
stmt.setString(1, cdc_stag.trim());
stmt.setString(2, tipo.trim());
stmt.setString(3, flash.trim());
stmt.setString(4, concetto.trim());
ResultSet rset = stmt.executeQuery();
ArrayList list = new ArrayList();
ModeVO modevo = null;
for (; rset.next(); ) {

modevo = new ModeVO();
modevo.setDe20mo(rset.getString(1));
modevo.setDe30mo(rset.getString(2));
modevo.setStremo(rset.getString(3));
modevo.setModemo(getTaglie(modevo.getDe20mo()));
list.add(modevo);

}
rset.close();
stmt.close();
ModeVO modevos[] = new ModeVO[list.size()];
list.toArray(modevos);
return modevos;
}
catch (Exception ex) {
ex.printStackTrace();
throw new java.lang.UnsupportedOperationException(
"CLineeDao getAllMarchio " + ex.getMessage());
}
}

public double GetPrice(String cdc_art, String cdc_tess) {
try {
Connection conn = ConnectionFactory.getInstance().getConn();

PreparedStatement stmt = conn.prepareStatement("Select pv01li from sdgtwb_dat.lispf00f where streli='' and stagli='2005' and modeli=? and mateli=? ");
stmt.setString(1, cdc_art.trim());
stmt.setString(2, cdc_tess.trim());

ResultSet rset = stmt.executeQuery();
double importo = 0;
while (rset.next())
importo = rset.getDouble(1);
rset.close();
stmt.close();
return importo;
}
catch (Exception ex) {
ex.printStackTrace();
throw new java.lang.UnsupportedOperationException(
"CLineeDao getAllMarchio " + ex.getMessage());
}

}

public String getTaglie(String cdc_art) {
try {
Connection conn = ConnectionFactory.getInstance().getConn();

PreparedStatement stmt = conn.prepareStatement(
"Select * from sdgtwb_dat.eymtg00f where modew8=?");
stmt.setString(1, cdc_art.trim());

Vector tg = new Vector();
ResultSet rset = stmt.executeQuery();

while (rset.next()) {
for (int x = 1; x < 10; x++) {
String campo = "";
if (x < 10)
campo = rset.getString("TG0" + String.valueOf(x) + "W8");
else
campo = rset.getString("TG" + String.valueOf(x) + "W8");
if (!campo.trim().equals(""))
tg.addElement(campo);
}

}
rset.close();
stmt.close();
String taglia = "";
if (tg.size() > 0)
taglia = tg.firstElement() + "-" + tg.lastElement();
return taglia;
}
catch (Exception ex) {
ex.printStackTrace();
throw new java.lang.UnsupportedOperationException(
"CLineeDao getAllMarchio " + ex.getMessage());
}

}

public ColoVO[] getColori(String cdc_stag, String cdc_art, String tessuto) {
try {
Connection conn = ConnectionFactory.getInstance().getConn();

PreparedStatement stmt = conn.prepareStatement("Select colopd,decopd from sdgtwb_dat.arcpd00f where stagpd=? and modepd=? and matepd=? and strepd=''");
stmt.setString(1, "2005");
stmt.setString(2, cdc_art.trim());
stmt.setString(3, tessuto.trim());
ResultSet rset = stmt.executeQuery();
ArrayList list = new ArrayList();
ColoVO colovo = null;
double importo = GetPrice(cdc_art, tessuto);
for (; rset.next(); ) {

colovo = new ColoVO();
colovo.setColopd(rset.getString(1));
colovo.setDecopd(rset.getString(2));
colovo.setStrepd(String.valueOf(importo));
list.add(colovo);

}
rset.close();
stmt.close();
ColoVO colovos[] = new ColoVO[list.size()];
list.toArray(colovos);
return colovos;
}
catch (Exception ex) {
ex.printStackTrace();
throw new java.lang.UnsupportedOperationException(
"CLineeDao getAllMarchio " + ex.getMessage());
}
}

public CFlash[] getAllFlash() {
try {
IFlash iflash = CDaoFactory.getFlashDAO();
return iflash.getAllFlash();
}
catch (DaoException ex) {
System.out.println(ex.getMessage());
}
return null;
}

}

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
themeColor="haloSilver"
xmlns="*">


<!--WorkFlow Campionario Via del Corso S.p.A. -->
<mx:RemoteObject id="Campionario" named="FCampionarioRO"
fault="errorCall(event.fault.description)" showBusyCursor="true">
<mx:method name="Test" result="onResult(event.result)"/>
<mx:method name="Lista"/>
</mx:RemoteObject>



<mx:Binding source="{vopf[0].stagione.cdc_stag==undefined ?'':vopf[0].stagione.cdc_stag}" destination="cdc_art.text" />
<mx:Binding source="{vopf[0].stagione.dsc_stag==undefined ?'':vopf[0].stagione.dsc_stag}" destination="cdc_art2.text" />
<mx:Binding source="{vopf[0].de50pf==undefined ?'':vopf[0].de50pf}" destination="descr.text" />
<mx:Binding source="{vopf[0].pfvopk.matepf==undefined ?'':vopf[0].pfvopk.matepf}" destination="mate.text" />


<mx:Script source="as/labelFunction.as"/>

<mx:Script>

var StartX=0;
var Max_Result=100;
import vo.as400.*;
var vopf:PfVO;

function AutoInc()
{
if(vopf[0].de50pf==undefined)
{
StartX=0;
Campionario.Test(StartX,Max_Result); 
} 
else
{
StartX++;
Campionario.Test(StartX,Max_Result);
} 

}









function errorCall(alert)
{
mx.controls.Alert.show("Web service failed!"+alert, "Errore Interno ",
mx.controls.Alert.OK);
}


function onResult(result):Void
{
var pf:PfVO=(PfVO)result;
vopf=pf;
}

function Aggiorna(vo:PfVO):Void
{
Campionario.Lista(vo);
}


</mx:Script>

<mx:Button label="Product" click="AutoInc();"/>
<mx:Button label="PassaPOJO" click="Aggiorna(vopf[0])"/>


<mx:TextInput id="descr" />
<mx:TextInput id="mate" />
<mx:TextInput id="cdc_art2" />
<mx:TextInput id="cdc_art"/>
<mx:DataGrid dataProvider="{vopf}" width="100%">
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="de50pf" headerText="Descrizione"/>
<mx:DataGridColumn labelFunction="getMateriale" headerText="Materiale"/>
<mx:DataGridColumn labelFunction="getStagione" headerText="Stagione"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:Application>



Reply via email to