1 package org.objectstyle.cayenne.modeler.pref; 2 3 import org.objectstyle.cayenne.PersistenceState; 4 5 public class DataMapDefaults extends _DataMapDefaults { 6 7 public static final String DEFAULT_SUPERCLASS_PACKAGE = "auto"; 8 9 public void setPersistenceState(int persistenceState) { 10 11 if (this.persistenceState == PersistenceState.TRANSIENT 13 && persistenceState == PersistenceState.NEW) { 14 setGeneratePairs(Boolean.TRUE); 15 setSuperclassPackageSuffix(DEFAULT_SUPERCLASS_PACKAGE); 16 } 17 super.setPersistenceState(persistenceState); 18 } 19 20 public String getSuperclassPackage() { 21 return getSuperclassPackageSuffix(); 22 } 23 24 public void setSuperclassPackage(String superclassPackage) { 25 setSuperclassPackageSuffix(superclassPackage); 27 } 28 29 33 public void setSuperclassPackage(String prefix, String suffix) { 34 if (prefix == null) { 35 prefix = ""; 36 } 37 else if (prefix.endsWith(".")) { 38 prefix = prefix.substring(0, prefix.length() - 1); 39 } 40 41 if (suffix == null) { 42 suffix = ""; 43 } 44 else if (suffix.startsWith(".")) { 45 suffix = suffix.substring(1); 46 } 47 48 String dot = (suffix.length() > 0 && prefix.length() > 0) ? "." : ""; 49 setSuperclassPackage(prefix + dot + suffix); 50 } 51 } 52 53 | Popular Tags |