/*==========================================================================*\
| _SubmissionResult.java
|*-------------------------------------------------------------------------*|
| Created by eogenerator
| DO NOT EDIT. Make changes to SubmissionResult.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
* SubmissionResult.java.
*
* @author Generated by eogenerator
* @version version suppressed to control auto-generation
*/
public abstract class _SubmissionResult
extends org.webcat.core.EOBase
implements org.webcat.core.MutableContainer.MutableContainerOwner
, org.webcat.core.MigratoryAttributeOwner
{
//~ Constructors ..........................................................
// ----------------------------------------------------------
/**
* Creates a new _SubmissionResult object.
*/
public _SubmissionResult()
{
super();
}
// ----------------------------------------------------------
/**
* A static factory method for creating a new
* SubmissionResult object given required
* attributes and relationships.
* @param editingContext The context in which the new object will be
* inserted
* @param updateMutableFieldsValue
* @return The newly created object
*/
public static SubmissionResult create(
EOEditingContext editingContext,
boolean updateMutableFieldsValue
)
{
SubmissionResult eoObject = (SubmissionResult)
EOUtilities.createAndInsertInstance(
editingContext,
_SubmissionResult.ENTITY_NAME);
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 SubmissionResult localInstance(
EOEditingContext editingContext, SubmissionResult eo)
{
return (eo == null)
? null
: (SubmissionResult)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 SubmissionResult forId(
EOEditingContext ec, int id)
{
SubmissionResult obj = null;
if (id > 0)
{
NSArray<SubmissionResult> 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 SubmissionResult forId(
EOEditingContext ec, String id)
{
return forId(ec, er.extensions.foundation.ERXValueUtilities.intValue(id));
}
//~ Constants (for key names) .............................................
// Attributes ---
public static final String ACCUMULATED_SAVED_PROPERTIES_KEY = "accumulatedSavedProperties";
public static final ERXKey<NSData> accumulatedSavedProperties =
new ERXKey<NSData>(ACCUMULATED_SAVED_PROPERTIES_KEY);
public static final String COMMENT_FORMAT_KEY = "commentFormat";
public static final ERXKey<Integer> commentFormat =
new ERXKey<Integer>(COMMENT_FORMAT_KEY);
public static final String COMMENTS_KEY = "comments";
public static final ERXKey<String> comments =
new ERXKey<String>(COMMENTS_KEY);
public static final String CORRECTNESS_SCORE_KEY = "correctnessScore";
public static final ERXKey<Double> correctnessScore =
new ERXKey<Double>(CORRECTNESS_SCORE_KEY);
public static final String IS_MOST_RECENT_KEY = "isMostRecent";
public static final ERXKey<Integer> isMostRecent =
new ERXKey<Integer>(IS_MOST_RECENT_KEY);
public static final String LAST_UPDATED_KEY = "lastUpdated";
public static final ERXKey<NSTimestamp> lastUpdated =
new ERXKey<NSTimestamp>(LAST_UPDATED_KEY);
public static final String STAFF_REPORT_STYLE_VERSION_KEY = "staffReportStyleVersion";
public static final ERXKey<Integer> staffReportStyleVersion =
new ERXKey<Integer>(STAFF_REPORT_STYLE_VERSION_KEY);
public static final String STAT_ELEMENTS_LABEL_KEY = "statElementsLabel";
public static final ERXKey<String> statElementsLabel =
new ERXKey<String>(STAT_ELEMENTS_LABEL_KEY);
public static final String STATUS_KEY = "status";
public static final ERXKey<Integer> status =
new ERXKey<Integer>(STATUS_KEY);
public static final String STUDENT_REPORT_STYLE_VERSION_KEY = "studentReportStyleVersion";
public static final ERXKey<Integer> studentReportStyleVersion =
new ERXKey<Integer>(STUDENT_REPORT_STYLE_VERSION_KEY);
public static final String TA_SCORE_KEY = "taScore";
public static final ERXKey<Double> taScore =
new ERXKey<Double>(TA_SCORE_KEY);
public static final String TOOL_SCORE_KEY = "toolScore";
public static final ERXKey<Double> toolScore =
new ERXKey<Double>(TOOL_SCORE_KEY);
public static final String UPDATE_MUTABLE_FIELDS_KEY = "updateMutableFields";
public static final ERXKey<Integer> updateMutableFields =
new ERXKey<Integer>(UPDATE_MUTABLE_FIELDS_KEY);
// To-one relationships ---
// To-many relationships ---
public static final String RESULT_FILES_KEY = "resultFiles";
public static final ERXKey<org.webcat.grader.ResultFile> resultFiles =
new ERXKey<org.webcat.grader.ResultFile>(RESULT_FILES_KEY);
public static final String RESULT_OUTCOMES_KEY = "resultOutcomes";
public static final ERXKey<org.webcat.grader.ResultOutcome> resultOutcomes =
new ERXKey<org.webcat.grader.ResultOutcome>(RESULT_OUTCOMES_KEY);
public static final String SUBMISSION_FILE_STATS_KEY = "submissionFileStats";
public static final ERXKey<org.webcat.grader.SubmissionFileStats> submissionFileStats =
new ERXKey<org.webcat.grader.SubmissionFileStats>(SUBMISSION_FILE_STATS_KEY);
public static final String SUBMISSIONS_KEY = "submissions";
public static final ERXKey<org.webcat.grader.Submission> submissions =
new ERXKey<org.webcat.grader.Submission>(SUBMISSIONS_KEY);
// Fetch specifications ---
public static final String MOST_RECENT_RESULTS_FOR_ASSIGNMENT_FSPEC = "mostRecentResultsForAssignment";
public static final String MOST_RECENT_RESULTS_FOR_ASSIGNMENT_AND_USER_FSPEC = "mostRecentResultsForAssignmentAndUser";
public static final String MOST_RECENT_RESULTS_FOR_ASSIGNMENT_ORDERED_BY_NUMBER_FSPEC = "mostRecentResultsForAssignmentOrderedByNumber";
public static final String RESULTS_FOR_ASSIGNMENT_AND_USER_FSPEC = "resultsForAssignmentAndUser";
public static final String ENTITY_NAME = "SubmissionResult";
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 SubmissionResult localInstance(EOEditingContext editingContext)
{
return (SubmissionResult)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 accumulatedSavedPropertiesCache;
private NSData accumulatedSavedPropertiesRawCache;
// ----------------------------------------------------------
/**
* Retrieve this object's <code>accumulatedSavedProperties</code> value.
* @return the value of the attribute
*/
public org.webcat.core.MutableDictionary accumulatedSavedProperties()
{
NSData dbValue =
(NSData)storedValueForKey("accumulatedSavedProperties");
if (accumulatedSavedPropertiesRawCache != dbValue)
{
if (dbValue != null && dbValue.equals( accumulatedSavedPropertiesRawCache))
{
// They are still equal, so just update the raw cache
accumulatedSavedPropertiesRawCache = dbValue;
}
else
{
// Underlying attribute may have changed because
// of a concurrent update through another editing
// context, so throw away current values.
accumulatedSavedPropertiesRawCache = dbValue;
org.webcat.core.MutableDictionary newValue =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
if ( accumulatedSavedPropertiesCache != null )
{
accumulatedSavedPropertiesCache.copyFrom( newValue );
}
else
{
accumulatedSavedPropertiesCache = newValue;
}
accumulatedSavedPropertiesCache.setOwner( this );
setUpdateMutableFields( true );
}
}
else if ( dbValue == null && accumulatedSavedPropertiesCache == null )
{
accumulatedSavedPropertiesCache =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
accumulatedSavedPropertiesCache.setOwner( this );
setUpdateMutableFields( true );
}
return accumulatedSavedPropertiesCache;
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>accumulatedSavedProperties</code>
* property.
*
* @param value The new value for this property
*/
public void setAccumulatedSavedProperties( org.webcat.core.MutableDictionary value )
{
if (log.isDebugEnabled())
{
log.debug( "setAccumulatedSavedProperties("
+ value + ")" );
}
if ( accumulatedSavedPropertiesCache == null )
{
accumulatedSavedPropertiesCache = value;
value.setHasChanged( false );
accumulatedSavedPropertiesRawCache = value.archiveData();
takeStoredValueForKey( accumulatedSavedPropertiesRawCache, "accumulatedSavedProperties" );
}
else if ( accumulatedSavedPropertiesCache != value ) // ( accumulatedSavedPropertiesCache != null )
{
accumulatedSavedPropertiesCache.copyFrom( value );
setUpdateMutableFields( true );
}
else // ( accumulatedSavedPropertiesCache == non-null value )
{
// no nothing
}
}
// ----------------------------------------------------------
/**
* Clear the value of this object's <code>accumulatedSavedProperties</code>
* property.
*/
public void clearAccumulatedSavedProperties()
{
if (log.isDebugEnabled())
{
log.debug( "clearAccumulatedSavedProperties()" );
}
takeStoredValueForKey( null, "accumulatedSavedProperties" );
accumulatedSavedPropertiesRawCache = null;
accumulatedSavedPropertiesCache = null;
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>commentFormat</code> value.
* @return the value of the attribute
*/
public byte commentFormat()
{
Integer returnValue =
(Integer)storedValueForKey( "commentFormat" );
return ( returnValue == null )
? 0
: returnValue.byteValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>commentFormat</code>
* property.
*
* @param value The new value for this property
*/
public void setCommentFormat( byte value )
{
if (log.isDebugEnabled())
{
log.debug( "setCommentFormat("
+ value + "): was " + commentFormat() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value );
setCommentFormatRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>commentFormat</code> value.
* @return the value of the attribute
*/
public Integer commentFormatRaw()
{
return (Integer)storedValueForKey( "commentFormat" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>commentFormat</code>
* property.
*
* @param value The new value for this property
*/
public void setCommentFormatRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setCommentFormatRaw("
+ value + "): was " + commentFormatRaw() );
}
takeStoredValueForKey( value, "commentFormat" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>comments</code> value.
* @return the value of the attribute
*/
public String comments()
{
return (String)storedValueForKey( "comments" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>comments</code>
* property.
*
* @param value The new value for this property
*/
public void setComments( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setComments("
+ value + "): was " + comments() );
}
takeStoredValueForKey( value, "comments" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>correctnessScore</code> value.
* @return the value of the attribute
*/
public double correctnessScore()
{
Double returnValue =
(Double)storedValueForKey( "correctnessScore" );
return ( returnValue == null )
? 0.0
: returnValue.doubleValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>correctnessScore</code>
* property.
*
* @param value The new value for this property
*/
public void setCorrectnessScore( double value )
{
if (log.isDebugEnabled())
{
log.debug( "setCorrectnessScore("
+ value + "): was " + correctnessScore() );
}
Double actual =
new Double( value );
setCorrectnessScoreRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>correctnessScore</code> value.
* @return the value of the attribute
*/
public Double correctnessScoreRaw()
{
return (Double)storedValueForKey( "correctnessScore" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>correctnessScore</code>
* property.
*
* @param value The new value for this property
*/
public void setCorrectnessScoreRaw( Double value )
{
if (log.isDebugEnabled())
{
log.debug( "setCorrectnessScoreRaw("
+ value + "): was " + correctnessScoreRaw() );
}
takeStoredValueForKey( value, "correctnessScore" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>isMostRecent</code> value.
* @return the value of the attribute
*/
public boolean isMostRecent()
{
Integer returnValue =
(Integer)storedValueForKey( "isMostRecent" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>isMostRecent</code>
* property.
*
* @param value The new value for this property
*/
public void setIsMostRecent( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setIsMostRecent("
+ value + "): was " + isMostRecent() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setIsMostRecentRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>isMostRecent</code> value.
* @return the value of the attribute
*/
public Integer isMostRecentRaw()
{
return (Integer)storedValueForKey( "isMostRecent" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>isMostRecent</code>
* property.
*
* @param value The new value for this property
*/
public void setIsMostRecentRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setIsMostRecentRaw("
+ value + "): was " + isMostRecentRaw() );
}
takeStoredValueForKey( value, "isMostRecent" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>lastUpdated</code> value.
* @return the value of the attribute
*/
public NSTimestamp lastUpdated()
{
return (NSTimestamp)storedValueForKey( "lastUpdated" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>lastUpdated</code>
* property.
*
* @param value The new value for this property
*/
public void setLastUpdated( NSTimestamp value )
{
if (log.isDebugEnabled())
{
log.debug( "setLastUpdated("
+ value + "): was " + lastUpdated() );
}
takeStoredValueForKey( value, "lastUpdated" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>staffReportStyleVersion</code> value.
* @return the value of the attribute
*/
public int staffReportStyleVersion()
{
Integer returnValue =
(Integer)storedValueForKey( "staffReportStyleVersion" );
return ( returnValue == null )
? 0
: returnValue.intValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>staffReportStyleVersion</code>
* property.
*
* @param value The new value for this property
*/
public void setStaffReportStyleVersion( int value )
{
if (log.isDebugEnabled())
{
log.debug( "setStaffReportStyleVersion("
+ value + "): was " + staffReportStyleVersion() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value );
setStaffReportStyleVersionRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>staffReportStyleVersion</code> value.
* @return the value of the attribute
*/
public Integer staffReportStyleVersionRaw()
{
return (Integer)storedValueForKey( "staffReportStyleVersion" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>staffReportStyleVersion</code>
* property.
*
* @param value The new value for this property
*/
public void setStaffReportStyleVersionRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setStaffReportStyleVersionRaw("
+ value + "): was " + staffReportStyleVersionRaw() );
}
takeStoredValueForKey( value, "staffReportStyleVersion" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>statElementsLabel</code> value.
* @return the value of the attribute
*/
public String statElementsLabel()
{
return (String)storedValueForKey( "statElementsLabel" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>statElementsLabel</code>
* property.
*
* @param value The new value for this property
*/
public void setStatElementsLabel( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setStatElementsLabel("
+ value + "): was " + statElementsLabel() );
}
takeStoredValueForKey( value, "statElementsLabel" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>status</code> value.
* @return the value of the attribute
*/
public byte status()
{
Integer returnValue =
(Integer)storedValueForKey( "status" );
return ( returnValue == null )
? org.webcat.core.Status.TO_DO
: returnValue.byteValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>status</code>
* property.
*
* @param value The new value for this property
*/
public void setStatus( byte value )
{
if (log.isDebugEnabled())
{
log.debug( "setStatus("
+ value + "): was " + status() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value );
setStatusRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>status</code> value.
* @return the value of the attribute
*/
public Integer statusRaw()
{
return (Integer)storedValueForKey( "status" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>status</code>
* property.
*
* @param value The new value for this property
*/
public void setStatusRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setStatusRaw("
+ value + "): was " + statusRaw() );
}
takeStoredValueForKey( value, "status" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>studentReportStyleVersion</code> value.
* @return the value of the attribute
*/
public int studentReportStyleVersion()
{
Integer returnValue =
(Integer)storedValueForKey( "studentReportStyleVersion" );
return ( returnValue == null )
? 0
: returnValue.intValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>studentReportStyleVersion</code>
* property.
*
* @param value The new value for this property
*/
public void setStudentReportStyleVersion( int value )
{
if (log.isDebugEnabled())
{
log.debug( "setStudentReportStyleVersion("
+ value + "): was " + studentReportStyleVersion() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value );
setStudentReportStyleVersionRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>studentReportStyleVersion</code> value.
* @return the value of the attribute
*/
public Integer studentReportStyleVersionRaw()
{
return (Integer)storedValueForKey( "studentReportStyleVersion" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>studentReportStyleVersion</code>
* property.
*
* @param value The new value for this property
*/
public void setStudentReportStyleVersionRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setStudentReportStyleVersionRaw("
+ value + "): was " + studentReportStyleVersionRaw() );
}
takeStoredValueForKey( value, "studentReportStyleVersion" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>taScore</code> value.
* @return the value of the attribute
*/
public double taScore()
{
Double returnValue =
(Double)storedValueForKey( "taScore" );
return ( returnValue == null )
? 0.0
: returnValue.doubleValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>taScore</code>
* property.
*
* @param value The new value for this property
*/
public void setTaScore( double value )
{
if (log.isDebugEnabled())
{
log.debug( "setTaScore("
+ value + "): was " + taScore() );
}
Double actual =
new Double( value );
setTaScoreRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>taScore</code> value.
* @return the value of the attribute
*/
public Double taScoreRaw()
{
return (Double)storedValueForKey( "taScore" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>taScore</code>
* property.
*
* @param value The new value for this property
*/
public void setTaScoreRaw( Double value )
{
if (log.isDebugEnabled())
{
log.debug( "setTaScoreRaw("
+ value + "): was " + taScoreRaw() );
}
takeStoredValueForKey( value, "taScore" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>toolScore</code> value.
* @return the value of the attribute
*/
public double toolScore()
{
Double returnValue =
(Double)storedValueForKey( "toolScore" );
return ( returnValue == null )
? 0.0
: returnValue.doubleValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>toolScore</code>
* property.
*
* @param value The new value for this property
*/
public void setToolScore( double value )
{
if (log.isDebugEnabled())
{
log.debug( "setToolScore("
+ value + "): was " + toolScore() );
}
Double actual =
new Double( value );
setToolScoreRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>toolScore</code> value.
* @return the value of the attribute
*/
public Double toolScoreRaw()
{
return (Double)storedValueForKey( "toolScore" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>toolScore</code>
* property.
*
* @param value The new value for this property
*/
public void setToolScoreRaw( Double value )
{
if (log.isDebugEnabled())
{
log.debug( "setToolScoreRaw("
+ value + "): was " + toolScoreRaw() );
}
takeStoredValueForKey( value, "toolScore" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>updateMutableFields</code> value.
* @return the value of the attribute
*/
public boolean updateMutableFields()
{
Integer returnValue =
(Integer)storedValueForKey( "updateMutableFields" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>updateMutableFields</code>
* property.
*
* @param value The new value for this property
*/
public void setUpdateMutableFields( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setUpdateMutableFields("
+ value + "): was " + updateMutableFields() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setUpdateMutableFieldsRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>updateMutableFields</code> value.
* @return the value of the attribute
*/
public Integer updateMutableFieldsRaw()
{
return (Integer)storedValueForKey( "updateMutableFields" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>updateMutableFields</code>
* property.
*
* @param value The new value for this property
*/
public void setUpdateMutableFieldsRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setUpdateMutableFieldsRaw("
+ value + "): was " + updateMutableFieldsRaw() );
}
takeStoredValueForKey( value, "updateMutableFields" );
}
// ----------------------------------------------------------
/**
* Called just before this object is saved to the database.
*/
public void saveMutables()
{
log.debug("saveMutables()");
if ( accumulatedSavedPropertiesCache != null
&& accumulatedSavedPropertiesCache.hasChanged() )
{
accumulatedSavedPropertiesRawCache = accumulatedSavedPropertiesCache.archiveData();
takeStoredValueForKey( accumulatedSavedPropertiesRawCache, "accumulatedSavedProperties" );
accumulatedSavedPropertiesCache.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()");
accumulatedSavedPropertiesCache = null;
accumulatedSavedPropertiesRawCache = null;
super.flushCaches();
}
// ----------------------------------------------------------
/**
* Called when an owned mutable container object is changed.
*/
public void mutableContainerHasChanged()
{
setUpdateMutableFields( true );
}
// ----------------------------------------------------------
@Override
public void awakeFromFetch(EOEditingContext ec)
{
super.awakeFromFetch(ec);
// Only try to migrate if the EC isn't a migrating context. If it is,
// we're already trying to migrate and this "awake" is coming from the
// child migration context.
if (!(ec instanceof org.webcat.woextensions.MigratingEditingContext))
{
migrateAttributeValuesIfNeeded();
}
}
// ----------------------------------------------------------
/**
* Called by {@link #awake} to migrate attribute values if needed when the
* object is retrieved.
*/
public final void migrateAttributeValuesIfNeeded()
{
log.debug("migrateAttributeValuesIfNeeded()");
if ( shouldMigrateIsMostRecent() )
{
new org.webcat.woextensions.ECAction(
org.webcat.woextensions.MigratingEditingContext
.newEditingContext())
{
public void action()
{
migrateAttributeValues(
(org.webcat.woextensions.MigratingEditingContext)ec,
localInstance(ec));
ec.saveChanges();
}
}.run();
}
}
// ----------------------------------------------------------
/**
* Called by {@link #awake} to migrate attribute values when the
* object is retrieved.
*/
protected void migrateAttributeValues(
org.webcat.woextensions.MigratingEditingContext mec,
SubmissionResult migratingObject
)
{
log.debug("migrateAttributeValues()");
if ( migratingObject.shouldMigrateIsMostRecent() )
{
migratingObject.migrateIsMostRecent(mec);
}
}
// ----------------------------------------------------------
/**
* Called by {@link #migrateAttributeValues} to migrate the
* isMostRecent attribute.
*/
protected abstract boolean shouldMigrateIsMostRecent();
// ----------------------------------------------------------
/**
* Called by {@link #migrateAttributeValues} to migrate the
* isMostRecent attribute.
*/
protected abstract void migrateIsMostRecent(
org.webcat.woextensions.MigratingEditingContext mec);
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>resultFiles</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.grader.ResultFile> resultFiles()
{
return (NSArray)storedValueForKey( "resultFiles" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>resultFiles</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setResultFiles( NSMutableArray<org.webcat.grader.ResultFile> value )
{
if (log.isDebugEnabled())
{
log.debug( "setResultFiles("
+ value + "): was " + resultFiles() );
}
takeStoredValueForKey( value, "resultFiles" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>resultFiles</code>
* relationship (DO NOT USE--instead, use
* <code>addToResultFilesRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToResultFiles( org.webcat.grader.ResultFile value )
{
if (log.isDebugEnabled())
{
log.debug( "addToResultFiles("
+ value + "): was " + resultFiles() );
}
NSMutableArray<org.webcat.grader.ResultFile> array =
(NSMutableArray<org.webcat.grader.ResultFile>)resultFiles();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>resultFiles</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromResultFilesRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromResultFiles( org.webcat.grader.ResultFile value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromResultFiles("
+ value + "): was " + resultFiles() );
}
NSMutableArray<org.webcat.grader.ResultFile> array =
(NSMutableArray<org.webcat.grader.ResultFile>)resultFiles();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>resultFiles</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToResultFilesRelationship( org.webcat.grader.ResultFile value )
{
if (log.isDebugEnabled())
{
log.debug( "addToResultFilesRelationship("
+ value + "): was " + resultFiles() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "resultFiles" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>resultFiles</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromResultFilesRelationship( org.webcat.grader.ResultFile value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromResultFilesRelationship("
+ value + "): was " + resultFiles() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "resultFiles" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>resultFiles</code> relationship.
*
* @return The new entity
*/
public org.webcat.grader.ResultFile createResultFilesRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createResultFilesRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "ResultFile" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "resultFiles" );
return (org.webcat.grader.ResultFile)eoObject;
}
// ----------------------------------------------------------
/**
* Remove a specific entity that is a member of the
* <code>resultFiles</code> relationship.
*
* @param value The entity to remove from the relationship
*/
public void deleteResultFilesRelationship( org.webcat.grader.ResultFile value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteResultFilesRelationship("
+ value + "): was " + resultFiles() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "resultFiles" );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>resultFiles</code> relationship.
*/
public void deleteAllResultFilesRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllResultFilesRelationships(): was "
+ resultFiles() );
}
for (org.webcat.grader.ResultFile object : resultFiles())
{
deleteResultFilesRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>resultOutcomes</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.grader.ResultOutcome> resultOutcomes()
{
return (NSArray)storedValueForKey( "resultOutcomes" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>resultOutcomes</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setResultOutcomes( NSMutableArray<org.webcat.grader.ResultOutcome> value )
{
if (log.isDebugEnabled())
{
log.debug( "setResultOutcomes("
+ value + "): was " + resultOutcomes() );
}
takeStoredValueForKey( value, "resultOutcomes" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>resultOutcomes</code>
* relationship (DO NOT USE--instead, use
* <code>addToResultOutcomesRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToResultOutcomes( org.webcat.grader.ResultOutcome value )
{
if (log.isDebugEnabled())
{
log.debug( "addToResultOutcomes("
+ value + "): was " + resultOutcomes() );
}
NSMutableArray<org.webcat.grader.ResultOutcome> array =
(NSMutableArray<org.webcat.grader.ResultOutcome>)resultOutcomes();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>resultOutcomes</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromResultOutcomesRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromResultOutcomes( org.webcat.grader.ResultOutcome value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromResultOutcomes("
+ value + "): was " + resultOutcomes() );
}
NSMutableArray<org.webcat.grader.ResultOutcome> array =
(NSMutableArray<org.webcat.grader.ResultOutcome>)resultOutcomes();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>resultOutcomes</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToResultOutcomesRelationship( org.webcat.grader.ResultOutcome value )
{
if (log.isDebugEnabled())
{
log.debug( "addToResultOutcomesRelationship("
+ value + "): was " + resultOutcomes() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "resultOutcomes" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>resultOutcomes</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromResultOutcomesRelationship( org.webcat.grader.ResultOutcome value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromResultOutcomesRelationship("
+ value + "): was " + resultOutcomes() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "resultOutcomes" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>resultOutcomes</code> relationship.
*
* @return The new entity
*/
public org.webcat.grader.ResultOutcome createResultOutcomesRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createResultOutcomesRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "ResultOutcome" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "resultOutcomes" );
return (org.webcat.grader.ResultOutcome)eoObject;
}
// ----------------------------------------------------------
/**
* Remove a specific entity that is a member of the
* <code>resultOutcomes</code> relationship.
*
* @param value The entity to remove from the relationship
*/
public void deleteResultOutcomesRelationship( org.webcat.grader.ResultOutcome value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteResultOutcomesRelationship("
+ value + "): was " + resultOutcomes() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "resultOutcomes" );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>resultOutcomes</code> relationship.
*/
public void deleteAllResultOutcomesRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllResultOutcomesRelationships(): was "
+ resultOutcomes() );
}
for (org.webcat.grader.ResultOutcome object : resultOutcomes())
{
deleteResultOutcomesRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>submissionFileStats</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.grader.SubmissionFileStats> submissionFileStats()
{
return (NSArray)storedValueForKey( "submissionFileStats" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>submissionFileStats</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setSubmissionFileStats( NSMutableArray<org.webcat.grader.SubmissionFileStats> value )
{
if (log.isDebugEnabled())
{
log.debug( "setSubmissionFileStats("
+ value + "): was " + submissionFileStats() );
}
takeStoredValueForKey( value, "submissionFileStats" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>submissionFileStats</code>
* relationship (DO NOT USE--instead, use
* <code>addToSubmissionFileStatsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToSubmissionFileStats( org.webcat.grader.SubmissionFileStats value )
{
if (log.isDebugEnabled())
{
log.debug( "addToSubmissionFileStats("
+ value + "): was " + submissionFileStats() );
}
NSMutableArray<org.webcat.grader.SubmissionFileStats> array =
(NSMutableArray<org.webcat.grader.SubmissionFileStats>)submissionFileStats();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>submissionFileStats</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromSubmissionFileStatsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromSubmissionFileStats( org.webcat.grader.SubmissionFileStats value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromSubmissionFileStats("
+ value + "): was " + submissionFileStats() );
}
NSMutableArray<org.webcat.grader.SubmissionFileStats> array =
(NSMutableArray<org.webcat.grader.SubmissionFileStats>)submissionFileStats();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>submissionFileStats</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToSubmissionFileStatsRelationship( org.webcat.grader.SubmissionFileStats value )
{
if (log.isDebugEnabled())
{
log.debug( "addToSubmissionFileStatsRelationship("
+ value + "): was " + submissionFileStats() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "submissionFileStats" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>submissionFileStats</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromSubmissionFileStatsRelationship( org.webcat.grader.SubmissionFileStats value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromSubmissionFileStatsRelationship("
+ value + "): was " + submissionFileStats() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "submissionFileStats" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>submissionFileStats</code> relationship.
*
* @return The new entity
*/
public org.webcat.grader.SubmissionFileStats createSubmissionFileStatsRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createSubmissionFileStatsRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "SubmissionFileStats" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "submissionFileStats" );
return (org.webcat.grader.SubmissionFileStats)eoObject;
}
// ----------------------------------------------------------
/**
* Remove a specific entity that is a member of the
* <code>submissionFileStats</code> relationship.
*
* @param value The entity to remove from the relationship
*/
public void deleteSubmissionFileStatsRelationship( org.webcat.grader.SubmissionFileStats value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteSubmissionFileStatsRelationship("
+ value + "): was " + submissionFileStats() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "submissionFileStats" );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>submissionFileStats</code> relationship.
*/
public void deleteAllSubmissionFileStatsRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllSubmissionFileStatsRelationships(): was "
+ submissionFileStats() );
}
for (org.webcat.grader.SubmissionFileStats object : submissionFileStats())
{
deleteSubmissionFileStatsRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>submissions</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.grader.Submission> submissions()
{
return (NSArray)storedValueForKey( "submissions" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>submissions</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setSubmissions( NSMutableArray<org.webcat.grader.Submission> value )
{
if (log.isDebugEnabled())
{
log.debug( "setSubmissions("
+ value + "): was " + submissions() );
}
takeStoredValueForKey( value, "submissions" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>submissions</code>
* relationship (DO NOT USE--instead, use
* <code>addToSubmissionsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToSubmissions( org.webcat.grader.Submission value )
{
if (log.isDebugEnabled())
{
log.debug( "addToSubmissions("
+ value + "): was " + submissions() );
}
NSMutableArray<org.webcat.grader.Submission> array =
(NSMutableArray<org.webcat.grader.Submission>)submissions();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>submissions</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromSubmissionsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromSubmissions( org.webcat.grader.Submission value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromSubmissions("
+ value + "): was " + submissions() );
}
NSMutableArray<org.webcat.grader.Submission> array =
(NSMutableArray<org.webcat.grader.Submission>)submissions();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>submissions</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToSubmissionsRelationship( org.webcat.grader.Submission value )
{
if (log.isDebugEnabled())
{
log.debug( "addToSubmissionsRelationship("
+ value + "): was " + submissions() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "submissions" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>submissions</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromSubmissionsRelationship( org.webcat.grader.Submission value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromSubmissionsRelationship("
+ value + "): was " + submissions() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "submissions" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>submissions</code> relationship.
*
* @return The new entity
*/
public org.webcat.grader.Submission createSubmissionsRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createSubmissionsRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "Submission" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "submissions" );
return (org.webcat.grader.Submission)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>submissions</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteSubmissionsRelationship( org.webcat.grader.Submission value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteSubmissionsRelationship("
+ value + "): was " + submissions() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "submissions" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>submissions</code> relationship.
*/
public void deleteAllSubmissionsRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllSubmissionsRelationships(): was "
+ submissions() );
}
for (org.webcat.grader.Submission object : submissions())
{
deleteSubmissionsRelationship(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<SubmissionResult> 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<SubmissionResult> 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<SubmissionResult> 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<SubmissionResult> 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 SubmissionResult firstObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier,
NSArray<EOSortOrdering> sortOrderings)
{
NSArray<SubmissionResult> 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 SubmissionResult uniqueObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier) throws EOUtilities.MoreThanOneException
{
NSArray<SubmissionResult> objects =
objectsMatchingQualifier(context, qualifier);
if (objects.size() > 1)
{
String msg = "fetching SubmissionResult";
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<SubmissionResult> 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<SubmissionResult> 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 SubmissionResult 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 SubmissionResult 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<SubmissionResult> 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 SubmissionResult 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 SubmissionResult uniqueObjectMatchingValues(
EOEditingContext context,
NSDictionary<String, Object> keysAndValues)
throws EOUtilities.MoreThanOneException
{
try
{
return (SubmissionResult)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>mostRecentResultsForAssignment</code>
* fetch specification.
*
* @param context The editing context to use
* @param assignmentOfferingBinding fetch spec parameter
* @return an NSArray of the entities retrieved
*/
public static NSArray<SubmissionResult> mostRecentResultsForAssignment(
EOEditingContext context,
org.webcat.grader.AssignmentOffering assignmentOfferingBinding)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("mostRecentResultsForAssignment", "SubmissionResult");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (assignmentOfferingBinding != null)
{
bindings.setObjectForKey(assignmentOfferingBinding,
"assignmentOffering");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<SubmissionResult> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("mostRecentResultsForAssignment(ec"
+ ", " + assignmentOfferingBinding
+ "): " + objects);
}
return objects;
}
// ----------------------------------------------------------
/**
* Retrieve objects according to the <code>mostRecentResultsForAssignmentAndUser</code>
* fetch specification.
*
* @param context The editing context to use
* @param assignmentOfferingBinding fetch spec parameter
* @param userBinding fetch spec parameter
* @return an NSArray of the entities retrieved
*/
public static NSArray<SubmissionResult> mostRecentResultsForAssignmentAndUser(
EOEditingContext context,
org.webcat.grader.AssignmentOffering assignmentOfferingBinding,
org.webcat.core.User userBinding)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("mostRecentResultsForAssignmentAndUser", "SubmissionResult");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (assignmentOfferingBinding != null)
{
bindings.setObjectForKey(assignmentOfferingBinding,
"assignmentOffering");
}
if (userBinding != null)
{
bindings.setObjectForKey(userBinding,
"user");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<SubmissionResult> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("mostRecentResultsForAssignmentAndUser(ec"
+ ", " + assignmentOfferingBinding
+ ", " + userBinding
+ "): " + objects);
}
return objects;
}
// ----------------------------------------------------------
/**
* Retrieve objects according to the <code>mostRecentResultsForAssignmentOrderedByNumber</code>
* fetch specification.
*
* @param context The editing context to use
* @param assignmentOfferingBinding fetch spec parameter
* @return an NSArray of the entities retrieved
*/
public static NSArray<SubmissionResult> mostRecentResultsForAssignmentOrderedByNumber(
EOEditingContext context,
org.webcat.grader.AssignmentOffering assignmentOfferingBinding)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("mostRecentResultsForAssignmentOrderedByNumber", "SubmissionResult");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (assignmentOfferingBinding != null)
{
bindings.setObjectForKey(assignmentOfferingBinding,
"assignmentOffering");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<SubmissionResult> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("mostRecentResultsForAssignmentOrderedByNumber(ec"
+ ", " + assignmentOfferingBinding
+ "): " + objects);
}
return objects;
}
// ----------------------------------------------------------
/**
* Retrieve objects according to the <code>resultsForAssignmentAndUser</code>
* fetch specification.
*
* @param context The editing context to use
* @param assignmentOfferingBinding fetch spec parameter
* @param userBinding fetch spec parameter
* @return an NSArray of the entities retrieved
*/
public static NSArray<SubmissionResult> resultsForAssignmentAndUser(
EOEditingContext context,
org.webcat.grader.AssignmentOffering assignmentOfferingBinding,
org.webcat.core.User userBinding)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("resultsForAssignmentAndUser", "SubmissionResult");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (assignmentOfferingBinding != null)
{
bindings.setObjectForKey(assignmentOfferingBinding,
"assignmentOffering");
}
if (userBinding != null)
{
bindings.setObjectForKey(userBinding,
"user");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<SubmissionResult> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("resultsForAssignmentAndUser(ec"
+ ", " + assignmentOfferingBinding
+ ", " + userBinding
+ "): " + 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(SubmissionResult.class);
}