/*==========================================================================*\
| _GradingPlugin.java
|*-------------------------------------------------------------------------*|
| Created by eogenerator
| DO NOT EDIT. Make changes to GradingPlugin.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.grader;
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
* GradingPlugin.java.
*
* @author Generated by eogenerator
* @version version suppressed to control auto-generation
*/
public abstract class _GradingPlugin
extends org.webcat.core.EOBase
implements org.webcat.core.MutableContainer.MutableContainerOwner
{
//~ Constructors ..........................................................
// ----------------------------------------------------------
/**
* Creates a new _GradingPlugin object.
*/
public _GradingPlugin()
{
super();
}
// ----------------------------------------------------------
/**
* A static factory method for creating a new
* GradingPlugin object given required
* attributes and relationships.
* @param editingContext The context in which the new object will be
* inserted
* @param isConfigFileValue
* @param isPublishedValue
* @param updateMutableFieldsValue
* @return The newly created object
*/
public static GradingPlugin create(
EOEditingContext editingContext,
boolean isConfigFileValue,
boolean isPublishedValue,
boolean updateMutableFieldsValue
)
{
GradingPlugin eoObject = (GradingPlugin)
EOUtilities.createAndInsertInstance(
editingContext,
_GradingPlugin.ENTITY_NAME);
eoObject.setIsConfigFile(isConfigFileValue);
eoObject.setIsPublished(isPublishedValue);
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 GradingPlugin localInstance(
EOEditingContext editingContext, GradingPlugin eo)
{
return (eo == null)
? null
: (GradingPlugin)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 GradingPlugin forId(
EOEditingContext ec, int id)
{
GradingPlugin obj = null;
if (id > 0)
{
NSArray<GradingPlugin> 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 GradingPlugin forId(
EOEditingContext ec, String id)
{
return forId(ec, er.extensions.foundation.ERXValueUtilities.intValue(id));
}
//~ Constants (for key names) .............................................
// Attributes ---
public static final String CONFIG_DESCRIPTION_KEY = "configDescription";
public static final ERXKey<NSData> configDescription =
new ERXKey<NSData>(CONFIG_DESCRIPTION_KEY);
public static final String DEFAULT_CONFIG_SETTINGS_KEY = "defaultConfigSettings";
public static final ERXKey<NSData> defaultConfigSettings =
new ERXKey<NSData>(DEFAULT_CONFIG_SETTINGS_KEY);
public static final String FILE_CONFIG_SETTINGS_KEY = "fileConfigSettings";
public static final ERXKey<NSData> fileConfigSettings =
new ERXKey<NSData>(FILE_CONFIG_SETTINGS_KEY);
public static final String GLOBAL_CONFIG_SETTINGS_KEY = "globalConfigSettings";
public static final ERXKey<NSData> globalConfigSettings =
new ERXKey<NSData>(GLOBAL_CONFIG_SETTINGS_KEY);
public static final String IS_CONFIG_FILE_KEY = "isConfigFile";
public static final ERXKey<Integer> isConfigFile =
new ERXKey<Integer>(IS_CONFIG_FILE_KEY);
public static final String IS_PUBLISHED_KEY = "isPublished";
public static final ERXKey<Integer> isPublished =
new ERXKey<Integer>(IS_PUBLISHED_KEY);
public static final String LAST_MODIFIED_KEY = "lastModified";
public static final ERXKey<NSTimestamp> lastModified =
new ERXKey<NSTimestamp>(LAST_MODIFIED_KEY);
public static final String MAIN_FILE_NAME_KEY = "mainFileName";
public static final ERXKey<String> mainFileName =
new ERXKey<String>(MAIN_FILE_NAME_KEY);
public static final String NAME_KEY = "name";
public static final ERXKey<String> name =
new ERXKey<String>(NAME_KEY);
public static final String SUBDIR_NAME_KEY = "subdirName";
public static final ERXKey<String> subdirName =
new ERXKey<String>(SUBDIR_NAME_KEY);
public static final String UPDATE_MUTABLE_FIELDS_KEY = "updateMutableFields";
public static final ERXKey<Integer> updateMutableFields =
new ERXKey<Integer>(UPDATE_MUTABLE_FIELDS_KEY);
public static final String UPLOADED_FILE_NAME_KEY = "uploadedFileName";
public static final ERXKey<String> uploadedFileName =
new ERXKey<String>(UPLOADED_FILE_NAME_KEY);
// To-one relationships ---
public static final String AUTHOR_KEY = "author";
public static final ERXKey<org.webcat.core.User> author =
new ERXKey<org.webcat.core.User>(AUTHOR_KEY);
public static final String LANGUAGE_KEY = "language";
public static final ERXKey<org.webcat.core.Language> language =
new ERXKey<org.webcat.core.Language>(LANGUAGE_KEY);
// To-many relationships ---
public static final String COURSE_OFFERINGS_KEY = "courseOfferings";
public static final ERXKey<org.webcat.core.CourseOffering> courseOfferings =
new ERXKey<org.webcat.core.CourseOffering>(COURSE_OFFERINGS_KEY);
public static final String STEPS_KEY = "steps";
public static final ERXKey<org.webcat.grader.Step> steps =
new ERXKey<org.webcat.grader.Step>(STEPS_KEY);
// Fetch specifications ---
public static final String PLUGINS_AVAILABLE_TO_USER_FSPEC = "pluginsAvailableToUser";
public static final String ENTITY_NAME = "GradingPlugin";
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 GradingPlugin localInstance(EOEditingContext editingContext)
{
return (GradingPlugin)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;
}
}
//-- Local mutable cache --
private org.webcat.core.MutableDictionary configDescriptionCache;
private NSData configDescriptionRawCache;
// ----------------------------------------------------------
/**
* Retrieve this object's <code>configDescription</code> value.
* @return the value of the attribute
*/
public org.webcat.core.MutableDictionary configDescription()
{
NSData dbValue =
(NSData)storedValueForKey("configDescription");
if (configDescriptionRawCache != dbValue)
{
if (dbValue != null && dbValue.equals( configDescriptionRawCache))
{
// They are still equal, so just update the raw cache
configDescriptionRawCache = dbValue;
}
else
{
// Underlying attribute may have changed because
// of a concurrent update through another editing
// context, so throw away current values.
configDescriptionRawCache = dbValue;
org.webcat.core.MutableDictionary newValue =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
if ( configDescriptionCache != null )
{
configDescriptionCache.copyFrom( newValue );
}
else
{
configDescriptionCache = newValue;
}
configDescriptionCache.setOwner( this );
setUpdateMutableFields( true );
}
}
else if ( dbValue == null && configDescriptionCache == null )
{
configDescriptionCache =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
configDescriptionCache.setOwner( this );
setUpdateMutableFields( true );
}
return configDescriptionCache;
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>configDescription</code>
* property.
*
* @param value The new value for this property
*/
public void setConfigDescription( org.webcat.core.MutableDictionary value )
{
if (log.isDebugEnabled())
{
log.debug( "setConfigDescription("
+ value + ")" );
}
if ( configDescriptionCache == null )
{
configDescriptionCache = value;
value.setHasChanged( false );
configDescriptionRawCache = value.archiveData();
takeStoredValueForKey( configDescriptionRawCache, "configDescription" );
}
else if ( configDescriptionCache != value ) // ( configDescriptionCache != null )
{
configDescriptionCache.copyFrom( value );
setUpdateMutableFields( true );
}
else // ( configDescriptionCache == non-null value )
{
// no nothing
}
}
// ----------------------------------------------------------
/**
* Clear the value of this object's <code>configDescription</code>
* property.
*/
public void clearConfigDescription()
{
if (log.isDebugEnabled())
{
log.debug( "clearConfigDescription()" );
}
takeStoredValueForKey( null, "configDescription" );
configDescriptionRawCache = null;
configDescriptionCache = null;
}
//-- Local mutable cache --
private org.webcat.core.MutableDictionary defaultConfigSettingsCache;
private NSData defaultConfigSettingsRawCache;
// ----------------------------------------------------------
/**
* Retrieve this object's <code>defaultConfigSettings</code> value.
* @return the value of the attribute
*/
public org.webcat.core.MutableDictionary defaultConfigSettings()
{
NSData dbValue =
(NSData)storedValueForKey("defaultConfigSettings");
if (defaultConfigSettingsRawCache != dbValue)
{
if (dbValue != null && dbValue.equals( defaultConfigSettingsRawCache))
{
// They are still equal, so just update the raw cache
defaultConfigSettingsRawCache = dbValue;
}
else
{
// Underlying attribute may have changed because
// of a concurrent update through another editing
// context, so throw away current values.
defaultConfigSettingsRawCache = dbValue;
org.webcat.core.MutableDictionary newValue =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
if ( defaultConfigSettingsCache != null )
{
defaultConfigSettingsCache.copyFrom( newValue );
}
else
{
defaultConfigSettingsCache = newValue;
}
defaultConfigSettingsCache.setOwner( this );
setUpdateMutableFields( true );
}
}
else if ( dbValue == null && defaultConfigSettingsCache == null )
{
defaultConfigSettingsCache =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
defaultConfigSettingsCache.setOwner( this );
setUpdateMutableFields( true );
}
return defaultConfigSettingsCache;
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>defaultConfigSettings</code>
* property.
*
* @param value The new value for this property
*/
public void setDefaultConfigSettings( org.webcat.core.MutableDictionary value )
{
if (log.isDebugEnabled())
{
log.debug( "setDefaultConfigSettings("
+ value + ")" );
}
if ( defaultConfigSettingsCache == null )
{
defaultConfigSettingsCache = value;
value.setHasChanged( false );
defaultConfigSettingsRawCache = value.archiveData();
takeStoredValueForKey( defaultConfigSettingsRawCache, "defaultConfigSettings" );
}
else if ( defaultConfigSettingsCache != value ) // ( defaultConfigSettingsCache != null )
{
defaultConfigSettingsCache.copyFrom( value );
setUpdateMutableFields( true );
}
else // ( defaultConfigSettingsCache == non-null value )
{
// no nothing
}
}
// ----------------------------------------------------------
/**
* Clear the value of this object's <code>defaultConfigSettings</code>
* property.
*/
public void clearDefaultConfigSettings()
{
if (log.isDebugEnabled())
{
log.debug( "clearDefaultConfigSettings()" );
}
takeStoredValueForKey( null, "defaultConfigSettings" );
defaultConfigSettingsRawCache = null;
defaultConfigSettingsCache = null;
}
//-- Local mutable cache --
private org.webcat.core.MutableDictionary fileConfigSettingsCache;
private NSData fileConfigSettingsRawCache;
// ----------------------------------------------------------
/**
* Retrieve this object's <code>fileConfigSettings</code> value.
* @return the value of the attribute
*/
public org.webcat.core.MutableDictionary fileConfigSettings()
{
NSData dbValue =
(NSData)storedValueForKey("fileConfigSettings");
if (fileConfigSettingsRawCache != dbValue)
{
if (dbValue != null && dbValue.equals( fileConfigSettingsRawCache))
{
// They are still equal, so just update the raw cache
fileConfigSettingsRawCache = dbValue;
}
else
{
// Underlying attribute may have changed because
// of a concurrent update through another editing
// context, so throw away current values.
fileConfigSettingsRawCache = dbValue;
org.webcat.core.MutableDictionary newValue =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
if ( fileConfigSettingsCache != null )
{
fileConfigSettingsCache.copyFrom( newValue );
}
else
{
fileConfigSettingsCache = newValue;
}
fileConfigSettingsCache.setOwner( this );
setUpdateMutableFields( true );
}
}
else if ( dbValue == null && fileConfigSettingsCache == null )
{
fileConfigSettingsCache =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
fileConfigSettingsCache.setOwner( this );
setUpdateMutableFields( true );
}
return fileConfigSettingsCache;
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>fileConfigSettings</code>
* property.
*
* @param value The new value for this property
*/
public void setFileConfigSettings( org.webcat.core.MutableDictionary value )
{
if (log.isDebugEnabled())
{
log.debug( "setFileConfigSettings("
+ value + ")" );
}
if ( fileConfigSettingsCache == null )
{
fileConfigSettingsCache = value;
value.setHasChanged( false );
fileConfigSettingsRawCache = value.archiveData();
takeStoredValueForKey( fileConfigSettingsRawCache, "fileConfigSettings" );
}
else if ( fileConfigSettingsCache != value ) // ( fileConfigSettingsCache != null )
{
fileConfigSettingsCache.copyFrom( value );
setUpdateMutableFields( true );
}
else // ( fileConfigSettingsCache == non-null value )
{
// no nothing
}
}
// ----------------------------------------------------------
/**
* Clear the value of this object's <code>fileConfigSettings</code>
* property.
*/
public void clearFileConfigSettings()
{
if (log.isDebugEnabled())
{
log.debug( "clearFileConfigSettings()" );
}
takeStoredValueForKey( null, "fileConfigSettings" );
fileConfigSettingsRawCache = null;
fileConfigSettingsCache = null;
}
//-- Local mutable cache --
private org.webcat.core.MutableDictionary globalConfigSettingsCache;
private NSData globalConfigSettingsRawCache;
// ----------------------------------------------------------
/**
* Retrieve this object's <code>globalConfigSettings</code> value.
* @return the value of the attribute
*/
public org.webcat.core.MutableDictionary globalConfigSettings()
{
NSData dbValue =
(NSData)storedValueForKey("globalConfigSettings");
if (globalConfigSettingsRawCache != dbValue)
{
if (dbValue != null && dbValue.equals( globalConfigSettingsRawCache))
{
// They are still equal, so just update the raw cache
globalConfigSettingsRawCache = dbValue;
}
else
{
// Underlying attribute may have changed because
// of a concurrent update through another editing
// context, so throw away current values.
globalConfigSettingsRawCache = dbValue;
org.webcat.core.MutableDictionary newValue =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
if ( globalConfigSettingsCache != null )
{
globalConfigSettingsCache.copyFrom( newValue );
}
else
{
globalConfigSettingsCache = newValue;
}
globalConfigSettingsCache.setOwner( this );
setUpdateMutableFields( true );
}
}
else if ( dbValue == null && globalConfigSettingsCache == null )
{
globalConfigSettingsCache =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
globalConfigSettingsCache.setOwner( this );
setUpdateMutableFields( true );
}
return globalConfigSettingsCache;
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>globalConfigSettings</code>
* property.
*
* @param value The new value for this property
*/
public void setGlobalConfigSettings( org.webcat.core.MutableDictionary value )
{
if (log.isDebugEnabled())
{
log.debug( "setGlobalConfigSettings("
+ value + ")" );
}
if ( globalConfigSettingsCache == null )
{
globalConfigSettingsCache = value;
value.setHasChanged( false );
globalConfigSettingsRawCache = value.archiveData();
takeStoredValueForKey( globalConfigSettingsRawCache, "globalConfigSettings" );
}
else if ( globalConfigSettingsCache != value ) // ( globalConfigSettingsCache != null )
{
globalConfigSettingsCache.copyFrom( value );
setUpdateMutableFields( true );
}
else // ( globalConfigSettingsCache == non-null value )
{
// no nothing
}
}
// ----------------------------------------------------------
/**
* Clear the value of this object's <code>globalConfigSettings</code>
* property.
*/
public void clearGlobalConfigSettings()
{
if (log.isDebugEnabled())
{
log.debug( "clearGlobalConfigSettings()" );
}
takeStoredValueForKey( null, "globalConfigSettings" );
globalConfigSettingsRawCache = null;
globalConfigSettingsCache = null;
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>isConfigFile</code> value.
* @return the value of the attribute
*/
public boolean isConfigFile()
{
Integer returnValue =
(Integer)storedValueForKey( "isConfigFile" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>isConfigFile</code>
* property.
*
* @param value The new value for this property
*/
public void setIsConfigFile( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setIsConfigFile("
+ value + "): was " + isConfigFile() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setIsConfigFileRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>isConfigFile</code> value.
* @return the value of the attribute
*/
public Integer isConfigFileRaw()
{
return (Integer)storedValueForKey( "isConfigFile" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>isConfigFile</code>
* property.
*
* @param value The new value for this property
*/
public void setIsConfigFileRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setIsConfigFileRaw("
+ value + "): was " + isConfigFileRaw() );
}
takeStoredValueForKey( value, "isConfigFile" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>isPublished</code> value.
* @return the value of the attribute
*/
public boolean isPublished()
{
Integer returnValue =
(Integer)storedValueForKey( "isPublished" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>isPublished</code>
* property.
*
* @param value The new value for this property
*/
public void setIsPublished( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setIsPublished("
+ value + "): was " + isPublished() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setIsPublishedRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>isPublished</code> value.
* @return the value of the attribute
*/
public Integer isPublishedRaw()
{
return (Integer)storedValueForKey( "isPublished" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>isPublished</code>
* property.
*
* @param value The new value for this property
*/
public void setIsPublishedRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setIsPublishedRaw("
+ value + "): was " + isPublishedRaw() );
}
takeStoredValueForKey( value, "isPublished" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>lastModified</code> value.
* @return the value of the attribute
*/
public NSTimestamp lastModified()
{
return (NSTimestamp)storedValueForKey( "lastModified" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>lastModified</code>
* property.
*
* @param value The new value for this property
*/
public void setLastModified( NSTimestamp value )
{
if (log.isDebugEnabled())
{
log.debug( "setLastModified("
+ value + "): was " + lastModified() );
}
takeStoredValueForKey( value, "lastModified" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>mainFileName</code> value.
* @return the value of the attribute
*/
public String mainFileName()
{
return (String)storedValueForKey( "mainFileName" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>mainFileName</code>
* property.
*
* @param value The new value for this property
*/
public void setMainFileName( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setMainFileName("
+ value + "): was " + mainFileName() );
}
takeStoredValueForKey( value, "mainFileName" );
}
// ----------------------------------------------------------
/**
* 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" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>subdirName</code> value.
* @return the value of the attribute
*/
public String subdirName()
{
return (String)storedValueForKey( "subdirName" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>subdirName</code>
* property.
*
* @param value The new value for this property
*/
public void setSubdirName( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setSubdirName("
+ value + "): was " + subdirName() );
}
takeStoredValueForKey( value, "subdirName" );
}
// ----------------------------------------------------------
/**
* 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" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>uploadedFileName</code> value.
* @return the value of the attribute
*/
public String uploadedFileName()
{
return (String)storedValueForKey( "uploadedFileName" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>uploadedFileName</code>
* property.
*
* @param value The new value for this property
*/
public void setUploadedFileName( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setUploadedFileName("
+ value + "): was " + uploadedFileName() );
}
takeStoredValueForKey( value, "uploadedFileName" );
}
// ----------------------------------------------------------
/**
* Called just before this object is saved to the database.
*/
public void saveMutables()
{
log.debug("saveMutables()");
if ( configDescriptionCache != null
&& configDescriptionCache.hasChanged() )
{
configDescriptionRawCache = configDescriptionCache.archiveData();
takeStoredValueForKey( configDescriptionRawCache, "configDescription" );
configDescriptionCache.setHasChanged( false );
}
if ( defaultConfigSettingsCache != null
&& defaultConfigSettingsCache.hasChanged() )
{
defaultConfigSettingsRawCache = defaultConfigSettingsCache.archiveData();
takeStoredValueForKey( defaultConfigSettingsRawCache, "defaultConfigSettings" );
defaultConfigSettingsCache.setHasChanged( false );
}
if ( fileConfigSettingsCache != null
&& fileConfigSettingsCache.hasChanged() )
{
fileConfigSettingsRawCache = fileConfigSettingsCache.archiveData();
takeStoredValueForKey( fileConfigSettingsRawCache, "fileConfigSettings" );
fileConfigSettingsCache.setHasChanged( false );
}
if ( globalConfigSettingsCache != null
&& globalConfigSettingsCache.hasChanged() )
{
globalConfigSettingsRawCache = globalConfigSettingsCache.archiveData();
takeStoredValueForKey( globalConfigSettingsRawCache, "globalConfigSettings" );
globalConfigSettingsCache.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()");
configDescriptionCache = null;
configDescriptionRawCache = null;
defaultConfigSettingsCache = null;
defaultConfigSettingsRawCache = null;
fileConfigSettingsCache = null;
fileConfigSettingsRawCache = null;
globalConfigSettingsCache = null;
globalConfigSettingsRawCache = null;
super.flushCaches();
}
// ----------------------------------------------------------
/**
* Called when an owned mutable container object is changed.
*/
public void mutableContainerHasChanged()
{
setUpdateMutableFields( true );
}
// ----------------------------------------------------------
/**
* Retrieve the entity pointed to by the <code>author</code>
* relationship.
* @return the entity in the relationship
*/
public org.webcat.core.User author()
{
return (org.webcat.core.User)storedValueForKey( "author" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>author</code>
* relationship (DO NOT USE--instead, use
* <code>setAuthorRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void setAuthor( org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "setAuthor("
+ value + "): was " + author() );
}
takeStoredValueForKey( value, "author" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>author</code>
* relationship. This method is a type-safe version of
* <code>addObjectToBothSidesOfRelationshipWithKey()</code>.
*
* @param value The new entity to relate to
*/
public void setAuthorRelationship(
org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "setAuthorRelationship("
+ value + "): was " + author() );
}
if ( value == null )
{
org.webcat.core.User object = author();
if ( object != null )
removeObjectFromBothSidesOfRelationshipWithKey( object, "author" );
}
else
{
addObjectToBothSidesOfRelationshipWithKey( value, "author" );
}
}
// ----------------------------------------------------------
/**
* Retrieve the entity pointed to by the <code>language</code>
* relationship.
* @return the entity in the relationship
*/
public org.webcat.core.Language language()
{
return (org.webcat.core.Language)storedValueForKey( "language" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>language</code>
* relationship (DO NOT USE--instead, use
* <code>setLanguageRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void setLanguage( org.webcat.core.Language value )
{
if (log.isDebugEnabled())
{
log.debug( "setLanguage("
+ value + "): was " + language() );
}
takeStoredValueForKey( value, "language" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>language</code>
* relationship. This method is a type-safe version of
* <code>addObjectToBothSidesOfRelationshipWithKey()</code>.
*
* @param value The new entity to relate to
*/
public void setLanguageRelationship(
org.webcat.core.Language value )
{
if (log.isDebugEnabled())
{
log.debug( "setLanguageRelationship("
+ value + "): was " + language() );
}
if ( value == null )
{
org.webcat.core.Language object = language();
if ( object != null )
removeObjectFromBothSidesOfRelationshipWithKey( object, "language" );
}
else
{
addObjectToBothSidesOfRelationshipWithKey( value, "language" );
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>courseOfferings</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.core.CourseOffering> courseOfferings()
{
return (NSArray)storedValueForKey( "courseOfferings" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>courseOfferings</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setCourseOfferings( NSMutableArray<org.webcat.core.CourseOffering> value )
{
if (log.isDebugEnabled())
{
log.debug( "setCourseOfferings("
+ value + "): was " + courseOfferings() );
}
takeStoredValueForKey( value, "courseOfferings" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>courseOfferings</code>
* relationship (DO NOT USE--instead, use
* <code>addToCourseOfferingsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToCourseOfferings( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "addToCourseOfferings("
+ value + "): was " + courseOfferings() );
}
NSMutableArray<org.webcat.core.CourseOffering> array =
(NSMutableArray<org.webcat.core.CourseOffering>)courseOfferings();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>courseOfferings</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromCourseOfferingsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromCourseOfferings( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromCourseOfferings("
+ value + "): was " + courseOfferings() );
}
NSMutableArray<org.webcat.core.CourseOffering> array =
(NSMutableArray<org.webcat.core.CourseOffering>)courseOfferings();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>courseOfferings</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToCourseOfferingsRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "addToCourseOfferingsRelationship("
+ value + "): was " + courseOfferings() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "courseOfferings" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>courseOfferings</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromCourseOfferingsRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromCourseOfferingsRelationship("
+ value + "): was " + courseOfferings() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "courseOfferings" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>courseOfferings</code> relationship.
*
* @return The new entity
*/
public org.webcat.core.CourseOffering createCourseOfferingsRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createCourseOfferingsRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "CourseOffering" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "courseOfferings" );
return (org.webcat.core.CourseOffering)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>courseOfferings</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteCourseOfferingsRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteCourseOfferingsRelationship("
+ value + "): was " + courseOfferings() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "courseOfferings" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>courseOfferings</code> relationship.
*/
public void deleteAllCourseOfferingsRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllCourseOfferingsRelationships(): was "
+ courseOfferings() );
}
for (org.webcat.core.CourseOffering object : courseOfferings())
{
deleteCourseOfferingsRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>steps</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.grader.Step> steps()
{
return (NSArray)storedValueForKey( "steps" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>steps</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setSteps( NSMutableArray<org.webcat.grader.Step> value )
{
if (log.isDebugEnabled())
{
log.debug( "setSteps("
+ value + "): was " + steps() );
}
takeStoredValueForKey( value, "steps" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>steps</code>
* relationship (DO NOT USE--instead, use
* <code>addToStepsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToSteps( org.webcat.grader.Step value )
{
if (log.isDebugEnabled())
{
log.debug( "addToSteps("
+ value + "): was " + steps() );
}
NSMutableArray<org.webcat.grader.Step> array =
(NSMutableArray<org.webcat.grader.Step>)steps();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>steps</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromStepsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromSteps( org.webcat.grader.Step value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromSteps("
+ value + "): was " + steps() );
}
NSMutableArray<org.webcat.grader.Step> array =
(NSMutableArray<org.webcat.grader.Step>)steps();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>steps</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToStepsRelationship( org.webcat.grader.Step value )
{
if (log.isDebugEnabled())
{
log.debug( "addToStepsRelationship("
+ value + "): was " + steps() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "steps" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>steps</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromStepsRelationship( org.webcat.grader.Step value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromStepsRelationship("
+ value + "): was " + steps() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "steps" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>steps</code> relationship.
*
* @return The new entity
*/
public org.webcat.grader.Step createStepsRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createStepsRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "Step" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "steps" );
return (org.webcat.grader.Step)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>steps</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteStepsRelationship( org.webcat.grader.Step value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteStepsRelationship("
+ value + "): was " + steps() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "steps" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>steps</code> relationship.
*/
public void deleteAllStepsRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllStepsRelationships(): was "
+ steps() );
}
for (org.webcat.grader.Step object : steps())
{
deleteStepsRelationship(object);
}
}
// ----------------------------------------------------------
/**
* 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<GradingPlugin> 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<GradingPlugin> 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<GradingPlugin> 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<GradingPlugin> 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 GradingPlugin firstObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier,
NSArray<EOSortOrdering> sortOrderings)
{
NSArray<GradingPlugin> 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 GradingPlugin uniqueObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier) throws EOUtilities.MoreThanOneException
{
NSArray<GradingPlugin> objects =
objectsMatchingQualifier(context, qualifier);
if (objects.size() > 1)
{
String msg = "fetching GradingPlugin";
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<GradingPlugin> 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<GradingPlugin> 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 GradingPlugin 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 GradingPlugin 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<GradingPlugin> 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 GradingPlugin 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 GradingPlugin uniqueObjectMatchingValues(
EOEditingContext context,
NSDictionary<String, Object> keysAndValues)
throws EOUtilities.MoreThanOneException
{
try
{
return (GradingPlugin)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>pluginsAvailableToUser</code>
* fetch specification.
*
* @param context The editing context to use
* @param authorBinding fetch spec parameter
* @return an NSArray of the entities retrieved
*/
public static NSArray<GradingPlugin> pluginsAvailableToUser(
EOEditingContext context,
org.webcat.core.User authorBinding)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("pluginsAvailableToUser", "GradingPlugin");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (authorBinding != null)
{
bindings.setObjectForKey(authorBinding,
"author");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<GradingPlugin> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("pluginsAvailableToUser(ec"
+ ", " + authorBinding
+ "): " + objects);
}
return objects;
}
// ----------------------------------------------------------
/**
* 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(GradingPlugin.class);
}