1 5 6 package com.raptus.owxv3.api; 7 8 import java.text.*; 9 import java.util.Locale ; 10 11 import com.raptus.owxv3.*; 12 13 35 public class BusinessObject extends Object 36 { 37 40 protected VModule vmodule = null; 41 42 45 protected Locale locale = null; 46 47 50 protected BusinessObject() 51 { 52 } 53 54 57 public BusinessObject(VModule vm, Locale lcle) 58 { 59 this.vmodule = vm; 60 this.locale = lcle; 61 } 62 63 66 public String getLocaleFormattedDate(java.util.Date dte) 67 { 68 if(dte == null) 69 return null; 70 71 DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale); 72 return df.format(dte); 73 } 74 75 78 public String getLocaleFormattedTime(java.util.Date time) 79 { 80 if(time == null) 81 return null; 82 83 DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT, locale); 84 return df.format(time); 85 } 86 87 90 public java.util.Date getDateFromStrings(String dateValue, String timeValue) 91 { 92 java.util.Date dval = null; 93 94 if(dateValue != null && dateValue.length() > 0) 95 { 96 if(timeValue == null) 97 timeValue = getLocaleFormattedTime(new java.util.Date ()); 98 99 String dt = dateValue + " " + timeValue; 100 DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, 101 DateFormat.SHORT, locale); 102 try 103 { 104 dval = df.parse(dt); 105 } 106 catch(ParseException e) { 107 LoggingManager.log("ParseException while trying to convert. " + e.getMessage(), this); 108 return dval; 109 } 110 } 111 112 return dval; 113 } 114 115 118 public static boolean isEmpty(String str) 119 { 120 return (str != null && str.length() > 0); 121 } 122 } 123 124 125 | Popular Tags |