/** Executes a specific action. This method always returns a non null result. */ public ims.dto.Result executeAction(String action) { if (action.length() == 0) return new ims.dto.Result("Invalid action name", "DTO.Client.Go_mdt_hcps.ExecuteAction"); ims.dto.Result reLoginResult = Connection.reLogin(); if (reLoginResult != null) return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.ExecuteAction"); if (DataCollection.count() == 0) return new ims.dto.Result("Data container is empty", "DTO.Client.Go_mdt_hcps.ExecuteAction"); if (DataCollection.count() > 1) return new ims.dto.Result( "Multiple objects are not allowed", "DTO.Client.Go_mdt_hcps.ExecuteAction"); ims.dto.Result result = Connection.executeAction(serviceName, encodeNASMessage(), action); if (result != null) return result; try { return new ims.dto.Result( new Integer(Connection.getValueAt(2)).intValue(), "No error", "DTO.Client.Go_mdt_hcps.ExecuteAction"); } catch (NumberFormatException ex) { return new ims.dto.Result("Invalid server response", "DTO.Client.Go_mdt_hcps.ExecuteAction"); } }
/** * 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"); }
/** Updates a record. If the result returned is not null an error occured. */ public ims.dto.Result update() { ims.dto.Result reLoginResult = Connection.reLogin(); if (reLoginResult != null) return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.Update"); if (DataCollection.count() == 0) return new ims.dto.Result("No data to update", "DTO.Client.Go_mdt_hcps.Update"); if (DataCollection.count() > 1) return new ims.dto.Result( "Multiple object update not allowed", "DTO.Client.Go_mdt_hcps.Update"); return Connection.update(serviceName, encodeNASMessage()); }
/** * Returns the number of records using the specified filter. This method always returns a non null * result. The ID field holds the count result (when greater or equal to zero) or the error number * (when less than zero). */ public ims.dto.Result count() { ims.dto.Result reLoginResult = Connection.reLogin(); if (reLoginResult != null) return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.Count"); int result = Connection.count(serviceName, encodeNASFilter()); if (result >= 0) return new ims.dto.Result( result, "No error detected. The count result is held in the ID field", "DTO.Client.Go_mdt_hcps.Count"); return Connection.getLastError(); }
/** * Returns one record using the specified filter. If the result returned is not null an error * occured. */ public ims.dto.Result getLast() { DataCollection.clear(); ims.dto.Result reLoginResult = Connection.reLogin(); if (reLoginResult != null) return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.Get"); ims.dto.Result result = Connection.getLast(serviceName, encodeNASFilter()); if (result != null) return result; lastGetFilter = Filter.cloneObject(); decodeNASMessageWithRepeatingGroups(); return null; }
private ims.dto.Result nextList() { ims.dto.Result result = Connection.nextList(serviceName); if (result != null) return result; decodeNASMessage(); return null; }
private ims.dto.Result list(boolean loadAllRecords, int maxRecords) { DataCollection.clear(); ims.dto.Result reLoginResult = Connection.reLogin(); if (reLoginResult != null) return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.List"); listInProgress = true; ims.dto.Result result = Connection.list(serviceName, encodeNASFilter()); if (result != null) { listInProgress = false; if (result.getId() == -2) // NAS list empty return null; return result; } if (decodeNASMessage() == 0) { listInProgress = false; return null; } ims.dto.Result execResult = null; while (execResult == null && canContinueToList(loadAllRecords, maxRecords)) execResult = nextList(); if (execResult != null) { if (execResult.getId() != -3) { listInProgress = false; return execResult; } } else // NAS next list empty { listInProgress = false; return null; } if (!loadAllRecords || !listInProgress) { listInProgress = false; return Connection.stopList(serviceName); } listInProgress = false; return null; }
/** * Performs data validation prior to update. If the result returned is not null an error occured. */ public ims.dto.Result getForUpdate() { ims.dto.Result reLoginResult = Connection.reLogin(); if (reLoginResult != null) return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.GetForUpdate"); if (lastGetFilter == null) return new ims.dto.Result( "Last get method failed or not called", "DTO.Client.Go_mdt_hcps.GetForUpdate"); ims.dto.Result result = Connection.getForUpdate(serviceName, encodeNASFilter(lastGetFilter)); if (result != null) return result; if (Connection.countResponseItems(Connection.getValueAt(6)) == 0) return null; DataCollection.clear(); decodeNASMessageWithRepeatingGroups(); return new ims.dto.Result( "The data was changed by another user", "DTO.Client.Go_mdt_hcps.GetForUpdate"); }
/** Transfers a record. If the result returned is not null an error occured. */ public ims.dto.Result transferData(String action) { if (action.length() == 0) return new ims.dto.Result("Invalid action name", "DTO.Client.Go_mdt_hcps.TransferData"); ims.dto.Result reLoginResult = Connection.reLogin(); if (reLoginResult != null) return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.TransferData"); if (DataCollection.count() == 0) return new ims.dto.Result("No data to transfer", "DTO.Client.Go_mdt_hcps.TransferData"); if (DataCollection.count() > 1) return new ims.dto.Result( "Multiple objects not allowed", "DTO.Client.Go_mdt_hcps.TransferData"); ims.dto.Result result = Connection.transferData(serviceName, encodeNASMessage(), action.toUpperCase()); if (result != null) return result; DataCollection.clear(); decodeNASMessageWithRepeatingGroups(); return null; }
private int decodeNASMessageWithRepeatingGroups() { String[] items = Connection.getResponseItems(Connection.getValueAt(6)); if (items == null) return 0; int records = items.length; if (records == 0) return 0; int recCount = 0; int rgCount = 0; for (int x = 0; x < records; x++) { Go_mdt_hcpsRecord record = new Go_mdt_hcpsRecord(); String[] valueItems = Connection.splitResponseItem(items[x]); record.Go_mdt_hcps_id = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "GO_MDT_HCPS_ID")); record.Pkey = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "PKEY")); record.Rdat = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "RDAT")); record.Rtim = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "RTIM")); record.Rhcp = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "RHCP")); record.Rusr = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "RUSR")); record.Udat = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "UDAT")); record.Utim = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "UTIM")); record.Uhcp = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "UHCP")); record.Uusr = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "UUSR")); record.Cdat = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "CDAT")); record.Ctim = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "CTIM")); record.Modu = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "MODU")); record.Ccs_epid = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "CCS_EPID")); record.Actind = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "ACTIND")); record.Tstp = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "TSTP")); record.Session_id = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "SESSION_ID")); record.Sessiond_id = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "SESSIOND_ID")); for (int i = 0; i < valueItems.length; i++) if (Connection.getAttributeName(valueItems[i]).toLowerCase().equals("seqno")) record.SeqnoCollection.add(); rgCount = record.SeqnoCollection.count(); if (rgCount > 0) { recCount = 0; for (int i = 0; i < valueItems.length; i++) { if (Connection.getAttributeName(valueItems[i]).toLowerCase().equals("seqno")) { Go_mdt_hcpsSeqnoRecord rgRecord = record.SeqnoCollection.get(recCount); rgRecord.Seqno = Connection.getAttributeValue(valueItems[i]); recCount++; } if (rgCount == recCount) break; } recCount = 0; for (int i = 0; i < valueItems.length; i++) { if (Connection.getAttributeName(valueItems[i]).toLowerCase().equals("attattended")) { Go_mdt_hcpsSeqnoRecord rgRecord = record.SeqnoCollection.get(recCount); rgRecord.Attattended = Connection.getAttributeValue(valueItems[i]); recCount++; } if (rgCount == recCount) break; } recCount = 0; for (int i = 0; i < valueItems.length; i++) { if (Connection.getAttributeName(valueItems[i]).toLowerCase().equals("attdeclined")) { Go_mdt_hcpsSeqnoRecord rgRecord = record.SeqnoCollection.get(recCount); rgRecord.Attdeclined = Connection.getAttributeValue(valueItems[i]); recCount++; } if (rgCount == recCount) break; } recCount = 0; for (int i = 0; i < valueItems.length; i++) { if (Connection.getAttributeName(valueItems[i]).toLowerCase().equals("attconfirmed")) { Go_mdt_hcpsSeqnoRecord rgRecord = record.SeqnoCollection.get(recCount); rgRecord.Attconfirmed = Connection.getAttributeValue(valueItems[i]); recCount++; } if (rgCount == recCount) break; } recCount = 0; for (int i = 0; i < valueItems.length; i++) { if (Connection.getAttributeName(valueItems[i]).toLowerCase().equals("methodinformed")) { Go_mdt_hcpsSeqnoRecord rgRecord = record.SeqnoCollection.get(recCount); rgRecord.Methodinformed = Connection.getAttributeValue(valueItems[i]); recCount++; } if (rgCount == recCount) break; } recCount = 0; for (int i = 0; i < valueItems.length; i++) { if (Connection.getAttributeName(valueItems[i]).toLowerCase().equals("dateinformed")) { Go_mdt_hcpsSeqnoRecord rgRecord = record.SeqnoCollection.get(recCount); rgRecord.Dateinformed = Connection.getAttributeValue(valueItems[i]); recCount++; } if (rgCount == recCount) break; } recCount = 0; for (int i = 0; i < valueItems.length; i++) { if (Connection.getAttributeName(valueItems[i]).toLowerCase().equals("hcp_txt")) { Go_mdt_hcpsSeqnoRecord rgRecord = record.SeqnoCollection.get(recCount); rgRecord.Hcp_txt = Connection.getAttributeValue(valueItems[i]); recCount++; } if (rgCount == recCount) break; } recCount = 0; for (int i = 0; i < valueItems.length; i++) { if (Connection.getAttributeName(valueItems[i]).toLowerCase().equals("hcp_id")) { Go_mdt_hcpsSeqnoRecord rgRecord = record.SeqnoCollection.get(recCount); rgRecord.Hcp_id = Connection.getAttributeValue(valueItems[i]); recCount++; } if (rgCount == recCount) break; } recCount = 0; for (int i = 0; i < valueItems.length; i++) { if (Connection.getAttributeName(valueItems[i]).toLowerCase().equals("ct_ext_flag")) { Go_mdt_hcpsSeqnoRecord rgRecord = record.SeqnoCollection.get(recCount); rgRecord.Ct_ext_flag = Connection.getAttributeValue(valueItems[i]); recCount++; } if (rgCount == recCount) break; } } DataCollection.add(record); } return records; }
private int decodeNASMessage() { String[] items = Connection.getResponseItems(Connection.getValueAt(6)); if (items == null) return 0; int records = items.length; if (records == 0) return 0; for (int x = 0; x < records; x++) { Go_mdt_hcpsRecord record = new Go_mdt_hcpsRecord(); String[] valueItems = Connection.splitResponseItem(items[x]); record.Go_mdt_hcps_id = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "GO_MDT_HCPS_ID")); record.Pkey = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "PKEY")); record.Rdat = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "RDAT")); record.Rtim = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "RTIM")); record.Rhcp = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "RHCP")); record.Rusr = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "RUSR")); record.Udat = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "UDAT")); record.Utim = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "UTIM")); record.Uhcp = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "UHCP")); record.Uusr = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "UUSR")); record.Cdat = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "CDAT")); record.Ctim = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "CTIM")); record.Modu = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "MODU")); record.Ccs_epid = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "CCS_EPID")); record.Actind = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "ACTIND")); record.Tstp = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "TSTP")); record.Session_id = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "SESSION_ID")); record.Sessiond_id = Connection.decodeFieldValue(Connection.getValueFor(valueItems, "SESSIOND_ID")); DataCollection.add(record); } return records; }
private String encodeNASMessage() { String dataString = ""; if (DataCollection.count() == 0) return dataString; Go_mdt_hcpsRecord data = (Go_mdt_hcpsRecord) DataCollection.get(0); if (EditFilter.IncludeGo_mdt_hcps_id) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "GO_MDT_HCPS_ID" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Go_mdt_hcps_id); } if (EditFilter.IncludePkey) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "PKEY" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Pkey); } if (EditFilter.IncludeRdat) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "RDAT" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Rdat); } if (EditFilter.IncludeRtim) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "RTIM" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Rtim); } if (EditFilter.IncludeRhcp) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "RHCP" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Rhcp); } if (EditFilter.IncludeRusr) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "RUSR" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Rusr); } if (EditFilter.IncludeUdat) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "UDAT" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Udat); } if (EditFilter.IncludeUtim) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "UTIM" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Utim); } if (EditFilter.IncludeUhcp) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "UHCP" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Uhcp); } if (EditFilter.IncludeUusr) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "UUSR" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Uusr); } if (EditFilter.IncludeCdat) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "CDAT" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Cdat); } if (EditFilter.IncludeCtim) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "CTIM" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Ctim); } if (EditFilter.IncludeModu) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "MODU" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Modu); } if (EditFilter.IncludeCcs_epid) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "CCS_EPID" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Ccs_epid); } if (EditFilter.IncludeActind) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "ACTIND" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Actind); } if (EditFilter.IncludeTstp) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "TSTP" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Tstp); } if (EditFilter.IncludeSession_id) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "SESSION_ID" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Session_id); } if (EditFilter.IncludeSessiond_id) { if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "SESSIOND_ID" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(data.Sessiond_id); } for (int x = 0; x < data.SeqnoCollection.count(); x++) { Go_mdt_hcpsSeqnoRecord rgRecord = (Go_mdt_hcpsSeqnoRecord) data.SeqnoCollection.get(x); if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "SEQNO" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(rgRecord.Seqno); if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "ATTATTENDED" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(rgRecord.Attattended); if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "ATTDECLINED" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(rgRecord.Attdeclined); if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "ATTCONFIRMED" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(rgRecord.Attconfirmed); if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "METHODINFORMED" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(rgRecord.Methodinformed); if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "DATEINFORMED" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(rgRecord.Dateinformed); if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "HCP_TXT" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(rgRecord.Hcp_txt); if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "HCP_ID" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(rgRecord.Hcp_id); if (dataString.length() > 0) dataString += ims.dto.NASMessageCodes.PAIRSEPARATOR; dataString += "CT_EXT_FLAG" + ims.dto.NASMessageCodes.ATTRIBUTEVALUESEPARATOR + Connection.encodeFieldValue(rgRecord.Ct_ext_flag); } return dataString; }