private String buildRequest(ECommerceUpdate oneUpdate) { StringBuffer requestBuf = new StringBuffer(); String timeNow = getTimeStampString(); String username = oneUpdate.getUsername(); String actionDate = oneUpdate.getActionDate(); // requestBuf.append("?"); requestBuf.append("service=Rcopia&action=updateBAA&"); requestBuf.append("practice_username="******"&"); requestBuf.append("sign_date="); requestBuf.append(actionDate); requestBuf.append("&time="); requestBuf.append(timeNow); return requestBuf.toString(); }
private void recordStatus(ECommerceUpdate thisUpdate, String status) { StringBuffer sqlBuf = new StringBuffer(); String sqlRecord = ""; String statusFlag = ""; String resultCode = ""; String resultMsg = ""; if (status != null && status.length() > 0) { status = status.toLowerCase(); int codeStart = -1; try { codeStart = status.indexOf(RESULT_CODE_PREFIX.toLowerCase()) + RESULT_CODE_PREFIX.length(); System.out.println("codeStart = " + codeStart); } catch (Exception any) { any.printStackTrace(); } if (codeStart >= RESULT_CODE_PREFIX.length()) { int msgPrefixStart = status.indexOf(RESULT_MESSAGE_PREFIX.toLowerCase()); System.out.println("msgPrefixStart = " + msgPrefixStart); if (msgPrefixStart > 0) { resultCode = status.substring(codeStart, codeStart + 3).trim(); System.out.println("resultCode = " + resultCode); resultMsg = status.substring(msgPrefixStart + RESULT_MESSAGE_PREFIX.length()).trim(); System.out.println("resultMsg = " + resultMsg); } else { System.out.println("status=============" + status); System.out.println("codeStart=============" + codeStart); System.out.println("status length=============" + status.length()); resultCode = status.substring(codeStart, 10); } } if (resultCode != null && resultCode.equalsIgnoreCase(RESULT_CODE_SUCCESS)) { statusFlag = STATUS_FLAG_SUCCESS; resultMsg = ""; } else if (resultCode != null && resultCode.equalsIgnoreCase(RESULT_CODE_ERROR)) { statusFlag = STATUS_FLAG_ERROR; } else { statusFlag = STATUS_FLAG_PENDING; resultMsg = status; } if (resultMsg != null) { int msgLength = resultMsg.length(); if (msgLength > 200) resultMsg = resultMsg.substring(0, 200); } else { resultMsg = ""; } sqlBuf.append("UPDATE ecommerce_pending SET "); sqlBuf.append("status = "); sqlBuf.append(StringFunctions.quoteSQLQuote(statusFlag)); sqlBuf.append(", message = "); sqlBuf.append(StringFunctions.quoteSQLQuote(resultMsg)); sqlBuf.append(", last_send_date = SYSDATE"); if (statusFlag == STATUS_FLAG_SUCCESS) sqlBuf.append(", accepted_by_ecommerce_date = SYSDATE"); sqlBuf.append(", lastupdatedate = SYSDATE"); sqlBuf.append(" WHERE pending_item_id = "); sqlBuf.append(thisUpdate.getPendingItemID().toString()); System.out.println(sqlBuf.toString()); try { int dbStatus = m_DataQuery.executeUpdate(sqlBuf.toString(), connectionID); System.out.println("recordStatus, dbStatus is: " + dbStatus); if (dbStatus <= 0) // Need logging! System.out.println("Error updating database in recordStatus: " + dbStatus); } catch (RemoteException e) { e.printStackTrace(System.err); ErrorSender.notifySupport(this, "RemsUpdater.recordStatus", "RemoteException", e); } } }
private String buildPracticeRegistrationRequest(ECommerceUpdate oneUpdate) { StringBuffer requestBuf = new StringBuffer(); String timeNow = getTimeStampString(); int pendingItemID = oneUpdate.getPendingItemID().intValue(); MemberDBBean dbBean = new MemberDBBean(getClass().getName()); Member contact = null; PracticeGroup practice = null; String ToBeDetermined = null; Vector aff = new Vector(); try { practice = dbBean.retrievePracticeRegistration(pendingItemID); aff = dbBean.getPracticeActiveAffiliations(practice.getPracticeID()); contact = practice.getContact(); } catch (Exception e) { e.printStackTrace(); } String aff_type = "MC"; String contract_username = ""; java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("MMddyy"); String start_date = ""; String end_date = ""; String aff_rec_id = ""; if (aff != null && !aff.isEmpty()) { int asize = aff.size(); for (int x = 0; x < asize; x++) { UserAffiliation vv = (UserAffiliation) aff.elementAt(x); if (aff_type.equals(vv.getAffiliationType())) { if (vv.getStartDate() != null) start_date = df.format(vv.getStartDate()); if (vv.getEndDate() != null) end_date = df.format(vv.getEndDate()); aff_rec_id = "" + vv.getID(); if (vv.getPrefix() != null && !vv.getPrefix().equals("")) aff_rec_id = vv.getPrefix() + "-" + aff_rec_id; User user = dbBean.retrieveUser((long) vv.getAffiliationID()); contract_username = user.getUserName(); break; } } } if (practice.getPracticeID() > 0) { requestBuf.append("service=Rcopia&action=register_practice"); requestBuf.append("&drwebid="); requestBuf.append(practice.getPracticeID()); requestBuf.append("&username="******"&password=dGVzdDEyMzQ%3D"); // requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPassword()))); requestBuf.append("&prefix="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrefix()))); requestBuf.append("&firstName="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getFirstName()))); requestBuf.append("&lastName="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getLastName()))); requestBuf.append("&email="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getEmail()))); requestBuf.append("&memberType="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getMemberType()))); requestBuf.append("&spec1_desc="); requestBuf.append( StringFunctions.urlEncoded( StringFunctions.objectToString(practice.getPrimarySpecialty()))); requestBuf.append("&practicename="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getPracticeName()))); requestBuf.append("&officeName="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getOfficeName()))); requestBuf.append("&address1="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrimaryAddress1()))); requestBuf.append("&address2="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrimaryAddress2()))); requestBuf.append("&city="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrimaryCity()))); requestBuf.append("&state="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrimaryState()))); requestBuf.append("&zip="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrimaryZip()))); requestBuf.append("&country=US"); requestBuf.append("&PhoneAreaCode1="); requestBuf.append( StringFunctions.urlEncoded( StringFunctions.objectToString(contact.getPrimaryPhoneAreaCode()))); requestBuf.append("&PhonePrefix1="); requestBuf.append( StringFunctions.urlEncoded( StringFunctions.objectToString(contact.getPrimaryPhonePrefix()))); requestBuf.append("&PhoneSuffix1="); requestBuf.append( StringFunctions.urlEncoded( StringFunctions.objectToString(contact.getPrimaryPhoneSuffix()))); requestBuf.append("&PhoneExtension1="); requestBuf.append( StringFunctions.urlEncoded( StringFunctions.objectToString(contact.getPrimaryPhoneExtension()))); requestBuf.append("&FaxAreaCode1="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getFaxAreaCode()))); requestBuf.append("&FaxPrefix1="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getFaxPrefix()))); requestBuf.append("&FaxSuffix1="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getFaxSuffix()))); requestBuf.append("®istered_by="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getRegisteredBy()))); requestBuf.append("&created_date="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getCreatedDate()))); requestBuf.append("&practiceManagementSystem="); requestBuf.append( StringFunctions.urlEncoded( StringFunctions.objectToString(practice.getPracticeManagementSystem()))); requestBuf.append("&user_affiliation_id="); requestBuf.append(aff_rec_id); requestBuf.append("&start_date="); requestBuf.append(StringFunctions.objectToString(start_date)); requestBuf.append("&end_date="); requestBuf.append(StringFunctions.objectToString(end_date)); requestBuf.append("&contract_username="******"&assigned_region="); requestBuf.append( StringFunctions.urlEncoded( StringFunctions.objectToString(practice.getAssignedRegionName()))); System.out.println( "practice assigned Region name========" + practice.getAssignedRegionName()); requestBuf.append("&time="); requestBuf.append(getTimeStampString()); } return requestBuf.toString(); }
private String buildUserRequest(ECommerceUpdate oneUpdate) { StringBuffer requestBuf = new StringBuffer(); String timeNow = getTimeStampString(); String username = oneUpdate.getUsername(); String actionDate = oneUpdate.getActionDate(); MemberDBBean dbBean = new MemberDBBean(getClass().getName()); Long user_id = new Long(0); Long practice_id = new Long(0); Member member = new Member(); Vector dates = new Vector(); String practice_username = ""; try { user_id = dbBean.getDrWebId(username); practice_id = dbBean.getPracticeId(user_id); practice_username = dbBean.getUsername(practice_id); member = dbBean.retrieveURSMember(user_id, practice_id); dates = dbBean.retrieveRxDates(user_id); } catch (Exception e) { e.printStackTrace(); } System.out.println("username=========" + username); System.out.println("user_id=========" + user_id); System.out.println("practice_id=========" + practice_id); System.out.println("practice_username=========" + practice_username); if (practice_id == 0) throw new IllegalArgumentException("No practice is associated."); if (user_id > 0 && practice_id > 0 && member.getMemberID() > 0) { requestBuf.append("service=Rcopia&action=updateUser"); requestBuf.append("&time="); requestBuf.append(timeNow); requestBuf.append("&practice_username="******"&user_username="******"&drwebid="); requestBuf.append(member.getMemberID()); requestBuf.append("&firstName="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getFirstName()))); requestBuf.append("&lastName="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getLastName()))); requestBuf.append("&middleInitial="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getMiddleName()))); requestBuf.append("&suffix="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getSuffix()))); requestBuf.append("&memberType="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getMemberType()))); requestBuf.append("&status="); String aflag = StringFunctions.objectToString(member.getActiveFlag()); String rflag = StringFunctions.objectToString(member.getEPS()); if (aflag.equals("A")) { if (rflag.equals("D") || rflag.equals("X") || rflag.equals("V") || rflag.equals("I")) aflag = rflag; else if (rflag.equals("R") || rflag.equals("NM")) aflag = "I"; } else if (!aflag.equals("A") && !aflag.equals("I") && !aflag.equals("D") && !aflag.equals("X")) aflag = "O"; requestBuf.append(StringFunctions.urlEncoded(aflag)); Vector disableInfo = new Vector(); if (aflag.equals("D")) { try { disableInfo = dbBean.getLastDisabledInformation(new Long(user_id)); } catch (Exception e) { e.printStackTrace(); } } requestBuf.append("&disabled_by="); if (disableInfo != null && !disableInfo.isEmpty()) { requestBuf.append(StringFunctions.objectToString(disableInfo.elementAt(1))); } requestBuf.append("&disabled_reason="); if (disableInfo != null && !disableInfo.isEmpty()) { requestBuf.append(StringFunctions.objectToString(disableInfo.elementAt(2))); } requestBuf.append("&disable_date="); if (disableInfo != null && !disableInfo.isEmpty()) { requestBuf.append(StringFunctions.objectToString(disableInfo.elementAt(4))); } requestBuf.append("&isTest="); if (member.getIsTest() != null && !member.getIsTest().equals("")) requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getIsTest()))); else requestBuf.append("n"); requestBuf.append("&isProvider="); String m = member.getMemberType(); if (m != null && !m.equals("M") && !m.equals("NP") && !m.equals("PA") && !m.equals("D")) requestBuf.append("n"); else requestBuf.append("y"); requestBuf.append("&dea="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getDEA()))); requestBuf.append("&spec1_desc="); if (member.getPrimarySpecialty() != null) requestBuf.append( StringFunctions.urlEncoded( StringFunctions.objectToString(member.getPrimarySpecialty()))); requestBuf.append("&practice_drwebid="); requestBuf.append(practice_id); Vector groups = member.getGroups(); String groupIds = ""; String groupNames = ""; if (groups != null && !groups.isEmpty()) { int s = groups.size(); for (int y = 0; y < s; y++) { PracticeGroup pg = (PracticeGroup) groups.elementAt(y); groupIds += pg.getGroupID(); groupNames += pg.getGroupName(); if (y > 0) { groupIds += "|"; groupNames += "|"; } } } requestBuf.append("&groupID="); requestBuf.append(groupIds); requestBuf.append("&groupName="); requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(groupNames))); requestBuf.append("&officeName="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getOfficeName()))); requestBuf.append("&address1="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryAddress1()))); requestBuf.append("&address2="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryAddress2()))); requestBuf.append("&city="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryCity()))); requestBuf.append("&state="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryState()))); requestBuf.append("&zip="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryZip()))); requestBuf.append("&phoneNumber="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryPhone()))); requestBuf.append("&faxNumber="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryFax()))); requestBuf.append("&email="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getEmail()))); Vector affils = member.getAffiliations(); String sponsor = ""; String sales = ""; String acct_manager = ""; String deploy_manager = ""; String ipa = ""; if (affils != null && !affils.isEmpty()) { int si = affils.size(); for (int t = 0; t < si; t++) { UserAffiliation ua = (UserAffiliation) affils.elementAt(t); if (ua.getAffiliationType().equals("SP")) sponsor = ua.getAffiliationName(); else if (ua.getAffiliationType().equals("SA")) sales = ua.getAffiliationName(); if (ua.getAffiliationType().equals("AM")) acct_manager = ua.getAffiliationName(); if (ua.getAffiliationType().equals("DM")) deploy_manager = ua.getAffiliationName(); if (ua.getAffiliationType().equals("IPA")) ipa = ua.getAffiliationName(); } } requestBuf.append("&ipa="); requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(ipa))); requestBuf.append("&sponsor="); requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(sponsor))); requestBuf.append("&salesrep="); requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(sales))); requestBuf.append("&accountManager="); requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(acct_manager))); requestBuf.append("&deploymentManager="); requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(deploy_manager))); if (dates != null && !dates.isEmpty()) { Vector d = (Vector) dates.elementAt(0); requestBuf.append("&rx1Date="); requestBuf.append(StringFunctions.objectToString(d.elementAt(0))); requestBuf.append("&rx5Date="); requestBuf.append(StringFunctions.objectToString(d.elementAt(1))); requestBuf.append("&rx50Date="); requestBuf.append(StringFunctions.objectToString(d.elementAt(2))); requestBuf.append("&rx200Date="); requestBuf.append(StringFunctions.objectToString(d.elementAt(3))); requestBuf.append("&last_script_date="); requestBuf.append(StringFunctions.objectToString(d.elementAt(4))); requestBuf.append("&last_pda_activity_date="); requestBuf.append(StringFunctions.objectToString(d.elementAt(5))); requestBuf.append("&total_scripts="); requestBuf.append(StringFunctions.objectToString(d.elementAt(6))); requestBuf.append("&last_login_date="); requestBuf.append(StringFunctions.objectToString(d.elementAt(7))); } else { requestBuf.append("&rx1Date="); requestBuf.append("&rx5Date="); requestBuf.append("&rx50Date="); requestBuf.append("&rx200Date="); requestBuf.append("&last_script_date="); requestBuf.append("&last_pda_activity_date="); requestBuf.append("&total_scripts="); requestBuf.append("&last_login_date="); } } return requestBuf.toString(); }
private String buildUserRegistrationRequest(ECommerceUpdate oneUpdate) { StringBuffer requestBuf = new StringBuffer(); String timeNow = getTimeStampString(); int pendingItemID = oneUpdate.getPendingItemID().intValue(); MemberDBBean dbBean = new MemberDBBean(getClass().getName()); Member member = null; PracticeGroup practice = null; try { member = dbBean.retrieveUserRegistration(pendingItemID); practice = member.getPractice(); } catch (Exception e) { e.printStackTrace(); } if (member.getMemberID() > 0) { requestBuf.append("service=Order&action=registerUser"); requestBuf.append("&drwebid="); requestBuf.append(member.getMemberID()); requestBuf.append("&username="******"&password="******"&firstName="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getFirstName()))); requestBuf.append("&lastName="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getLastName()))); requestBuf.append("&email="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getEmail()))); requestBuf.append("&memberTypeSelectBox="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getMemberType()))); requestBuf.append("&practicename"); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getPracticeName()))); requestBuf.append("&address1="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryAddress1()))); requestBuf.append("&address2="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryAddress2()))); requestBuf.append("&city="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryCity()))); requestBuf.append("&state="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryState()))); requestBuf.append("&zip="); requestBuf.append( StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryZip()))); requestBuf.append("&PhoneAreaCode1="); requestBuf.append(member.getPrimaryPhone().substring(1, 3)); requestBuf.append("&PhonePrefix1="); requestBuf.append(member.getPrimaryPhone().substring(6, 8)); requestBuf.append("&PhoneSuffix1="); requestBuf.append(member.getPrimaryPhone().substring(10, 13)); requestBuf.append("&time="); requestBuf.append(getTimeStampString()); } return requestBuf.toString(); }