1 56 package org.objectstyle.cayenne.map; 57 58 63 public class DeleteRule { 64 public static final int NO_ACTION = 0; 65 private static final String NO_ACTION_NAME = "No Action"; 66 67 72 public static final int NULLIFY = 1; 73 private static final String NULLIFY_NAME = "Nullify"; 74 75 77 public static final int CASCADE = 2; 78 private static final String CASCADE_NAME = "Cascade"; 79 80 83 public static final int DENY = 3; 84 private static final String DENY_NAME = "Deny"; 85 86 91 public static String deleteRuleName(int deleteRule) { 92 switch (deleteRule) { 93 case DeleteRule.NULLIFY : 94 return NULLIFY_NAME; 95 case DeleteRule.CASCADE : 96 return CASCADE_NAME; 97 case DeleteRule.DENY : 98 return DENY_NAME; 99 default : 100 return NO_ACTION_NAME; 101 } 102 } 103 104 108 public static int deleteRuleForName(String name) { 109 if (DENY_NAME.equals(name)) { 110 return DENY; 111 } else if (CASCADE_NAME.equals(name)) { 112 return CASCADE; 113 } else if (NULLIFY_NAME.equals(name)) { 114 return NULLIFY; 115 } 116 return NO_ACTION; 117 } 118 119 } 120 | Popular Tags |