/*==========================================================================*\ | _Theme.java |*-------------------------------------------------------------------------*| | Created by eogenerator | DO NOT EDIT. Make changes to Theme.java instead. |*-------------------------------------------------------------------------*| | Copyright (C) 2006-2012 Virginia Tech | | This file is part of Web-CAT. | | Web-CAT is free software; you can redistribute it and/or modify | it under the terms of the GNU Affero General Public License as published | by the Free Software Foundation; either version 3 of the License, or | (at your option) any later version. | | Web-CAT is distributed in the hope that it will be useful, | but WITHOUT ANY WARRANTY; without even the implied warranty of | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | GNU General Public License for more details. | | You should have received a copy of the GNU Affero General Public License | along with Web-CAT; if not, see <http://www.gnu.org/licenses/>. \*==========================================================================*/ package org.webcat.core; import com.webobjects.eoaccess.*; import com.webobjects.eocontrol.*; import com.webobjects.foundation.*; import er.extensions.eof.ERXEOControlUtilities; import er.extensions.eof.ERXKey; import org.apache.log4j.Logger; import org.webcat.core.EOBasedKeyGenerator; import org.webcat.woextensions.WCFetchSpecification; // ------------------------------------------------------------------------- /** * An automatically generated EOGenericRecord subclass. DO NOT EDIT. * To change, use EOModeler, or make additions in * Theme.java. * * @author Generated by eogenerator * @version version suppressed to control auto-generation */ public abstract class _Theme extends org.webcat.core.EOBase implements org.webcat.core.MutableContainer.MutableContainerOwner { //~ Constructors .......................................................... // ---------------------------------------------------------- /** * Creates a new _Theme object. */ public _Theme() { super(); } // ---------------------------------------------------------- /** * A static factory method for creating a new * Theme object given required * attributes and relationships. * @param editingContext The context in which the new object will be * inserted * @param dirNameValue * @param isForThemeDevelopersValue * @param updateMutableFieldsValue * @return The newly created object */ public static Theme create( EOEditingContext editingContext, String dirNameValue, boolean isForThemeDevelopersValue, boolean updateMutableFieldsValue ) { Theme eoObject = (Theme) EOUtilities.createAndInsertInstance( editingContext, _Theme.ENTITY_NAME); eoObject.setDirName(dirNameValue); eoObject.setIsForThemeDevelopers(isForThemeDevelopersValue); eoObject.setUpdateMutableFields(updateMutableFieldsValue); return eoObject; } // ---------------------------------------------------------- /** * Get a local instance of the given object in another editing context. * @param editingContext The target editing context * @param eo The object to import * @return An instance of the given object in the target editing context */ public static Theme localInstance( EOEditingContext editingContext, Theme eo) { return (eo == null) ? null : (Theme)EOUtilities.localInstanceOfObject( editingContext, eo); } // ---------------------------------------------------------- /** * Look up an object by id number. Assumes the editing * context is appropriately locked. * @param ec The editing context to use * @param id The id to look up * @return The object, or null if no such id exists */ public static Theme forId( EOEditingContext ec, int id) { Theme obj = null; if (id > 0) { NSArray<Theme> objects = objectsMatchingValues(ec, "id", new Integer(id)); if (objects != null && objects.count() > 0) { obj = objects.objectAtIndex(0); } } return obj; } // ---------------------------------------------------------- /** * Look up an object by id number. Assumes the editing * context is appropriately locked. * @param ec The editing context to use * @param id The id to look up * @return The object, or null if no such id exists */ public static Theme forId( EOEditingContext ec, String id) { return forId(ec, er.extensions.foundation.ERXValueUtilities.intValue(id)); } //~ Constants (for key names) ............................................. // Attributes --- public static final String DIR_NAME_KEY = "dirName"; public static final ERXKey<String> dirName = new ERXKey<String>(DIR_NAME_KEY); public static final String IS_FOR_THEME_DEVELOPERS_KEY = "isForThemeDevelopers"; public static final ERXKey<Integer> isForThemeDevelopers = new ERXKey<Integer>(IS_FOR_THEME_DEVELOPERS_KEY); public static final String LAST_UPDATE_KEY = "lastUpdate"; public static final ERXKey<NSTimestamp> lastUpdate = new ERXKey<NSTimestamp>(LAST_UPDATE_KEY); public static final String NAME_KEY = "name"; public static final ERXKey<String> name = new ERXKey<String>(NAME_KEY); public static final String PROPERTIES_KEY = "properties"; public static final ERXKey<NSData> properties = new ERXKey<NSData>(PROPERTIES_KEY); public static final String UPDATE_MUTABLE_FIELDS_KEY = "updateMutableFields"; public static final ERXKey<Integer> updateMutableFields = new ERXKey<Integer>(UPDATE_MUTABLE_FIELDS_KEY); // To-one relationships --- // To-many relationships --- // Fetch specifications --- public static final String ALL_OBJECTS_ORDERED_BY_NAME_FSPEC = "allObjectsOrderedByName"; public static final String THEME_FOR_DIR_NAME_FSPEC = "themeForDirName"; public static final String ENTITY_NAME = "Theme"; public transient final EOBasedKeyGenerator generateKey = new EOBasedKeyGenerator(this); //~ Methods ............................................................... // ---------------------------------------------------------- /** * Get a local instance of this object in another editing context. * @param editingContext The target editing context * @return An instance of this object in the target editing context */ public Theme localInstance(EOEditingContext editingContext) { return (Theme)EOUtilities.localInstanceOfObject( editingContext, this); } // ---------------------------------------------------------- /** * Get a list of changes between this object's current state and the * last committed version. * @return a dictionary of the changes that have not yet been committed */ @SuppressWarnings("unchecked") public NSDictionary<String, Object> changedProperties() { return changesFromSnapshot( editingContext().committedSnapshotForObject(this)); } // ---------------------------------------------------------- /** * Retrieve this object's <code>id</code> value. * @return the value of the attribute */ public Number id() { try { return (Number)EOUtilities.primaryKeyForObject( editingContext() , this).objectForKey("id"); } catch (Exception e) { return er.extensions.eof.ERXConstant.ZeroInteger; } } // ---------------------------------------------------------- /** * Retrieve this object's <code>dirName</code> value. * @return the value of the attribute */ public String dirName() { return (String)storedValueForKey( "dirName" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>dirName</code> * property. * * @param value The new value for this property */ public void setDirName( String value ) { if (log.isDebugEnabled()) { log.debug( "setDirName(" + value + "): was " + dirName() ); } takeStoredValueForKey( value, "dirName" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>isForThemeDevelopers</code> value. * @return the value of the attribute */ public boolean isForThemeDevelopers() { Integer returnValue = (Integer)storedValueForKey( "isForThemeDevelopers" ); return ( returnValue == null ) ? false : ( returnValue.intValue() > 0 ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>isForThemeDevelopers</code> * property. * * @param value The new value for this property */ public void setIsForThemeDevelopers( boolean value ) { if (log.isDebugEnabled()) { log.debug( "setIsForThemeDevelopers(" + value + "): was " + isForThemeDevelopers() ); } Integer actual = er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 ); setIsForThemeDevelopersRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>isForThemeDevelopers</code> value. * @return the value of the attribute */ public Integer isForThemeDevelopersRaw() { return (Integer)storedValueForKey( "isForThemeDevelopers" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>isForThemeDevelopers</code> * property. * * @param value The new value for this property */ public void setIsForThemeDevelopersRaw( Integer value ) { if (log.isDebugEnabled()) { log.debug( "setIsForThemeDevelopersRaw(" + value + "): was " + isForThemeDevelopersRaw() ); } takeStoredValueForKey( value, "isForThemeDevelopers" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>lastUpdate</code> value. * @return the value of the attribute */ public NSTimestamp lastUpdate() { return (NSTimestamp)storedValueForKey( "lastUpdate" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>lastUpdate</code> * property. * * @param value The new value for this property */ public void setLastUpdate( NSTimestamp value ) { if (log.isDebugEnabled()) { log.debug( "setLastUpdate(" + value + "): was " + lastUpdate() ); } takeStoredValueForKey( value, "lastUpdate" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>name</code> value. * @return the value of the attribute */ public String name() { return (String)storedValueForKey( "name" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>name</code> * property. * * @param value The new value for this property */ public void setName( String value ) { if (log.isDebugEnabled()) { log.debug( "setName(" + value + "): was " + name() ); } takeStoredValueForKey( value, "name" ); } //-- Local mutable cache -- private org.webcat.core.MutableDictionary propertiesCache; private NSData propertiesRawCache; // ---------------------------------------------------------- /** * Retrieve this object's <code>properties</code> value. * @return the value of the attribute */ public org.webcat.core.MutableDictionary properties() { NSData dbValue = (NSData)storedValueForKey("properties"); if (propertiesRawCache != dbValue) { if (dbValue != null && dbValue.equals( propertiesRawCache)) { // They are still equal, so just update the raw cache propertiesRawCache = dbValue; } else { // Underlying attribute may have changed because // of a concurrent update through another editing // context, so throw away current values. propertiesRawCache = dbValue; org.webcat.core.MutableDictionary newValue = org.webcat.core.MutableDictionary .objectWithArchiveData( dbValue ); if ( propertiesCache != null ) { propertiesCache.copyFrom( newValue ); } else { propertiesCache = newValue; } propertiesCache.setOwner( this ); setUpdateMutableFields( true ); } } else if ( dbValue == null && propertiesCache == null ) { propertiesCache = org.webcat.core.MutableDictionary .objectWithArchiveData( dbValue ); propertiesCache.setOwner( this ); setUpdateMutableFields( true ); } return propertiesCache; } // ---------------------------------------------------------- /** * Change the value of this object's <code>properties</code> * property. * * @param value The new value for this property */ public void setProperties( org.webcat.core.MutableDictionary value ) { if (log.isDebugEnabled()) { log.debug( "setProperties(" + value + ")" ); } if ( propertiesCache == null ) { propertiesCache = value; value.setHasChanged( false ); propertiesRawCache = value.archiveData(); takeStoredValueForKey( propertiesRawCache, "properties" ); } else if ( propertiesCache != value ) // ( propertiesCache != null ) { propertiesCache.copyFrom( value ); setUpdateMutableFields( true ); } else // ( propertiesCache == non-null value ) { // no nothing } } // ---------------------------------------------------------- /** * Clear the value of this object's <code>properties</code> * property. */ public void clearProperties() { if (log.isDebugEnabled()) { log.debug( "clearProperties()" ); } takeStoredValueForKey( null, "properties" ); propertiesRawCache = null; propertiesCache = null; } // ---------------------------------------------------------- /** * Retrieve this object's <code>updateMutableFields</code> value. * @return the value of the attribute */ public boolean updateMutableFields() { Integer returnValue = (Integer)storedValueForKey( "updateMutableFields" ); return ( returnValue == null ) ? false : ( returnValue.intValue() > 0 ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>updateMutableFields</code> * property. * * @param value The new value for this property */ public void setUpdateMutableFields( boolean value ) { if (log.isDebugEnabled()) { log.debug( "setUpdateMutableFields(" + value + "): was " + updateMutableFields() ); } Integer actual = er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 ); setUpdateMutableFieldsRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>updateMutableFields</code> value. * @return the value of the attribute */ public Integer updateMutableFieldsRaw() { return (Integer)storedValueForKey( "updateMutableFields" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>updateMutableFields</code> * property. * * @param value The new value for this property */ public void setUpdateMutableFieldsRaw( Integer value ) { if (log.isDebugEnabled()) { log.debug( "setUpdateMutableFieldsRaw(" + value + "): was " + updateMutableFieldsRaw() ); } takeStoredValueForKey( value, "updateMutableFields" ); } // ---------------------------------------------------------- /** * Called just before this object is saved to the database. */ public void saveMutables() { log.debug("saveMutables()"); if ( propertiesCache != null && propertiesCache.hasChanged() ) { propertiesRawCache = propertiesCache.archiveData(); takeStoredValueForKey( propertiesRawCache, "properties" ); propertiesCache.setHasChanged( false ); } setUpdateMutableFields( false ); } // ---------------------------------------------------------- /** * Called just before this object is saved to the database. */ public void willUpdate() { log.debug("willUpdate()"); saveMutables(); super.willUpdate(); } // ---------------------------------------------------------- /** * Called just before this object is inserted into the database. */ public void willInsert() { log.debug("willInsert()"); saveMutables(); super.willInsert(); } // ---------------------------------------------------------- /** * Called when the object is invalidated. */ public void flushCaches() { log.debug("flushCaches()"); propertiesCache = null; propertiesRawCache = null; super.flushCaches(); } // ---------------------------------------------------------- /** * Called when an owned mutable container object is changed. */ public void mutableContainerHasChanged() { setUpdateMutableFields( true ); } // ---------------------------------------------------------- /** * Retrieve objects using a fetch specification. * * @param context The editing context to use * @param fspec The fetch specification to use * * @return an NSArray of the entities retrieved */ @SuppressWarnings("unchecked") public static NSArray<Theme> objectsWithFetchSpecification( EOEditingContext context, EOFetchSpecification fspec) { return context.objectsWithFetchSpecification(fspec); } // ---------------------------------------------------------- /** * Retrieve all objects of this type. * * @param context The editing context to use * * @return an NSArray of the entities retrieved */ public static NSArray<Theme> allObjects( EOEditingContext context) { return objectsMatchingQualifier(context, null, null); } // ---------------------------------------------------------- /** * Retrieve objects using a qualifier. * * @param context The editing context to use * @param qualifier The qualifier to use * * @return an NSArray of the entities retrieved */ public static NSArray<Theme> objectsMatchingQualifier( EOEditingContext context, EOQualifier qualifier) { return objectsMatchingQualifier(context, qualifier, null); } // ---------------------------------------------------------- /** * Retrieve objects using a qualifier and sort orderings. * * @param context The editing context to use * @param qualifier The qualifier to use * @param sortOrderings The sort orderings to use * * @return an NSArray of the entities retrieved */ public static NSArray<Theme> objectsMatchingQualifier( EOEditingContext context, EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) { @SuppressWarnings("unchecked") EOFetchSpecification fspec = new WCFetchSpecification( ENTITY_NAME, qualifier, sortOrderings); fspec.setUsesDistinct(true); return objectsWithFetchSpecification(context, fspec); } // ---------------------------------------------------------- /** * Retrieve the first object that matches a qualifier, when * sorted with the specified sort orderings. * * @param context The editing context to use * @param qualifier The qualifier to use * @param sortOrderings the sort orderings * * @return the first entity that was retrieved, or null if there was none */ public static Theme firstObjectMatchingQualifier( EOEditingContext context, EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) { NSArray<Theme> objects = objectsMatchingQualifier(context, qualifier, sortOrderings); return (objects.size() > 0) ? objects.get(0) : null; } // ---------------------------------------------------------- /** * Retrieve a single object using a list of keys and values to match. * * @param context The editing context to use * @param qualifier The qualifier to use * * @return the single entity that was retrieved * * @throws EOUtilities.MoreThanOneException * if there is more than one matching object */ public static Theme uniqueObjectMatchingQualifier( EOEditingContext context, EOQualifier qualifier) throws EOUtilities.MoreThanOneException { NSArray<Theme> objects = objectsMatchingQualifier(context, qualifier); if (objects.size() > 1) { String msg = "fetching Theme"; try { if (qualifier != null) { msg += " where " + qualifier; } msg += ", result = " + objects; } catch (Exception e) { log.error("Exception building MoreThanOneException message, " + "contents so far: " + msg, e); } throw new EOUtilities.MoreThanOneException(msg); } return (objects.size() > 0) ? objects.get(0) : null; } // ---------------------------------------------------------- /** * Retrieve objects using a list of keys and values to match. * * @param context The editing context to use * @param keysAndValues a list of keys and values to match, alternating * "key", "value", "key", "value"... * * @return an NSArray of the entities retrieved */ public static NSArray<Theme> objectsMatchingValues( EOEditingContext context, Object... keysAndValues) { if (keysAndValues.length % 2 != 0) { throw new IllegalArgumentException("There should a value " + "corresponding to every key that was passed. Args = " + java.util.Arrays.toString(keysAndValues)); } NSMutableDictionary<String, Object> valueDictionary = new NSMutableDictionary<String, Object>(); for (int i = 0; i < keysAndValues.length; i += 2) { Object key = keysAndValues[i]; Object value = keysAndValues[i + 1]; if (key == null) { throw new IllegalArgumentException( "Found null where a String key was expected, arguments = " + java.util.Arrays.toString(keysAndValues)); } else if (!(key instanceof String)) { throw new IllegalArgumentException( "Found a " + key.getClass().getName() + " [" + key + "]" + " where a String key was expected, arguments = " + java.util.Arrays.toString(keysAndValues)); } valueDictionary.setObjectForKey(value, key); } return objectsMatchingValues(context, valueDictionary); } // ---------------------------------------------------------- /** * Retrieve objects using a dictionary of keys and values to match. * * @param context The editing context to use * @param keysAndValues a dictionary of keys and values to match * * @return an NSArray of the entities retrieved */ @SuppressWarnings("unchecked") public static NSArray<Theme> objectsMatchingValues( EOEditingContext context, NSDictionary<String, Object> keysAndValues) { return EOUtilities.objectsMatchingValues(context, ENTITY_NAME, keysAndValues); } // ---------------------------------------------------------- /** * Retrieve the first object that matches a set of keys and values, when * sorted with the specified sort orderings. * * @param context The editing context to use * @param sortOrderings the sort orderings * @param keysAndValues a list of keys and values to match, alternating * "key", "value", "key", "value"... * * @return the first entity that was retrieved, or null if there was none */ public static Theme firstObjectMatchingValues( EOEditingContext context, NSArray<EOSortOrdering> sortOrderings, Object... keysAndValues) { if (keysAndValues.length % 2 != 0) { throw new IllegalArgumentException("There should a value " + "corresponding to every key that was passed. Args = " + java.util.Arrays.toString(keysAndValues)); } NSMutableDictionary<String, Object> valueDictionary = new NSMutableDictionary<String, Object>(); for (int i = 0; i < keysAndValues.length; i += 2) { Object key = keysAndValues[i]; Object value = keysAndValues[i + 1]; if (key == null) { throw new IllegalArgumentException( "Found null where a String key was expected, arguments = " + java.util.Arrays.toString(keysAndValues)); } else if (!(key instanceof String)) { throw new IllegalArgumentException( "Found a " + key.getClass().getName() + " [" + key + "]" + " where a String key was expected, arguments = " + java.util.Arrays.toString(keysAndValues)); } valueDictionary.setObjectForKey(value, key); } return firstObjectMatchingValues( context, sortOrderings, valueDictionary); } // ---------------------------------------------------------- /** * Retrieves the first object that matches a set of keys and values, when * sorted with the specified sort orderings. * * @param context The editing context to use * @param sortOrderings the sort orderings * @param keysAndValues a dictionary of keys and values to match * * @return the first entity that was retrieved, or null if there was none */ public static Theme firstObjectMatchingValues( EOEditingContext context, NSArray<EOSortOrdering> sortOrderings, NSDictionary<String, Object> keysAndValues) { @SuppressWarnings("unchecked") EOFetchSpecification fspec = new WCFetchSpecification( ENTITY_NAME, EOQualifier.qualifierToMatchAllValues(keysAndValues), sortOrderings); fspec.setFetchLimit(1); NSArray<Theme> objects = objectsWithFetchSpecification( context, fspec ); if ( objects.count() == 0 ) { return null; } else { return objects.objectAtIndex(0); } } // ---------------------------------------------------------- /** * Retrieve a single object using a list of keys and values to match. * * @param context The editing context to use * @param keysAndValues a list of keys and values to match, alternating * "key", "value", "key", "value"... * * @return the single entity that was retrieved, or null if there was none * * @throws EOUtilities.MoreThanOneException * if there is more than one matching object */ public static Theme uniqueObjectMatchingValues( EOEditingContext context, Object... keysAndValues) throws EOUtilities.MoreThanOneException { if (keysAndValues.length % 2 != 0) { throw new IllegalArgumentException("There should a value " + "corresponding to every key that was passed. Args = " + java.util.Arrays.toString(keysAndValues)); } NSMutableDictionary<String, Object> valueDictionary = new NSMutableDictionary<String, Object>(); for (int i = 0; i < keysAndValues.length; i += 2) { Object key = keysAndValues[i]; Object value = keysAndValues[i + 1]; if (key == null) { throw new IllegalArgumentException( "Found null where a String key was expected, arguments = " + java.util.Arrays.toString(keysAndValues)); } else if (!(key instanceof String)) { throw new IllegalArgumentException( "Found a " + key.getClass().getName() + " [" + key + "]" + " where a String key was expected, arguments = " + java.util.Arrays.toString(keysAndValues)); } valueDictionary.setObjectForKey(value, key); } return uniqueObjectMatchingValues(context, valueDictionary); } // ---------------------------------------------------------- /** * Retrieve an object using a dictionary of keys and values to match. * * @param context The editing context to use * @param keysAndValues a dictionary of keys and values to match * * @return the single entity that was retrieved, or null if there was none * * @throws EOUtilities.MoreThanOneException * if there is more than one matching object */ public static Theme uniqueObjectMatchingValues( EOEditingContext context, NSDictionary<String, Object> keysAndValues) throws EOUtilities.MoreThanOneException { try { return (Theme)EOUtilities.objectMatchingValues( context, ENTITY_NAME, keysAndValues); } catch (EOObjectNotAvailableException e) { return null; } } // ---------------------------------------------------------- /** * Retrieve the count of all objects of this type. * * @param context The editing context to use * * @return the count of all objects */ public static int countOfAllObjects(EOEditingContext context) { return countOfObjectsMatchingQualifier(context, null); } // ---------------------------------------------------------- /** * Retrieve the count of objects that match a qualifier. * * @param context The editing context to use * @param qualifier The qualifier to use * * @return the count of objects matching the qualifier */ public static int countOfObjectsMatchingQualifier( EOEditingContext context, EOQualifier qualifier) { return ERXEOControlUtilities.objectCountWithQualifier( context, ENTITY_NAME, qualifier); } // ---------------------------------------------------------- /** * Retrieve the count of objects using a list of keys and values to match. * * @param context The editing context to use * @param keysAndValues a list of keys and values to match, alternating * "key", "value", "key", "value"... * * @return the count of objects that match the specified values */ public static int countOfObjectsMatchingValues( EOEditingContext context, Object... keysAndValues) { if (keysAndValues.length % 2 != 0) { throw new IllegalArgumentException("There should a value " + "corresponding to every key that was passed. Args = " + java.util.Arrays.toString(keysAndValues)); } NSMutableDictionary<String, Object> valueDictionary = new NSMutableDictionary<String, Object>(); for (int i = 0; i < keysAndValues.length; i += 2) { Object key = keysAndValues[i]; Object value = keysAndValues[i + 1]; if (key == null) { throw new IllegalArgumentException( "Found null where a String key was expected, arguments = " + java.util.Arrays.toString(keysAndValues)); } else if (!(key instanceof String)) { throw new IllegalArgumentException( "Found a " + key.getClass().getName() + " [" + key + "]" + " where a String key was expected, arguments = " + java.util.Arrays.toString(keysAndValues)); } valueDictionary.setObjectForKey(value, key); } return countOfObjectsMatchingValues(context, valueDictionary); } // ---------------------------------------------------------- /** * Retrieve the count of objects using a dictionary of keys and values to * match. * * @param context The editing context to use * @param keysAndValues a dictionary of keys and values to match * * @return the count of objects that matched the specified values */ public static int countOfObjectsMatchingValues( EOEditingContext context, NSDictionary<String, Object> keysAndValues) { return countOfObjectsMatchingQualifier(context, EOQualifier.qualifierToMatchAllValues(keysAndValues)); } // ---------------------------------------------------------- /** * Retrieve objects according to the <code>allObjectsOrderedByName</code> * fetch specification. * * @param context The editing context to use * @return an NSArray of the entities retrieved */ public static NSArray<Theme> allObjectsOrderedByName( EOEditingContext context) { EOFetchSpecification spec = WCFetchSpecification .fetchSpecificationNamed("allObjectsOrderedByName", "Theme"); NSArray<Theme> objects = objectsWithFetchSpecification(context, spec); if (log.isDebugEnabled()) { log.debug("allObjectsOrderedByName(ec" + "): " + objects); } return objects; } // ---------------------------------------------------------- /** * Retrieve an object according to the <code>themeForDirName</code> * fetch specification. * * @param context The editing context to use * @param dirNameBinding fetch spec parameter * @return the object retrieved, or null if one was not found */ public static Theme themeForDirName( EOEditingContext context, String dirNameBinding ) { EOFetchSpecification spec = WCFetchSpecification .fetchSpecificationNamed("themeForDirName", "Theme"); NSMutableDictionary<String, Object> bindings = new NSMutableDictionary<String, Object>(); if ( dirNameBinding != null ) { bindings.setObjectForKey( dirNameBinding, "dirName" ); } spec = spec.fetchSpecificationWithQualifierBindings( bindings ); NSArray<Theme> objects = objectsWithFetchSpecification( context, spec ); if (log.isDebugEnabled()) { log.debug( "themeForDirName(ec" + ", " + dirNameBinding + "): " + objects ); } if ( objects.count() == 0 ) { return null; } else { return objects.objectAtIndex(0); } } // ---------------------------------------------------------- /** * Produce a string representation of this object. This implementation * calls UserPresentableDescription(), which uses WebObjects' internal * mechanism to print out the visible fields of this object. Normally, * subclasses would override userPresentableDescription() to change * the way the object is printed. * * @return A string representation of the object's value */ public String toString() { return userPresentableDescription(); } //~ Instance/static variables ............................................. static Logger log = Logger.getLogger(Theme.class); }