1 14 package org.compiere.model; 15 16 import java.util.*; 17 import java.sql.*; 18 19 import org.compiere.util.*; 20 21 27 public class MRequest extends X_R_Request 28 { 29 34 public MRequest(Properties ctx, int R_Request_ID) 35 { 36 super (ctx, R_Request_ID); 37 if (R_Request_ID == 0) 38 { 39 setDueType (DUETYPE_Due); 40 setProcessed (false); 43 setRequestAmt (Env.ZERO); 44 setPriority (PRIORITY_Medium); 45 setIsEscalated (false); 48 setIsSelfService (false); 49 } 50 } 52 60 public MRequest(Properties ctx, int SalesRep_ID, 61 int R_RequestType_ID, String Summary, boolean isSelfService) 62 { 63 this(ctx, 0); 64 setSalesRep_ID (SalesRep_ID); 65 setR_RequestType_ID (R_RequestType_ID); 66 setSummary (Summary); 67 setIsSelfService(isSelfService); 68 } 70 71 76 public MRequest (Properties ctx, ResultSet rs) 77 { 78 super (ctx, rs); 79 } 81 82 private Integer m_R_RequestType_ID; 83 84 85 86 90 public void setR_RequestType_ID (int R_RequestType_ID) 91 { 92 if (R_RequestType_ID == 0) 93 { 94 if (m_R_RequestType_ID != null) 95 { 96 R_RequestType_ID = m_R_RequestType_ID.intValue(); 97 } 98 else 99 { 100 String sql = "SELECT R_RequestType_ID FROM R_RequestType ORDER BY IsDefault DESC"; 101 PreparedStatement pstmt = null; 102 try 103 { 104 pstmt = DB.prepareStatement (sql); 105 ResultSet rs = pstmt.executeQuery (); 106 if (rs.next ()) 107 { 108 R_RequestType_ID = rs.getInt (1); 109 m_R_RequestType_ID = new Integer (R_RequestType_ID); 110 } 111 else 112 log.error ("setR_RequestType_ID - No default found"); 113 rs.close (); 114 pstmt.close (); 115 pstmt = null; 116 } 117 catch (SQLException ex) 118 { 119 log.error ("setR_RequestType_ID", ex); 120 } 121 try 122 { 123 if (pstmt != null) 124 pstmt.close (); 125 } 126 catch (SQLException ex1) 127 { 128 } 129 pstmt = null; 130 } 131 } 132 super.setR_RequestType_ID(R_RequestType_ID); 133 } 135 139 public void setSummary(String Summary) 140 { 141 if (Summary != null) 142 { 143 if (Summary.length() < 2000) 144 super.setSummary (Summary); 145 else 146 super.setSummary (Summary.substring (0, 1999)); 147 } 148 } 150 } | Popular Tags |