/** * Inserts a new record. This method always returns a non null result. The ID field holds the * Unique ID for the inserted record (when greater than zero) or the error number (when less than * zero). If the ID is zero, the record was inserted but the server did not returned the Unique * ID. */ public ims.dto.Result insert() { ims.dto.Result reLoginResult = Connection.reLogin(); if (reLoginResult != null) return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.Insert"); if (DataCollection.count() == 0) return new ims.dto.Result("No data to insert", "DTO.Client.Go_mdt_hcps.Insert"); if (DataCollection.count() > 1) return new ims.dto.Result( "Multiple object insert not allowed", "DTO.Client.Go_mdt_hcps.Insert"); ims.dto.Result result = Connection.insert(serviceName, encodeNASMessage()); if (result != null) return result; int recordID = 0; try { recordID = new Integer(Connection.getValueAt(2)).intValue(); } catch (NumberFormatException ex) { return new ims.dto.Result("Invalid record ID returned", "DTO.Client.Go_mdt_hcps.Insert"); } return new ims.dto.Result( recordID, "No error. The ID of the new record is in the ID field", "DTO.Client.Go_mdt_hcps.Insert"); }