Re: OGOJOGI->Person.insertJob()

Christoph Guse <[email protected]>
Newsgroups gmane.comp.cms.opengroupware.xmlrpc.devel
Message-ID <[email protected]>
Hi murphee,

your approach helped a little bit, but didn't solve my problem 
completely. Weh I use insert insert(Person person, java.util.Date 
startDate, java.util.Date endDate, java.lang.String name)  of the 
JobManager class, I only can set the three job-arguments. Here my code:

    public boolean updateJob(OgoJobVO job, String user, String password) 
throws OgoException, ConnectionException{
       
        boolean gespeichert = false;
        String [] args = {job.getId()};
               
        try{
            // Verbindung zum Server aufbauen
            XMLConnector myCon = new XMLConnector(user,password);
            XmlRpcConnection con = myCon.connect();
           
            // OpenGroupWare Instanz
            OpenGroupWare ogo = con.getOpenGroupWareInstance();
           
            //JobManager
            JobManager jobMan = ogo.getJobManager();
           
            // Jobs abfragen
            Iterator iter = ogo.getJobManager().getJobs(args);
            if(iter != null){
                Job tempJob = (Job)iter.next();
               
                // Ausführer des Jobs ermitteln
                Account pers_acc = tempJob.getExecutor();
                Person pers = pers_acc.getPerson();
                Job insJob = jobMan.insert(pers,job.getStartDatum(), 
job.getEndDatum(), job.getName());
                insJob.setPriority(5);
               
               
                //tempJob.setStartDate(job.getStartDatum());
                //tempJob.setName(job.getName());
            }
           
            // Verbindung schließen
            con.closeConnection();
        }
        finally{}
       
        return true;
    }

The method isn't completed yet, OgoJobVO is a Valueobject I need with 
Macromedia Flex and contains only the values of a job.
The insert method works, but if I try to set something, i.e. the 
priority, I receive org.opengroupware.jogi.ogo.OgoException: 
NoSuchAction: action not implemented. We mailed about this issue. If you 
use the xmlrpc_caller tool you will see, there is no function 
jobs.updateJob even though it is in the xml-rpc-de.pdf documentation. 
You gave me a hint, person.updateJob is available, but I don't have any 
documentation about this method and I don't know about the needed arguments.
My problem is, I can't insert a complete new Job and I'm not able to 
update a job. What a pity.

Any more suggestions apart from sending a bug or an enhancement?

Greets
Christoph


murphee (Werner Schuster) wrote:

> Christoph Guse wrote:
>
>> Hello List,
>>
>> I'm trying to use the insertJob(Job job) method of the Person ogojogi 
>> class. Since I'm not a Java developer, I have difficulties with the 
>> Job argument because I don't know how to instantiate such a job. Job 
>> itself is a Interface, so Job job = new Job() doesn't work. If I try 
>> to use Job job = new XmlRpcJob(Date startDate, Date endDate, String 
>> name, XmlRpcCaller caller, OpenGroupWare ogo) this doen't work, 
>> because the constructor is protected and I don't have a caller 
>> instance and no ogo instance, because it is a brand new Job.
>
>
>
> Jobs are managed via the JobManager, which has methods for inserting 
> Jobs. This is handled this way to ensure
> that you only get valid Job objects that actually exist on the OGO 
> server;
>
>
> You get the JobManager instance object from the OpenGroupWare object 
> (see the http://ogo-jogi.sourceforge.net/doc/userguide.html)
> for an introduction on how to use JOGI and how to get the 
> OpenGroupWare object);
>
> Basically, you'd do something like:
>
> XmlRpcCaller caller = new 
> ApacheXmlRpcCaller("http://localhost:20001/RPC2", "username", 
> "password");
> XmlRpcConnection conn = new XmlRpcConnection(caller);
> OpenGroupWare ogo = conn.getOpenGroupWareInstance();
> JobManager jobManager = ogo.getJobManager();
> job.insert(.....); // put in your arguments for the job;
>
>
>

-- 
****************************************
 Christoph Guse
 Zimmer 33510
 Hubertusstraße 149
 41239 Mönchengladbach
 Tel.  0 21 66 / 14 52 59
 Mobil 01 72 / 160 74 84
****************************************

-- 
OpenGroupware.org XML-RPC
[email protected]
http://mail.opengroupware.org/mailman/listinfo/xmlrpc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.