| 1 package org.campware.cream.modules.actions; 2 3 42 43 import java.util.Date ; 44 import java.text.SimpleDateFormat ; 45 import java.text.ParsePosition ; 46 import org.apache.velocity.context.Context; 47 48 import org.apache.turbine.modules.actions.VelocitySecureAction; 49 import org.apache.turbine.util.RunData; 50 import org.apache.turbine.util.security.AccessControlList; 51 import org.apache.turbine.Turbine; 52 53 60 public class CreamPublicAction extends VelocitySecureAction 61 { 62 public static final int ENTITY=1001; 63 public static final int DOCUMENT=1002; 64 public static final int LOOKUP=1003; 65 public static final int SYSTEM=1004; 66 public static final int REPORT=1005; 67 public static final int UTIL=1006; 68 69 private int defModuleType; 70 private String defModuleName=new String (); 71 72 protected void initScreen() 73 { 74 } 75 76 83 public void doPerform( RunData data,Context context ) 84 throws Exception  85 { 86 data.setMessage("Can't find the button!"); 87 } 88 89 98 protected boolean isAuthorized( RunData data ) throws Exception  99 { 100 initScreen(); 101 return true; 102 } 103 104 protected Date parseDateTime(String d) 105 throws Exception  106 { 107 SimpleDateFormat formatter = new SimpleDateFormat ("dd.MM.yyyy hh:mm:ss"); 109 ParsePosition pos = new ParsePosition (0); 110 return formatter.parse(d, pos); 111 } 112 113 protected Date parseDate(String d) 114 throws Exception  115 { 116 SimpleDateFormat formatter = new SimpleDateFormat ("dd.MM.yyyy"); 118 ParsePosition pos = new ParsePosition (0); 119 try{ 120 Date myDate= formatter.parse(d, pos); 121 return myDate; 122 } 123 catch (Exception e) 124 { 125 return null; 126 } 127 128 } 129 130 protected String formatDate(Date d) 131 { 132 SimpleDateFormat formatter = new SimpleDateFormat ("dd.MM.yyyy"); 133 return formatter.format(d); 134 } 135 136 137 protected String getTempCode() 138 { 139 Date currDate= new Date (); 140 141 return Integer.toString(currDate.hashCode()); 142 } 143 144 protected String getRowCode(String s, int i) 145 { 146 String is= new String (); 147 148 is= Integer.toString(i); 149 while (is.length()<7) 150 { 151 is="0" + is; 152 } 153 154 is= s + is; 155 return is; 156 } 157 158 protected void setModuleName(String name) 159 { 160 defModuleName=name; 161 } 162 163 protected void setModuleType(int modtype) 164 { 165 defModuleType=modtype; 166 } 167 168 169 } 170 | Popular Tags |