1 package projectmanagement.presentation.payrates; 2 3 import projectmanagement.presentation.*; 4 import projectmanagement.spec.timewage.*; 5 import projectmanagement.spec.project.*; 6 7 import com.lutris.appserver.server.httpPresentation.*; 8 import org.enhydra.xml.xmlc.XMLObject; 9 10 import org.w3c.dom.*; 11 import org.w3c.dom.html.*; 12 13 19 public class Administering extends BasePO { 20 21 24 private static String EMPLOYEE = "employee"; 25 private static String PROJECT = "project"; 26 27 28 31 protected int getRequiredAuthLevel() { 32 return 2; 33 } 34 35 38 public XMLObject handleDefault() 39 throws HttpPresentationException { 40 41 AdministeringHTML page = new AdministeringHTML(); 42 try { 43 String employee = this.getComms().request.getParameter(EMPLOYEE); 44 if (employee!=null && employee.length()==0) { 45 employee=null; 46 } 47 String project = this.getComms().request.getParameter(PROJECT); 48 if (project!=null && project.length()==0) { 49 project=null; 50 } 51 52 String errorMsg = this.getSessionData().getAndClearUserMessage(); 53 58 59 PayRateManager payRateManager = PayRateManagerFactory. 60 getPayRateManager("projectmanagement.business.timewage.PayRateManagerImpl"); 61 PayRate[] payRates=payRateManager.getAllPayRatesForEmployeeProjectPair(employee,project); 62 63 HTMLTableElement table = page.getElementTblPayRates(); 65 66 if (payRates!=null) { 67 for (int i=0; i<payRates.length; i++) { 68 HTMLTableRowElement htmlRE=createNewRow(page,payRates[i]); 70 table.appendChild(htmlRE); 72 } 73 } 74 75 table.removeChild(page.getElementTemplateRow()); 77 78 82 } catch(NullPointerException ex) { 83 84 } catch(Exception ex) { 85 this.writeDebugMsg("Error populating list of pay rates: " + ex); 86 throw new ProjectManagementPresentationException("Error getting list of pay rates: ", ex); 87 } 88 89 90 return page; 92 } 93 94 97 private HTMLTableRowElement createNewRow(AdministeringHTML administeringHTML, 98 PayRate payRate) { 99 100 String payRateID=""; 101 102 try { 103 payRateID=payRate.getHandle(); 104 administeringHTML.setTextTxtEmployee(payRate.getEmployee().getFirstName()+" "+ 105 payRate.getEmployee().getLastName()); 106 administeringHTML.setTextTxtProject(payRate.getProject().getName()); 107 administeringHTML.setTextTxtPayRate(String.valueOf(payRate.getRate())); 108 administeringHTML.setTextTxtValidFrom(payRate.getValidFrom().toString()); 109 } catch (Exception ex) {} 110 111 HTMLImageElement detailsImg=administeringHTML.getElementImgDetails(); 113 detailsImg.setName(payRateID); 114 115 HTMLImageElement modifyImg=administeringHTML.getElementImgModify(); 117 modifyImg.setName(payRateID); 118 119 HTMLImageElement deleteImg=administeringHTML.getElementImgDelete(); 121 deleteImg.setName(payRateID); 122 123 HTMLTableRowElement row=(HTMLTableRowElement)administeringHTML. 124 getElementTemplateRow().cloneNode(true); 125 126 return row; 127 } 128 129 } 130 131 | Popular Tags |