1 24 package javax.jcr.version; 25 26 189 public final class OnParentVersionAction { 190 191 194 public static final int COPY = 1; 195 public static final int VERSION = 2; 196 public static final int INITIALIZE = 3; 197 public static final int COMPUTE = 4; 198 public static final int IGNORE = 5; 199 public static final int ABORT = 6; 200 201 205 public static final String ACTIONNAME_COPY = "COPY"; 206 public static final String ACTIONNAME_VERSION = "VERSION"; 207 public static final String ACTIONNAME_INITIALIZE = "INITIALIZE"; 208 public static final String ACTIONNAME_COMPUTE = "COMPUTE"; 209 public static final String ACTIONNAME_IGNORE = "IGNORE"; 210 public static final String ACTIONNAME_ABORT = "ABORT"; 211 212 221 public static String nameFromValue(int action) { 222 switch (action) { 223 case COPY: 224 return ACTIONNAME_COPY; 225 case VERSION: 226 return ACTIONNAME_VERSION; 227 case INITIALIZE: 228 return ACTIONNAME_INITIALIZE; 229 case COMPUTE: 230 return ACTIONNAME_COMPUTE; 231 case IGNORE: 232 return ACTIONNAME_IGNORE; 233 case ABORT: 234 return ACTIONNAME_ABORT; 235 default: 236 throw new IllegalArgumentException ("unknown on-version action: " + action); 237 } 238 } 239 240 249 public static int valueFromName(String name) { 250 if (name.equals(ACTIONNAME_COPY)) { 251 return COPY; 252 } else if (name.equals(ACTIONNAME_VERSION)) { 253 return VERSION; 254 } else if (name.equals(ACTIONNAME_INITIALIZE)) { 255 return INITIALIZE; 256 } else if (name.equals(ACTIONNAME_COMPUTE)) { 257 return COMPUTE; 258 } else if (name.equals(ACTIONNAME_IGNORE)) { 259 return IGNORE; 260 } else if (name.equals(ACTIONNAME_ABORT)) { 261 return ABORT; 262 } else { 263 throw new IllegalArgumentException ("unknown on-version action: " + name); 264 } 265 } 266 267 270 private OnParentVersionAction() { 271 } 272 } | Popular Tags |