UpdatePhone to update line label with AXL Java

Version 1
    This document was generated from CDN thread

    Created by: Chris Halverson on 19-05-2010 07:53:07 PM
    I am attempting to update the line label of a line using Java AXL. According to the examples and such that I've been able to cobble together from the docs and the forum, the code should work, however I am getting exceptions such as:
     
    Non nillable element 'pattern' is null.
     
    or
     
    Non nillable element 'usage' is null.
     
    I've tracked this down to the directory number attributes, however, these are already null in the existing directory number. So I'm confused as to how it can be created with null fields, but when I try to update via AXL it complains.
     
    Does anybody have any Java AXL code that they could share that shows an example of how to update the line label or an explaination as to the above issue?
     
    Thanks!
     

    Subject: RE: UpdatePhone to update line label with AXL Java
    Replied by: Stefan Schallmeiner on 15-02-2011 06:46:12 AM
    I am attempting to update the line label of a line using Java AXL. According to the examples and such that I've been able to cobble together from the docs and the forum, the code should work, however I am getting exceptions such as:
     
    Non nillable element 'pattern' is null.
     
    or
     
    Non nillable element 'usage' is null.
     
    I've tracked this down to the directory number attributes, however, these are already null in the existing directory number. So I'm confused as to how it can be created with null fields, but when I try to update via AXL it complains.
     
    Does anybody have any Java AXL code that they could share that shows an example of how to update the line label or an explaination as to the above issue?
     
    Thanks!
     

     
    If anybody wonders, here's some code that should do the trick:
     
    XLine[] xline_arr = phone_ret.getDevice().getLines().getLine();

                    for (int i = 0; i < xline_arr.length; i++) {

                        GetLineReq rq_line = new GetLineReq();
                        rq_line.setUuid(xline_arr.getDirn().getUuid());
                        GetLineResReturn ret = null;
                        try {
                            ret = stub.getLine(rq_line).get_return();
                        } catch (RemoteException e) {
                            logger.error(e.getMessage());
                        }

                        xline_arr.getDirn().setPattern(
                                ret.getDirectoryNumber().getPattern());
                        xline_arr.getDirn().setUsage("Device");

                        if (xline_arr.getDirn().getUuid().equals(line_uuid)) {
                            xline_arr.setDisplay(label);
                            xline_arr.setLabel(label);
                            xline_arr.setAsciiLabel(label);
                            xline_arr.setLabel(label);
                            xline_arr.setDisplayASCII(label);

                            UpdateLineReq rq_update_line = new UpdateLineReq();
                            rq_update_line
                            .setUuid(xline_arr.getDirn().getUuid());

                            rq_update_line.setAsciiAlertingName(label);
                            rq_update_line.setAlertingName(label);

                            try {
                                stub.updateLine(rq_update_line);
                            } catch (RemoteException e) {
                                // TODO Auto-generated catch block
                                logger.error(e.getMessage());
                            }
                        }

                        xline_arr.setPartitionUsage(null);
                    }

                    UpdatePhoneReq rq_update_phone = new UpdatePhoneReq();
                    rq_update_phone.setName(phone);

                    UpdatePhoneReqLines rq_update_lines = new UpdatePhoneReqLines();
                    rq_update_lines.setLine(xline_arr);

                    rq_update_phone.setLines(rq_update_lines);