/*==========================================================================*\
| _User.java
|*-------------------------------------------------------------------------*|
| Created by eogenerator
| DO NOT EDIT. Make changes to User.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
* User.java.
*
* @author Generated by eogenerator
* @version version suppressed to control auto-generation
*/
public abstract class _User
extends org.webcat.core.EOBase
implements org.webcat.core.MutableContainer.MutableContainerOwner
{
//~ Constructors ..........................................................
// ----------------------------------------------------------
/**
* Creates a new _User object.
*/
public _User()
{
super();
}
// ----------------------------------------------------------
/**
* A static factory method for creating a new
* User object given required
* attributes and relationships.
* @param editingContext The context in which the new object will be
* inserted
* @param accessLevelValue
* @param updateMutableFieldsValue
* @param userNameValue
* @param authenticationDomainValue
* @return The newly created object
*/
public static User create(
EOEditingContext editingContext,
byte accessLevelValue,
boolean updateMutableFieldsValue,
String userNameValue,
org.webcat.core.AuthenticationDomain authenticationDomainValue
)
{
User eoObject = (User)
EOUtilities.createAndInsertInstance(
editingContext,
_User.ENTITY_NAME);
eoObject.setAccessLevel(accessLevelValue);
eoObject.setUpdateMutableFields(updateMutableFieldsValue);
eoObject.setUserName(userNameValue);
eoObject.setAuthenticationDomainRelationship(authenticationDomainValue);
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 User localInstance(
EOEditingContext editingContext, User eo)
{
return (eo == null)
? null
: (User)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 User forId(
EOEditingContext ec, int id)
{
User obj = null;
if (id > 0)
{
NSArray<User> 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 User forId(
EOEditingContext ec, String id)
{
return forId(ec, er.extensions.foundation.ERXValueUtilities.intValue(id));
}
//~ Constants (for key names) .............................................
// Attributes ---
public static final String ACCESS_LEVEL_KEY = "accessLevel";
public static final ERXKey<Integer> accessLevel =
new ERXKey<Integer>(ACCESS_LEVEL_KEY);
public static final String EMAIL_KEY = "email";
public static final ERXKey<String> email =
new ERXKey<String>(EMAIL_KEY);
public static final String FIRST_NAME_KEY = "firstName";
public static final ERXKey<String> firstName =
new ERXKey<String>(FIRST_NAME_KEY);
public static final String LAST_NAME_KEY = "lastName";
public static final ERXKey<String> lastName =
new ERXKey<String>(LAST_NAME_KEY);
public static final String PASSWORD_KEY = "password";
public static final ERXKey<String> password =
new ERXKey<String>(PASSWORD_KEY);
public static final String PREFERENCES_KEY = "preferences";
public static final ERXKey<NSData> preferences =
new ERXKey<NSData>(PREFERENCES_KEY);
public static final String UNIVERSITY_ID_NO_KEY = "universityIDNo";
public static final ERXKey<String> universityIDNo =
new ERXKey<String>(UNIVERSITY_ID_NO_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 URL_KEY = "url";
public static final ERXKey<String> url =
new ERXKey<String>(URL_KEY);
public static final String USER_NAME_KEY = "userName";
public static final ERXKey<String> userName =
new ERXKey<String>(USER_NAME_KEY);
// To-one relationships ---
public static final String AUTHENTICATION_DOMAIN_KEY = "authenticationDomain";
public static final ERXKey<org.webcat.core.AuthenticationDomain> authenticationDomain =
new ERXKey<org.webcat.core.AuthenticationDomain>(AUTHENTICATION_DOMAIN_KEY);
public static final String THEME_KEY = "theme";
public static final ERXKey<org.webcat.core.Theme> theme =
new ERXKey<org.webcat.core.Theme>(THEME_KEY);
// To-many relationships ---
public static final String CORE_SELECTIONS_KEY = "coreSelections";
public static final ERXKey<org.webcat.core.CoreSelections> coreSelections =
new ERXKey<org.webcat.core.CoreSelections>(CORE_SELECTIONS_KEY);
public static final String ENROLLED_IN_KEY = "enrolledIn";
public static final ERXKey<org.webcat.core.CourseOffering> enrolledIn =
new ERXKey<org.webcat.core.CourseOffering>(ENROLLED_IN_KEY);
public static final String GRADER_FOR_KEY = "graderFor";
public static final ERXKey<org.webcat.core.CourseOffering> graderFor =
new ERXKey<org.webcat.core.CourseOffering>(GRADER_FOR_KEY);
public static final String PASSWORD_CHANGE_REQUEST_KEY = "passwordChangeRequest";
public static final ERXKey<org.webcat.core.PasswordChangeRequest> passwordChangeRequest =
new ERXKey<org.webcat.core.PasswordChangeRequest>(PASSWORD_CHANGE_REQUEST_KEY);
public static final String SENT_MESSAGES_KEY = "sentMessages";
public static final ERXKey<org.webcat.core.SentMessage> sentMessages =
new ERXKey<org.webcat.core.SentMessage>(SENT_MESSAGES_KEY);
public static final String TEACHING_KEY = "teaching";
public static final ERXKey<org.webcat.core.CourseOffering> teaching =
new ERXKey<org.webcat.core.CourseOffering>(TEACHING_KEY);
public static final String USAGE_PERIODS_KEY = "usagePeriods";
public static final ERXKey<org.webcat.core.UsagePeriod> usagePeriods =
new ERXKey<org.webcat.core.UsagePeriod>(USAGE_PERIODS_KEY);
// Fetch specifications ---
public static final String PARTICIPANTS_FOR_COURSE_FSPEC = "participantsForCourse";
public static final String STAFF_FOR_COURSE_FSPEC = "staffForCourse";
public static final String STUDENTS_FOR_COURSE_FSPEC = "studentsForCourse";
public static final String SYSTEM_ADMINS_FSPEC = "systemAdmins";
public static final String USER_WITH_DOMAIN_AND_EMAIL_FSPEC = "userWithDomainAndEmail";
public static final String USER_WITH_DOMAIN_AND_NAME_FSPEC = "userWithDomainAndName";
public static final String USER_WITH_NAME_FSPEC = "userWithName";
public static final String ENTITY_NAME = "User";
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 User localInstance(EOEditingContext editingContext)
{
return (User)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>accessLevel</code> value.
* @return the value of the attribute
*/
public byte accessLevel()
{
Integer returnValue =
(Integer)storedValueForKey( "accessLevel" );
return ( returnValue == null )
? 0
: returnValue.byteValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>accessLevel</code>
* property.
*
* @param value The new value for this property
*/
public void setAccessLevel( byte value )
{
if (log.isDebugEnabled())
{
log.debug( "setAccessLevel("
+ value + "): was " + accessLevel() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value );
setAccessLevelRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>accessLevel</code> value.
* @return the value of the attribute
*/
public Integer accessLevelRaw()
{
return (Integer)storedValueForKey( "accessLevel" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>accessLevel</code>
* property.
*
* @param value The new value for this property
*/
public void setAccessLevelRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setAccessLevelRaw("
+ value + "): was " + accessLevelRaw() );
}
takeStoredValueForKey( value, "accessLevel" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>email</code> value.
* @return the value of the attribute
*/
public String email()
{
return (String)storedValueForKey( "email" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>email</code>
* property.
*
* @param value The new value for this property
*/
public void setEmail( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setEmail("
+ value + "): was " + email() );
}
takeStoredValueForKey( value, "email" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>firstName</code> value.
* @return the value of the attribute
*/
public String firstName()
{
return (String)storedValueForKey( "firstName" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>firstName</code>
* property.
*
* @param value The new value for this property
*/
public void setFirstName( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setFirstName("
+ value + "): was " + firstName() );
}
takeStoredValueForKey( value, "firstName" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>lastName</code> value.
* @return the value of the attribute
*/
public String lastName()
{
return (String)storedValueForKey( "lastName" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>lastName</code>
* property.
*
* @param value The new value for this property
*/
public void setLastName( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setLastName("
+ value + "): was " + lastName() );
}
takeStoredValueForKey( value, "lastName" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>password</code> value.
* @return the value of the attribute
*/
public String password()
{
return (String)storedValueForKey( "password" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>password</code>
* property.
*
* @param value The new value for this property
*/
public void setPassword( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setPassword("
+ value + "): was " + password() );
}
takeStoredValueForKey( value, "password" );
}
//-- Local mutable cache --
private org.webcat.core.MutableDictionary preferencesCache;
private NSData preferencesRawCache;
// ----------------------------------------------------------
/**
* Retrieve this object's <code>preferences</code> value.
* @return the value of the attribute
*/
public org.webcat.core.MutableDictionary preferences()
{
NSData dbValue =
(NSData)storedValueForKey("preferences");
if (preferencesRawCache != dbValue)
{
if (dbValue != null && dbValue.equals( preferencesRawCache))
{
// They are still equal, so just update the raw cache
preferencesRawCache = dbValue;
}
else
{
// Underlying attribute may have changed because
// of a concurrent update through another editing
// context, so throw away current values.
preferencesRawCache = dbValue;
org.webcat.core.MutableDictionary newValue =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
if ( preferencesCache != null )
{
preferencesCache.copyFrom( newValue );
}
else
{
preferencesCache = newValue;
}
preferencesCache.setOwner( this );
setUpdateMutableFields( true );
}
}
else if ( dbValue == null && preferencesCache == null )
{
preferencesCache =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
preferencesCache.setOwner( this );
setUpdateMutableFields( true );
}
return preferencesCache;
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>preferences</code>
* property.
*
* @param value The new value for this property
*/
public void setPreferences( org.webcat.core.MutableDictionary value )
{
if (log.isDebugEnabled())
{
log.debug( "setPreferences("
+ value + ")" );
}
if ( preferencesCache == null )
{
preferencesCache = value;
value.setHasChanged( false );
preferencesRawCache = value.archiveData();
takeStoredValueForKey( preferencesRawCache, "preferences" );
}
else if ( preferencesCache != value ) // ( preferencesCache != null )
{
preferencesCache.copyFrom( value );
setUpdateMutableFields( true );
}
else // ( preferencesCache == non-null value )
{
// no nothing
}
}
// ----------------------------------------------------------
/**
* Clear the value of this object's <code>preferences</code>
* property.
*/
public void clearPreferences()
{
if (log.isDebugEnabled())
{
log.debug( "clearPreferences()" );
}
takeStoredValueForKey( null, "preferences" );
preferencesRawCache = null;
preferencesCache = null;
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>universityIDNo</code> value.
* @return the value of the attribute
*/
public String universityIDNo()
{
return (String)storedValueForKey( "universityIDNo" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>universityIDNo</code>
* property.
*
* @param value The new value for this property
*/
public void setUniversityIDNo( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setUniversityIDNo("
+ value + "): was " + universityIDNo() );
}
takeStoredValueForKey( value, "universityIDNo" );
}
// ----------------------------------------------------------
/**
* 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>url</code> value.
* @return the value of the attribute
*/
public String url()
{
return (String)storedValueForKey( "url" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>url</code>
* property.
*
* @param value The new value for this property
*/
public void setUrl( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setUrl("
+ value + "): was " + url() );
}
takeStoredValueForKey( value, "url" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>userName</code> value.
* @return the value of the attribute
*/
public String userName()
{
return (String)storedValueForKey( "userName" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>userName</code>
* property.
*
* @param value The new value for this property
*/
public void setUserName( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setUserName("
+ value + "): was " + userName() );
}
takeStoredValueForKey( value, "userName" );
}
// ----------------------------------------------------------
/**
* Called just before this object is saved to the database.
*/
public void saveMutables()
{
log.debug("saveMutables()");
if ( preferencesCache != null
&& preferencesCache.hasChanged() )
{
preferencesRawCache = preferencesCache.archiveData();
takeStoredValueForKey( preferencesRawCache, "preferences" );
preferencesCache.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()");
preferencesCache = null;
preferencesRawCache = 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>authenticationDomain</code>
* relationship.
* @return the entity in the relationship
*/
public org.webcat.core.AuthenticationDomain authenticationDomain()
{
return (org.webcat.core.AuthenticationDomain)storedValueForKey( "authenticationDomain" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>authenticationDomain</code>
* relationship (DO NOT USE--instead, use
* <code>setAuthenticationDomainRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void setAuthenticationDomain( org.webcat.core.AuthenticationDomain value )
{
if (log.isDebugEnabled())
{
log.debug( "setAuthenticationDomain("
+ value + "): was " + authenticationDomain() );
}
takeStoredValueForKey( value, "authenticationDomain" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>authenticationDomain</code>
* relationship. This method is a type-safe version of
* <code>addObjectToBothSidesOfRelationshipWithKey()</code>.
*
* @param value The new entity to relate to
*/
public void setAuthenticationDomainRelationship(
org.webcat.core.AuthenticationDomain value )
{
if (log.isDebugEnabled())
{
log.debug( "setAuthenticationDomainRelationship("
+ value + "): was " + authenticationDomain() );
}
if ( value == null )
{
org.webcat.core.AuthenticationDomain object = authenticationDomain();
if ( object != null )
removeObjectFromBothSidesOfRelationshipWithKey( object, "authenticationDomain" );
}
else
{
addObjectToBothSidesOfRelationshipWithKey( value, "authenticationDomain" );
}
}
// ----------------------------------------------------------
/**
* Retrieve the entity pointed to by the <code>theme</code>
* relationship.
* @return the entity in the relationship
*/
public org.webcat.core.Theme theme()
{
return (org.webcat.core.Theme)storedValueForKey( "theme" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>theme</code>
* relationship (DO NOT USE--instead, use
* <code>setThemeRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void setTheme( org.webcat.core.Theme value )
{
if (log.isDebugEnabled())
{
log.debug( "setTheme("
+ value + "): was " + theme() );
}
takeStoredValueForKey( value, "theme" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>theme</code>
* relationship. This method is a type-safe version of
* <code>addObjectToBothSidesOfRelationshipWithKey()</code>.
*
* @param value The new entity to relate to
*/
public void setThemeRelationship(
org.webcat.core.Theme value )
{
if (log.isDebugEnabled())
{
log.debug( "setThemeRelationship("
+ value + "): was " + theme() );
}
if ( value == null )
{
org.webcat.core.Theme object = theme();
if ( object != null )
removeObjectFromBothSidesOfRelationshipWithKey( object, "theme" );
}
else
{
addObjectToBothSidesOfRelationshipWithKey( value, "theme" );
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>coreSelections</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.core.CoreSelections> coreSelections()
{
return (NSArray)storedValueForKey( "coreSelections" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>coreSelections</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setCoreSelections( NSMutableArray<org.webcat.core.CoreSelections> value )
{
if (log.isDebugEnabled())
{
log.debug( "setCoreSelections("
+ value + "): was " + coreSelections() );
}
takeStoredValueForKey( value, "coreSelections" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>coreSelections</code>
* relationship (DO NOT USE--instead, use
* <code>addToCoreSelectionsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToCoreSelections( org.webcat.core.CoreSelections value )
{
if (log.isDebugEnabled())
{
log.debug( "addToCoreSelections("
+ value + "): was " + coreSelections() );
}
NSMutableArray<org.webcat.core.CoreSelections> array =
(NSMutableArray<org.webcat.core.CoreSelections>)coreSelections();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>coreSelections</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromCoreSelectionsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromCoreSelections( org.webcat.core.CoreSelections value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromCoreSelections("
+ value + "): was " + coreSelections() );
}
NSMutableArray<org.webcat.core.CoreSelections> array =
(NSMutableArray<org.webcat.core.CoreSelections>)coreSelections();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>coreSelections</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToCoreSelectionsRelationship( org.webcat.core.CoreSelections value )
{
if (log.isDebugEnabled())
{
log.debug( "addToCoreSelectionsRelationship("
+ value + "): was " + coreSelections() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "coreSelections" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>coreSelections</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromCoreSelectionsRelationship( org.webcat.core.CoreSelections value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromCoreSelectionsRelationship("
+ value + "): was " + coreSelections() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "coreSelections" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>coreSelections</code> relationship.
*
* @return The new entity
*/
public org.webcat.core.CoreSelections createCoreSelectionsRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createCoreSelectionsRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "CoreSelections" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "coreSelections" );
return (org.webcat.core.CoreSelections)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>coreSelections</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteCoreSelectionsRelationship( org.webcat.core.CoreSelections value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteCoreSelectionsRelationship("
+ value + "): was " + coreSelections() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "coreSelections" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>coreSelections</code> relationship.
*/
public void deleteAllCoreSelectionsRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllCoreSelectionsRelationships(): was "
+ coreSelections() );
}
for (org.webcat.core.CoreSelections object : coreSelections())
{
deleteCoreSelectionsRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>enrolledIn</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.core.CourseOffering> enrolledIn()
{
return (NSArray)storedValueForKey( "enrolledIn" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>enrolledIn</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setEnrolledIn( NSMutableArray<org.webcat.core.CourseOffering> value )
{
if (log.isDebugEnabled())
{
log.debug( "setEnrolledIn("
+ value + "): was " + enrolledIn() );
}
takeStoredValueForKey( value, "enrolledIn" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>enrolledIn</code>
* relationship (DO NOT USE--instead, use
* <code>addToEnrolledInRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToEnrolledIn( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "addToEnrolledIn("
+ value + "): was " + enrolledIn() );
}
NSMutableArray<org.webcat.core.CourseOffering> array =
(NSMutableArray<org.webcat.core.CourseOffering>)enrolledIn();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>enrolledIn</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromEnrolledInRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromEnrolledIn( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromEnrolledIn("
+ value + "): was " + enrolledIn() );
}
NSMutableArray<org.webcat.core.CourseOffering> array =
(NSMutableArray<org.webcat.core.CourseOffering>)enrolledIn();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>enrolledIn</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToEnrolledInRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "addToEnrolledInRelationship("
+ value + "): was " + enrolledIn() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "enrolledIn" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>enrolledIn</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromEnrolledInRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromEnrolledInRelationship("
+ value + "): was " + enrolledIn() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "enrolledIn" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>enrolledIn</code> relationship.
*
* @return The new entity
*/
public org.webcat.core.CourseOffering createEnrolledInRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createEnrolledInRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "CourseOffering" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "enrolledIn" );
return (org.webcat.core.CourseOffering)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>enrolledIn</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteEnrolledInRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteEnrolledInRelationship("
+ value + "): was " + enrolledIn() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "enrolledIn" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>enrolledIn</code> relationship.
*/
public void deleteAllEnrolledInRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllEnrolledInRelationships(): was "
+ enrolledIn() );
}
for (org.webcat.core.CourseOffering object : enrolledIn())
{
deleteEnrolledInRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>graderFor</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.core.CourseOffering> graderFor()
{
return (NSArray)storedValueForKey( "graderFor" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>graderFor</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setGraderFor( NSMutableArray<org.webcat.core.CourseOffering> value )
{
if (log.isDebugEnabled())
{
log.debug( "setGraderFor("
+ value + "): was " + graderFor() );
}
takeStoredValueForKey( value, "graderFor" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>graderFor</code>
* relationship (DO NOT USE--instead, use
* <code>addToGraderForRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToGraderFor( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "addToGraderFor("
+ value + "): was " + graderFor() );
}
NSMutableArray<org.webcat.core.CourseOffering> array =
(NSMutableArray<org.webcat.core.CourseOffering>)graderFor();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>graderFor</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromGraderForRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromGraderFor( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromGraderFor("
+ value + "): was " + graderFor() );
}
NSMutableArray<org.webcat.core.CourseOffering> array =
(NSMutableArray<org.webcat.core.CourseOffering>)graderFor();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>graderFor</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToGraderForRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "addToGraderForRelationship("
+ value + "): was " + graderFor() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "graderFor" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>graderFor</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromGraderForRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromGraderForRelationship("
+ value + "): was " + graderFor() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "graderFor" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>graderFor</code> relationship.
*
* @return The new entity
*/
public org.webcat.core.CourseOffering createGraderForRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createGraderForRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "CourseOffering" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "graderFor" );
return (org.webcat.core.CourseOffering)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>graderFor</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteGraderForRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteGraderForRelationship("
+ value + "): was " + graderFor() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "graderFor" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>graderFor</code> relationship.
*/
public void deleteAllGraderForRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllGraderForRelationships(): was "
+ graderFor() );
}
for (org.webcat.core.CourseOffering object : graderFor())
{
deleteGraderForRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>passwordChangeRequest</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.core.PasswordChangeRequest> passwordChangeRequest()
{
return (NSArray)storedValueForKey( "passwordChangeRequest" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>passwordChangeRequest</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setPasswordChangeRequest( NSMutableArray<org.webcat.core.PasswordChangeRequest> value )
{
if (log.isDebugEnabled())
{
log.debug( "setPasswordChangeRequest("
+ value + "): was " + passwordChangeRequest() );
}
takeStoredValueForKey( value, "passwordChangeRequest" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>passwordChangeRequest</code>
* relationship (DO NOT USE--instead, use
* <code>addToPasswordChangeRequestRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToPasswordChangeRequest( org.webcat.core.PasswordChangeRequest value )
{
if (log.isDebugEnabled())
{
log.debug( "addToPasswordChangeRequest("
+ value + "): was " + passwordChangeRequest() );
}
NSMutableArray<org.webcat.core.PasswordChangeRequest> array =
(NSMutableArray<org.webcat.core.PasswordChangeRequest>)passwordChangeRequest();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>passwordChangeRequest</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromPasswordChangeRequestRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromPasswordChangeRequest( org.webcat.core.PasswordChangeRequest value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromPasswordChangeRequest("
+ value + "): was " + passwordChangeRequest() );
}
NSMutableArray<org.webcat.core.PasswordChangeRequest> array =
(NSMutableArray<org.webcat.core.PasswordChangeRequest>)passwordChangeRequest();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>passwordChangeRequest</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToPasswordChangeRequestRelationship( org.webcat.core.PasswordChangeRequest value )
{
if (log.isDebugEnabled())
{
log.debug( "addToPasswordChangeRequestRelationship("
+ value + "): was " + passwordChangeRequest() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "passwordChangeRequest" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>passwordChangeRequest</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromPasswordChangeRequestRelationship( org.webcat.core.PasswordChangeRequest value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromPasswordChangeRequestRelationship("
+ value + "): was " + passwordChangeRequest() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "passwordChangeRequest" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>passwordChangeRequest</code> relationship.
*
* @return The new entity
*/
public org.webcat.core.PasswordChangeRequest createPasswordChangeRequestRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createPasswordChangeRequestRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "PasswordChangeRequest" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "passwordChangeRequest" );
return (org.webcat.core.PasswordChangeRequest)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>passwordChangeRequest</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deletePasswordChangeRequestRelationship( org.webcat.core.PasswordChangeRequest value )
{
if (log.isDebugEnabled())
{
log.debug( "deletePasswordChangeRequestRelationship("
+ value + "): was " + passwordChangeRequest() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "passwordChangeRequest" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>passwordChangeRequest</code> relationship.
*/
public void deleteAllPasswordChangeRequestRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllPasswordChangeRequestRelationships(): was "
+ passwordChangeRequest() );
}
for (org.webcat.core.PasswordChangeRequest object : passwordChangeRequest())
{
deletePasswordChangeRequestRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>sentMessages</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.core.SentMessage> sentMessages()
{
return (NSArray)storedValueForKey( "sentMessages" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>sentMessages</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setSentMessages( NSMutableArray<org.webcat.core.SentMessage> value )
{
if (log.isDebugEnabled())
{
log.debug( "setSentMessages("
+ value + "): was " + sentMessages() );
}
takeStoredValueForKey( value, "sentMessages" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>sentMessages</code>
* relationship (DO NOT USE--instead, use
* <code>addToSentMessagesRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToSentMessages( org.webcat.core.SentMessage value )
{
if (log.isDebugEnabled())
{
log.debug( "addToSentMessages("
+ value + "): was " + sentMessages() );
}
NSMutableArray<org.webcat.core.SentMessage> array =
(NSMutableArray<org.webcat.core.SentMessage>)sentMessages();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>sentMessages</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromSentMessagesRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromSentMessages( org.webcat.core.SentMessage value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromSentMessages("
+ value + "): was " + sentMessages() );
}
NSMutableArray<org.webcat.core.SentMessage> array =
(NSMutableArray<org.webcat.core.SentMessage>)sentMessages();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>sentMessages</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToSentMessagesRelationship( org.webcat.core.SentMessage value )
{
if (log.isDebugEnabled())
{
log.debug( "addToSentMessagesRelationship("
+ value + "): was " + sentMessages() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "sentMessages" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>sentMessages</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromSentMessagesRelationship( org.webcat.core.SentMessage value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromSentMessagesRelationship("
+ value + "): was " + sentMessages() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "sentMessages" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>sentMessages</code> relationship.
*
* @return The new entity
*/
public org.webcat.core.SentMessage createSentMessagesRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createSentMessagesRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "SentMessage" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "sentMessages" );
return (org.webcat.core.SentMessage)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>sentMessages</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteSentMessagesRelationship( org.webcat.core.SentMessage value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteSentMessagesRelationship("
+ value + "): was " + sentMessages() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "sentMessages" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>sentMessages</code> relationship.
*/
public void deleteAllSentMessagesRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllSentMessagesRelationships(): was "
+ sentMessages() );
}
for (org.webcat.core.SentMessage object : sentMessages())
{
deleteSentMessagesRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>teaching</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.core.CourseOffering> teaching()
{
return (NSArray)storedValueForKey( "teaching" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>teaching</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setTeaching( NSMutableArray<org.webcat.core.CourseOffering> value )
{
if (log.isDebugEnabled())
{
log.debug( "setTeaching("
+ value + "): was " + teaching() );
}
takeStoredValueForKey( value, "teaching" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>teaching</code>
* relationship (DO NOT USE--instead, use
* <code>addToTeachingRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToTeaching( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "addToTeaching("
+ value + "): was " + teaching() );
}
NSMutableArray<org.webcat.core.CourseOffering> array =
(NSMutableArray<org.webcat.core.CourseOffering>)teaching();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>teaching</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromTeachingRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromTeaching( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromTeaching("
+ value + "): was " + teaching() );
}
NSMutableArray<org.webcat.core.CourseOffering> array =
(NSMutableArray<org.webcat.core.CourseOffering>)teaching();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>teaching</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToTeachingRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "addToTeachingRelationship("
+ value + "): was " + teaching() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "teaching" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>teaching</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromTeachingRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromTeachingRelationship("
+ value + "): was " + teaching() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "teaching" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>teaching</code> relationship.
*
* @return The new entity
*/
public org.webcat.core.CourseOffering createTeachingRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createTeachingRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "CourseOffering" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "teaching" );
return (org.webcat.core.CourseOffering)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>teaching</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteTeachingRelationship( org.webcat.core.CourseOffering value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteTeachingRelationship("
+ value + "): was " + teaching() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "teaching" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>teaching</code> relationship.
*/
public void deleteAllTeachingRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllTeachingRelationships(): was "
+ teaching() );
}
for (org.webcat.core.CourseOffering object : teaching())
{
deleteTeachingRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>usagePeriods</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.core.UsagePeriod> usagePeriods()
{
return (NSArray)storedValueForKey( "usagePeriods" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>usagePeriods</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setUsagePeriods( NSMutableArray<org.webcat.core.UsagePeriod> value )
{
if (log.isDebugEnabled())
{
log.debug( "setUsagePeriods("
+ value + "): was " + usagePeriods() );
}
takeStoredValueForKey( value, "usagePeriods" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>usagePeriods</code>
* relationship (DO NOT USE--instead, use
* <code>addToUsagePeriodsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToUsagePeriods( org.webcat.core.UsagePeriod value )
{
if (log.isDebugEnabled())
{
log.debug( "addToUsagePeriods("
+ value + "): was " + usagePeriods() );
}
NSMutableArray<org.webcat.core.UsagePeriod> array =
(NSMutableArray<org.webcat.core.UsagePeriod>)usagePeriods();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>usagePeriods</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromUsagePeriodsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromUsagePeriods( org.webcat.core.UsagePeriod value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromUsagePeriods("
+ value + "): was " + usagePeriods() );
}
NSMutableArray<org.webcat.core.UsagePeriod> array =
(NSMutableArray<org.webcat.core.UsagePeriod>)usagePeriods();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>usagePeriods</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToUsagePeriodsRelationship( org.webcat.core.UsagePeriod value )
{
if (log.isDebugEnabled())
{
log.debug( "addToUsagePeriodsRelationship("
+ value + "): was " + usagePeriods() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "usagePeriods" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>usagePeriods</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromUsagePeriodsRelationship( org.webcat.core.UsagePeriod value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromUsagePeriodsRelationship("
+ value + "): was " + usagePeriods() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "usagePeriods" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>usagePeriods</code> relationship.
*
* @return The new entity
*/
public org.webcat.core.UsagePeriod createUsagePeriodsRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createUsagePeriodsRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "UsagePeriod" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "usagePeriods" );
return (org.webcat.core.UsagePeriod)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>usagePeriods</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteUsagePeriodsRelationship( org.webcat.core.UsagePeriod value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteUsagePeriodsRelationship("
+ value + "): was " + usagePeriods() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "usagePeriods" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>usagePeriods</code> relationship.
*/
public void deleteAllUsagePeriodsRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllUsagePeriodsRelationships(): was "
+ usagePeriods() );
}
for (org.webcat.core.UsagePeriod object : usagePeriods())
{
deleteUsagePeriodsRelationship(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<User> 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<User> 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<User> 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<User> 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 User firstObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier,
NSArray<EOSortOrdering> sortOrderings)
{
NSArray<User> 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 User uniqueObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier) throws EOUtilities.MoreThanOneException
{
NSArray<User> objects =
objectsMatchingQualifier(context, qualifier);
if (objects.size() > 1)
{
String msg = "fetching User";
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<User> 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<User> 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 User 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 User 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<User> 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 User 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 User uniqueObjectMatchingValues(
EOEditingContext context,
NSDictionary<String, Object> keysAndValues)
throws EOUtilities.MoreThanOneException
{
try
{
return (User)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>participantsForCourse</code>
* fetch specification.
*
* @param context The editing context to use
* @param accessLevelBinding fetch spec parameter
* @param courseOfferingBinding fetch spec parameter
* @return an NSArray of the entities retrieved
*/
public static NSArray<User> participantsForCourse(
EOEditingContext context,
Integer accessLevelBinding,
org.webcat.core.CourseOffering courseOfferingBinding)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("participantsForCourse", "User");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (accessLevelBinding != null)
{
bindings.setObjectForKey(accessLevelBinding,
"accessLevel");
}
if (courseOfferingBinding != null)
{
bindings.setObjectForKey(courseOfferingBinding,
"courseOffering");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<User> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("participantsForCourse(ec"
+ ", " + accessLevelBinding
+ ", " + courseOfferingBinding
+ "): " + objects);
}
return objects;
}
// ----------------------------------------------------------
/**
* Retrieve objects according to the <code>staffForCourse</code>
* fetch specification.
*
* @param context The editing context to use
* @param courseOfferingBinding fetch spec parameter
* @return an NSArray of the entities retrieved
*/
public static NSArray<User> staffForCourse(
EOEditingContext context,
org.webcat.core.CourseOffering courseOfferingBinding)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("staffForCourse", "User");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (courseOfferingBinding != null)
{
bindings.setObjectForKey(courseOfferingBinding,
"courseOffering");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<User> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("staffForCourse(ec"
+ ", " + courseOfferingBinding
+ "): " + objects);
}
return objects;
}
// ----------------------------------------------------------
/**
* Retrieve objects according to the <code>studentsForCourse</code>
* fetch specification.
*
* @param context The editing context to use
* @param courseOfferingBinding fetch spec parameter
* @return an NSArray of the entities retrieved
*/
public static NSArray<User> studentsForCourse(
EOEditingContext context,
org.webcat.core.CourseOffering courseOfferingBinding)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("studentsForCourse", "User");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (courseOfferingBinding != null)
{
bindings.setObjectForKey(courseOfferingBinding,
"courseOffering");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<User> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("studentsForCourse(ec"
+ ", " + courseOfferingBinding
+ "): " + objects);
}
return objects;
}
// ----------------------------------------------------------
/**
* Retrieve objects according to the <code>systemAdmins</code>
* fetch specification.
*
* @param context The editing context to use
* @return an NSArray of the entities retrieved
*/
public static NSArray<User> systemAdmins(
EOEditingContext context)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("systemAdmins", "User");
NSArray<User> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("systemAdmins(ec"
+ "): " + objects);
}
return objects;
}
// ----------------------------------------------------------
/**
* Retrieve an object according to the <code>userWithDomainAndEmail</code>
* fetch specification. If more than one object is found, an exception is
* thrown.
*
* @param context The editing context to use
* @param domainBinding fetch spec parameter
* @param emailBinding fetch spec parameter
* @return the object retrieved, or null if one was not found
* @throws EOUtilities.MoreThanOneException if more than one object is found
*/
public static User userWithDomainAndEmail(
EOEditingContext context,
org.webcat.core.AuthenticationDomain domainBinding,
String emailBinding
) throws EOUtilities.MoreThanOneException
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("userWithDomainAndEmail", "User");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (domainBinding != null)
{
bindings.setObjectForKey(domainBinding,
"domain");
}
if (emailBinding != null)
{
bindings.setObjectForKey(emailBinding,
"email");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<User> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug( "userWithDomainAndEmail(ec"
+ ", " + domainBinding
+ ", " + emailBinding
+ "): " + objects );
}
if ( objects.count() == 0 )
{
return null;
}
else if ( objects.count() > 1 )
{
String msg = "fetching User using userWithDomainAndEmail";
try
{
if (bindings.size() != 0)
{
msg += " where bindings = " + bindings;
}
msg += ", result = " + objects;
}
catch (Exception e)
{
log.error("Exception building MoreThanOneException message, "
+ "contents so far: " + msg, e);
}
throw new EOUtilities.MoreThanOneException(msg);
}
else
{
return objects.objectAtIndex(0);
}
}
// ----------------------------------------------------------
/**
* Retrieve an object according to the <code>userWithDomainAndName</code>
* fetch specification. If more than one object is found, an exception is
* thrown.
*
* @param context The editing context to use
* @param domainBinding fetch spec parameter
* @param userNameBinding fetch spec parameter
* @return the object retrieved, or null if one was not found
* @throws EOUtilities.MoreThanOneException if more than one object is found
*/
public static User userWithDomainAndName(
EOEditingContext context,
org.webcat.core.AuthenticationDomain domainBinding,
String userNameBinding
) throws EOUtilities.MoreThanOneException
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("userWithDomainAndName", "User");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (domainBinding != null)
{
bindings.setObjectForKey(domainBinding,
"domain");
}
if (userNameBinding != null)
{
bindings.setObjectForKey(userNameBinding,
"userName");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<User> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug( "userWithDomainAndName(ec"
+ ", " + domainBinding
+ ", " + userNameBinding
+ "): " + objects );
}
if ( objects.count() == 0 )
{
return null;
}
else if ( objects.count() > 1 )
{
String msg = "fetching User using userWithDomainAndName";
try
{
if (bindings.size() != 0)
{
msg += " where bindings = " + bindings;
}
msg += ", result = " + objects;
}
catch (Exception e)
{
log.error("Exception building MoreThanOneException message, "
+ "contents so far: " + msg, e);
}
throw new EOUtilities.MoreThanOneException(msg);
}
else
{
return objects.objectAtIndex(0);
}
}
// ----------------------------------------------------------
/**
* Retrieve an object according to the <code>userWithName</code>
* fetch specification. If more than one object is found, an exception is
* thrown.
*
* @param context The editing context to use
* @param nameBinding fetch spec parameter
* @return the object retrieved, or null if one was not found
* @throws EOUtilities.MoreThanOneException if more than one object is found
*/
public static User userWithName(
EOEditingContext context,
String nameBinding
) throws EOUtilities.MoreThanOneException
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("userWithName", "User");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (nameBinding != null)
{
bindings.setObjectForKey(nameBinding,
"name");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<User> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug( "userWithName(ec"
+ ", " + nameBinding
+ "): " + objects );
}
if ( objects.count() == 0 )
{
return null;
}
else if ( objects.count() > 1 )
{
String msg = "fetching User using userWithName";
try
{
if (bindings.size() != 0)
{
msg += " where bindings = " + bindings;
}
msg += ", result = " + objects;
}
catch (Exception e)
{
log.error("Exception building MoreThanOneException message, "
+ "contents so far: " + msg, e);
}
throw new EOUtilities.MoreThanOneException(msg);
}
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(User.class);
}