From: Max M. <max...@us...> - 2004-10-16 22:22:59
|
Update of /cvsroot/wonder/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18454/Sources/er/extensions Modified Files: Tag: Wonder_2_0_0_Branch ERXEOAccessUtilities.java Log Message: Moving makeEditableSharedEntityNamed Index: ERXEOAccessUtilities.java =================================================================== RCS file: /cvsroot/wonder/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXEOAccessUtilities.java,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -C2 -d -r1.22 -r1.22.2.1 *** ERXEOAccessUtilities.java 27 Feb 2004 20:17:41 -0000 1.22 --- ERXEOAccessUtilities.java 16 Oct 2004 22:22:50 -0000 1.22.2.1 *************** *** 562,564 **** --- 562,594 ---- return sb.toString(); } + + /** + * Utility method to make a shared entity editable. This + * can be useful if you want to have an adminstration + * application that can edit shared enterprise objects + * and need a way at start up to disable the sharing + * constraints. + * @param entityName name of the shared entity to make + * shareable. + */ + // FIXME: Should have to pass in an editing context so that the + // correct model group and shared ec will be used. + // FIXME: Should also dump all of the currently shared eos from + // the shared context. + public static void makeEditableSharedEntityNamed(String entityName) { + EOEntity e = ERXEOAccessUtilities.entityNamed(null, entityName); + if (e != null && e.isReadOnly()) { + e.setReadOnly(false); + e.setCachesObjects(false); + // Remove all of the shared fetch specs + for (Enumeration fetchSpecNameObjectEnumerator = e.sharedObjectFetchSpecificationNames().objectEnumerator(); + fetchSpecNameObjectEnumerator.hasMoreElements();) { + e.removeSharedObjectFetchSpecificationByName((String)fetchSpecNameObjectEnumerator.nextElement()); + } + } else if (e == null) { + log.warn("MakeSharedEntityEditable: unable to find entity named: " + entityName); + } else { + log.warn("MakeSharedEntityEditable: entity already editable: " + entityName); + } + } } |