1 19 20 package com.lutris.airsent.presentation.messenger; 21 22 import com.lutris.appserver.server.httpPresentation.*; 23 import com.lutris.appserver.server.session.*; 24 import com.lutris.util.*; 25 import org.enhydra.xml.xmlc.XMLCUtil; 27 import org.enhydra.xml.xmlc.XMLObject; 28 import org.w3c.dom.*; 29 import java.util.Date ; 30 import com.lutris.airsent.presentation.AirSentPresentationException; 31 import com.lutris.airsent.presentation.AirSentConstants; 32 import com.lutris.airsent.presentation.DeviceBasePO; 33 import com.lutris.airsent.spec.delivery.Delivery; 34 import com.lutris.airsent.presentation.DeviceUtils; 35 import java.lang.reflect.Method ; 36 37 41 public class Details extends DeviceBasePO { 42 43 46 private static final int AUTH_LEVEL = AirSentConstants.UNAUTH_USER; 47 48 54 public int getRequiredAuthLevel() { 55 return AUTH_LEVEL; 56 } 57 58 64 public XMLObject handleDefault() throws HttpPresentationException { 65 return showPage(null); 66 } 67 68 75 public XMLObject showPage(String errorMsg) 76 throws HttpPresentationException { 77 78 Class tempClass=null; 79 Object page= null; 80 Method setTextErrorText = null; 81 Method setTextName = null; 82 Method setTextAddress = null; 83 Method setTextDirections = null; 84 Method getTagComplete = null; 85 86 try{ 87 Class stringClass=Class.forName("java.lang.String"); 88 tempClass = Class.forName(DeviceUtils.getPageName(myComms, "com.lutris.airsent.presentation.messenger.Details")); 89 page= myComms.xmlcFactory.create(tempClass); 90 Class [] argTypeArr={stringClass}; 91 setTextErrorText= tempClass.getMethod("setTextErrorText",argTypeArr); 92 setTextName= tempClass.getMethod("setTextName",argTypeArr); 93 setTextAddress= tempClass.getMethod("setTextAddress",argTypeArr); 94 setTextDirections= tempClass.getMethod("setTextDirections",argTypeArr); 95 getTagComplete = tempClass.getMethod("getElementComplete",null); 96 }catch(Exception e){} 97 98 try{ 101 if (null != errorMsg 102 || null 103 != (errorMsg = 104 this.getSessionData().getAndClearUserMessage())) { 105 Object [] temp={errorMsg}; 106 setTextErrorText.invoke(page,temp); 107 109 return ((XMLObject)page); 110 } else { 111 Object [] temp={""}; 112 setTextErrorText.invoke(page,temp); 113 } 115 }catch(Exception e){} 116 String pageSelection = 117 myComms.request.getParameter(AirSentConstants.SELECTION_NAME); 118 String deliveryID = 119 myComms.request.getParameter(AirSentConstants.DELIVERYID); 120 String name = null; 121 String address = null; 122 String directions = null; 123 Delivery delivery = null; 124 125 try { 126 if ((delivery = 127 getApplication().getHomeManager().getDeliveryManager().findByHandle(deliveryID)) 128 == null) { 129 return showPage("Could not find delivery"); 130 } 131 132 if (pageSelection == null) { 133 return showPage("Error in pickup or delivery"); 134 } 135 136 if (pageSelection.equals(AirSentConstants.PICKUP)) { 137 name = delivery.getPickUp().getName(); 138 address = delivery.getPickUp().getStreet1(); 139 directions = delivery.getPickUp().getDirections(); 140 } else { 141 name = delivery.getDropOff().getName(); 142 address = delivery.getDropOff().getStreet1(); 143 directions = delivery.getDropOff().getDirections(); 144 } 145 Object [] temp1={name}; 146 setTextName.invoke(page,temp1); 147 Object [] temp2={address}; 149 setTextAddress.invoke(page,temp2); 150 Object [] temp3={directions}; 152 setTextDirections.invoke(page,temp3); 153 ((Element)getTagComplete.invoke(page,null)).getAttributeNode("href").setValue(AirSentConstants.DISPLAY_PO 156 + "?event=complete" + "&" 157 + "deliveryID=" 158 + delivery.getHandle() 159 + "&" 160 + AirSentConstants.SELECTION_NAME 161 + "=" + pageSelection); 162 163 } catch (Exception e) { 164 throw new AirSentPresentationException("System error showing page", e); 165 } 166 DeviceUtils.setURLTimeStamp((XMLObject)page); 167 return ((XMLObject)page); 168 } 169 170 } 171 172 173 174 | Popular Tags |