/*==========================================================================*\
| _GradingCriteria.java
|*-------------------------------------------------------------------------*|
| Created by eogenerator
| DO NOT EDIT. Make changes to GradingCriteria.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
* GradingCriteria.java.
*
* @author Generated by eogenerator
* @version version suppressed to control auto-generation
*/
public abstract class _GradingCriteria
extends org.webcat.core.EOBase
{
//~ Constructors ..........................................................
// ----------------------------------------------------------
/**
* Creates a new _GradingCriteria object.
*/
public _GradingCriteria()
{
super();
}
// ----------------------------------------------------------
/**
* A static factory method for creating a new
* GradingCriteria object given required
* attributes and relationships.
* @param editingContext The context in which the new object will be
* inserted
* @param diffLineSyncingValue
* @param floatComparisonStyleValue
* @param ignoreBlankLinesValue
* @param ignoreCaseValue
* @param ignoreNonprintingValue
* @param ignorePunctuationValue
* @param ignoreWhitespaceValue
* @param normalizeWhitespaceValue
* @param tokenizingStyleValue
* @param trimWhitespaceValue
* @return The newly created object
*/
public static GradingCriteria create(
EOEditingContext editingContext,
boolean diffLineSyncingValue,
boolean floatComparisonStyleValue,
boolean ignoreBlankLinesValue,
boolean ignoreCaseValue,
boolean ignoreNonprintingValue,
boolean ignorePunctuationValue,
boolean ignoreWhitespaceValue,
boolean normalizeWhitespaceValue,
boolean tokenizingStyleValue,
boolean trimWhitespaceValue
)
{
GradingCriteria eoObject = (GradingCriteria)
EOUtilities.createAndInsertInstance(
editingContext,
_GradingCriteria.ENTITY_NAME);
eoObject.setDiffLineSyncing(diffLineSyncingValue);
eoObject.setFloatComparisonStyle(floatComparisonStyleValue);
eoObject.setIgnoreBlankLines(ignoreBlankLinesValue);
eoObject.setIgnoreCase(ignoreCaseValue);
eoObject.setIgnoreNonprinting(ignoreNonprintingValue);
eoObject.setIgnorePunctuation(ignorePunctuationValue);
eoObject.setIgnoreWhitespace(ignoreWhitespaceValue);
eoObject.setNormalizeWhitespace(normalizeWhitespaceValue);
eoObject.setTokenizingStyle(tokenizingStyleValue);
eoObject.setTrimWhitespace(trimWhitespaceValue);
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 GradingCriteria localInstance(
EOEditingContext editingContext, GradingCriteria eo)
{
return (eo == null)
? null
: (GradingCriteria)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 GradingCriteria forId(
EOEditingContext ec, int id)
{
GradingCriteria obj = null;
if (id > 0)
{
NSArray<GradingCriteria> 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 GradingCriteria forId(
EOEditingContext ec, String id)
{
return forId(ec, er.extensions.foundation.ERXValueUtilities.intValue(id));
}
//~ Constants (for key names) .............................................
// Attributes ---
public static final String BLANK_LINE_PT_KEY = "blankLinePt";
public static final ERXKey<Double> blankLinePt =
new ERXKey<Double>(BLANK_LINE_PT_KEY);
public static final String DEAD_TIME_DELTA_KEY = "deadTimeDelta";
public static final ERXKey<Long> deadTimeDelta =
new ERXKey<Long>(DEAD_TIME_DELTA_KEY);
public static final String DIFF_LINE_SYNCING_KEY = "diffLineSyncing";
public static final ERXKey<Integer> diffLineSyncing =
new ERXKey<Integer>(DIFF_LINE_SYNCING_KEY);
public static final String EXTRA_LINE_PT_KEY = "extraLinePt";
public static final ERXKey<Double> extraLinePt =
new ERXKey<Double>(EXTRA_LINE_PT_KEY);
public static final String FLOAT_COMPARISON_STYLE_KEY = "floatComparisonStyle";
public static final ERXKey<Integer> floatComparisonStyle =
new ERXKey<Integer>(FLOAT_COMPARISON_STYLE_KEY);
public static final String FLOAT_NEGATIVE_DELTA_KEY = "floatNegativeDelta";
public static final ERXKey<Double> floatNegativeDelta =
new ERXKey<Double>(FLOAT_NEGATIVE_DELTA_KEY);
public static final String FLOAT_POSITIVE_DELTA_KEY = "floatPositiveDelta";
public static final ERXKey<Double> floatPositiveDelta =
new ERXKey<Double>(FLOAT_POSITIVE_DELTA_KEY);
public static final String IGNORE_BLANK_LINES_KEY = "ignoreBlankLines";
public static final ERXKey<Integer> ignoreBlankLines =
new ERXKey<Integer>(IGNORE_BLANK_LINES_KEY);
public static final String IGNORE_CASE_KEY = "ignoreCase";
public static final ERXKey<Integer> ignoreCase =
new ERXKey<Integer>(IGNORE_CASE_KEY);
public static final String IGNORE_NONPRINTING_KEY = "ignoreNonprinting";
public static final ERXKey<Integer> ignoreNonprinting =
new ERXKey<Integer>(IGNORE_NONPRINTING_KEY);
public static final String IGNORE_PUNCTUATION_KEY = "ignorePunctuation";
public static final ERXKey<Integer> ignorePunctuation =
new ERXKey<Integer>(IGNORE_PUNCTUATION_KEY);
public static final String IGNORE_WHITESPACE_KEY = "ignoreWhitespace";
public static final ERXKey<Integer> ignoreWhitespace =
new ERXKey<Integer>(IGNORE_WHITESPACE_KEY);
public static final String NAME_KEY = "name";
public static final ERXKey<String> name =
new ERXKey<String>(NAME_KEY);
public static final String NORMALIZE_WHITESPACE_KEY = "normalizeWhitespace";
public static final ERXKey<Integer> normalizeWhitespace =
new ERXKey<Integer>(NORMALIZE_WHITESPACE_KEY);
public static final String PUNCTUATION_TO_IGNORE_KEY = "punctuationToIgnore";
public static final ERXKey<String> punctuationToIgnore =
new ERXKey<String>(PUNCTUATION_TO_IGNORE_KEY);
public static final String STRING_COMPARSION_STYLE_KEY = "stringComparsionStyle";
public static final ERXKey<Integer> stringComparsionStyle =
new ERXKey<Integer>(STRING_COMPARSION_STYLE_KEY);
public static final String TOKENIZING_STYLE_KEY = "tokenizingStyle";
public static final ERXKey<Integer> tokenizingStyle =
new ERXKey<Integer>(TOKENIZING_STYLE_KEY);
public static final String TRIM_WHITESPACE_KEY = "trimWhitespace";
public static final ERXKey<Integer> trimWhitespace =
new ERXKey<Integer>(TRIM_WHITESPACE_KEY);
// To-one relationships ---
public static final String AUTHOR_KEY = "author";
public static final ERXKey<org.webcat.core.User> author =
new ERXKey<org.webcat.core.User>(AUTHOR_KEY);
// To-many relationships ---
public static final String ASSIGNMENT_KEY = "assignment";
public static final ERXKey<org.webcat.grader.Assignment> assignment =
new ERXKey<org.webcat.grader.Assignment>(ASSIGNMENT_KEY);
// Fetch specifications ---
public static final String ENTITY_NAME = "GradingCriteria";
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 GradingCriteria localInstance(EOEditingContext editingContext)
{
return (GradingCriteria)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>blankLinePt</code> value.
* @return the value of the attribute
*/
public double blankLinePt()
{
Double returnValue =
(Double)storedValueForKey( "blankLinePt" );
return ( returnValue == null )
? 0.0
: returnValue.doubleValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>blankLinePt</code>
* property.
*
* @param value The new value for this property
*/
public void setBlankLinePt( double value )
{
if (log.isDebugEnabled())
{
log.debug( "setBlankLinePt("
+ value + "): was " + blankLinePt() );
}
Double actual =
new Double( value );
setBlankLinePtRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>blankLinePt</code> value.
* @return the value of the attribute
*/
public Double blankLinePtRaw()
{
return (Double)storedValueForKey( "blankLinePt" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>blankLinePt</code>
* property.
*
* @param value The new value for this property
*/
public void setBlankLinePtRaw( Double value )
{
if (log.isDebugEnabled())
{
log.debug( "setBlankLinePtRaw("
+ value + "): was " + blankLinePtRaw() );
}
takeStoredValueForKey( value, "blankLinePt" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>deadTimeDelta</code> value.
* @return the value of the attribute
*/
public long deadTimeDelta()
{
Long returnValue =
(Long)storedValueForKey( "deadTimeDelta" );
return ( returnValue == null )
? 0L
: returnValue.longValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>deadTimeDelta</code>
* property.
*
* @param value The new value for this property
*/
public void setDeadTimeDelta( long value )
{
if (log.isDebugEnabled())
{
log.debug( "setDeadTimeDelta("
+ value + "): was " + deadTimeDelta() );
}
Long actual =
new Long( value );
setDeadTimeDeltaRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>deadTimeDelta</code> value.
* @return the value of the attribute
*/
public Long deadTimeDeltaRaw()
{
return (Long)storedValueForKey( "deadTimeDelta" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>deadTimeDelta</code>
* property.
*
* @param value The new value for this property
*/
public void setDeadTimeDeltaRaw( Long value )
{
if (log.isDebugEnabled())
{
log.debug( "setDeadTimeDeltaRaw("
+ value + "): was " + deadTimeDeltaRaw() );
}
takeStoredValueForKey( value, "deadTimeDelta" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>diffLineSyncing</code> value.
* @return the value of the attribute
*/
public boolean diffLineSyncing()
{
Integer returnValue =
(Integer)storedValueForKey( "diffLineSyncing" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>diffLineSyncing</code>
* property.
*
* @param value The new value for this property
*/
public void setDiffLineSyncing( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setDiffLineSyncing("
+ value + "): was " + diffLineSyncing() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setDiffLineSyncingRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>diffLineSyncing</code> value.
* @return the value of the attribute
*/
public Integer diffLineSyncingRaw()
{
return (Integer)storedValueForKey( "diffLineSyncing" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>diffLineSyncing</code>
* property.
*
* @param value The new value for this property
*/
public void setDiffLineSyncingRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setDiffLineSyncingRaw("
+ value + "): was " + diffLineSyncingRaw() );
}
takeStoredValueForKey( value, "diffLineSyncing" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>extraLinePt</code> value.
* @return the value of the attribute
*/
public double extraLinePt()
{
Double returnValue =
(Double)storedValueForKey( "extraLinePt" );
return ( returnValue == null )
? 0.0
: returnValue.doubleValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>extraLinePt</code>
* property.
*
* @param value The new value for this property
*/
public void setExtraLinePt( double value )
{
if (log.isDebugEnabled())
{
log.debug( "setExtraLinePt("
+ value + "): was " + extraLinePt() );
}
Double actual =
new Double( value );
setExtraLinePtRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>extraLinePt</code> value.
* @return the value of the attribute
*/
public Double extraLinePtRaw()
{
return (Double)storedValueForKey( "extraLinePt" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>extraLinePt</code>
* property.
*
* @param value The new value for this property
*/
public void setExtraLinePtRaw( Double value )
{
if (log.isDebugEnabled())
{
log.debug( "setExtraLinePtRaw("
+ value + "): was " + extraLinePtRaw() );
}
takeStoredValueForKey( value, "extraLinePt" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>floatComparisonStyle</code> value.
* @return the value of the attribute
*/
public boolean floatComparisonStyle()
{
Integer returnValue =
(Integer)storedValueForKey( "floatComparisonStyle" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>floatComparisonStyle</code>
* property.
*
* @param value The new value for this property
*/
public void setFloatComparisonStyle( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setFloatComparisonStyle("
+ value + "): was " + floatComparisonStyle() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setFloatComparisonStyleRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>floatComparisonStyle</code> value.
* @return the value of the attribute
*/
public Integer floatComparisonStyleRaw()
{
return (Integer)storedValueForKey( "floatComparisonStyle" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>floatComparisonStyle</code>
* property.
*
* @param value The new value for this property
*/
public void setFloatComparisonStyleRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setFloatComparisonStyleRaw("
+ value + "): was " + floatComparisonStyleRaw() );
}
takeStoredValueForKey( value, "floatComparisonStyle" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>floatNegativeDelta</code> value.
* @return the value of the attribute
*/
public double floatNegativeDelta()
{
Double returnValue =
(Double)storedValueForKey( "floatNegativeDelta" );
return ( returnValue == null )
? 0.0
: returnValue.doubleValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>floatNegativeDelta</code>
* property.
*
* @param value The new value for this property
*/
public void setFloatNegativeDelta( double value )
{
if (log.isDebugEnabled())
{
log.debug( "setFloatNegativeDelta("
+ value + "): was " + floatNegativeDelta() );
}
Double actual =
new Double( value );
setFloatNegativeDeltaRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>floatNegativeDelta</code> value.
* @return the value of the attribute
*/
public Double floatNegativeDeltaRaw()
{
return (Double)storedValueForKey( "floatNegativeDelta" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>floatNegativeDelta</code>
* property.
*
* @param value The new value for this property
*/
public void setFloatNegativeDeltaRaw( Double value )
{
if (log.isDebugEnabled())
{
log.debug( "setFloatNegativeDeltaRaw("
+ value + "): was " + floatNegativeDeltaRaw() );
}
takeStoredValueForKey( value, "floatNegativeDelta" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>floatPositiveDelta</code> value.
* @return the value of the attribute
*/
public double floatPositiveDelta()
{
Double returnValue =
(Double)storedValueForKey( "floatPositiveDelta" );
return ( returnValue == null )
? 0.0
: returnValue.doubleValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>floatPositiveDelta</code>
* property.
*
* @param value The new value for this property
*/
public void setFloatPositiveDelta( double value )
{
if (log.isDebugEnabled())
{
log.debug( "setFloatPositiveDelta("
+ value + "): was " + floatPositiveDelta() );
}
Double actual =
new Double( value );
setFloatPositiveDeltaRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>floatPositiveDelta</code> value.
* @return the value of the attribute
*/
public Double floatPositiveDeltaRaw()
{
return (Double)storedValueForKey( "floatPositiveDelta" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>floatPositiveDelta</code>
* property.
*
* @param value The new value for this property
*/
public void setFloatPositiveDeltaRaw( Double value )
{
if (log.isDebugEnabled())
{
log.debug( "setFloatPositiveDeltaRaw("
+ value + "): was " + floatPositiveDeltaRaw() );
}
takeStoredValueForKey( value, "floatPositiveDelta" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>ignoreBlankLines</code> value.
* @return the value of the attribute
*/
public boolean ignoreBlankLines()
{
Integer returnValue =
(Integer)storedValueForKey( "ignoreBlankLines" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>ignoreBlankLines</code>
* property.
*
* @param value The new value for this property
*/
public void setIgnoreBlankLines( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setIgnoreBlankLines("
+ value + "): was " + ignoreBlankLines() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setIgnoreBlankLinesRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>ignoreBlankLines</code> value.
* @return the value of the attribute
*/
public Integer ignoreBlankLinesRaw()
{
return (Integer)storedValueForKey( "ignoreBlankLines" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>ignoreBlankLines</code>
* property.
*
* @param value The new value for this property
*/
public void setIgnoreBlankLinesRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setIgnoreBlankLinesRaw("
+ value + "): was " + ignoreBlankLinesRaw() );
}
takeStoredValueForKey( value, "ignoreBlankLines" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>ignoreCase</code> value.
* @return the value of the attribute
*/
public boolean ignoreCase()
{
Integer returnValue =
(Integer)storedValueForKey( "ignoreCase" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>ignoreCase</code>
* property.
*
* @param value The new value for this property
*/
public void setIgnoreCase( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setIgnoreCase("
+ value + "): was " + ignoreCase() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setIgnoreCaseRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>ignoreCase</code> value.
* @return the value of the attribute
*/
public Integer ignoreCaseRaw()
{
return (Integer)storedValueForKey( "ignoreCase" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>ignoreCase</code>
* property.
*
* @param value The new value for this property
*/
public void setIgnoreCaseRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setIgnoreCaseRaw("
+ value + "): was " + ignoreCaseRaw() );
}
takeStoredValueForKey( value, "ignoreCase" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>ignoreNonprinting</code> value.
* @return the value of the attribute
*/
public boolean ignoreNonprinting()
{
Integer returnValue =
(Integer)storedValueForKey( "ignoreNonprinting" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>ignoreNonprinting</code>
* property.
*
* @param value The new value for this property
*/
public void setIgnoreNonprinting( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setIgnoreNonprinting("
+ value + "): was " + ignoreNonprinting() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setIgnoreNonprintingRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>ignoreNonprinting</code> value.
* @return the value of the attribute
*/
public Integer ignoreNonprintingRaw()
{
return (Integer)storedValueForKey( "ignoreNonprinting" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>ignoreNonprinting</code>
* property.
*
* @param value The new value for this property
*/
public void setIgnoreNonprintingRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setIgnoreNonprintingRaw("
+ value + "): was " + ignoreNonprintingRaw() );
}
takeStoredValueForKey( value, "ignoreNonprinting" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>ignorePunctuation</code> value.
* @return the value of the attribute
*/
public boolean ignorePunctuation()
{
Integer returnValue =
(Integer)storedValueForKey( "ignorePunctuation" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>ignorePunctuation</code>
* property.
*
* @param value The new value for this property
*/
public void setIgnorePunctuation( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setIgnorePunctuation("
+ value + "): was " + ignorePunctuation() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setIgnorePunctuationRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>ignorePunctuation</code> value.
* @return the value of the attribute
*/
public Integer ignorePunctuationRaw()
{
return (Integer)storedValueForKey( "ignorePunctuation" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>ignorePunctuation</code>
* property.
*
* @param value The new value for this property
*/
public void setIgnorePunctuationRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setIgnorePunctuationRaw("
+ value + "): was " + ignorePunctuationRaw() );
}
takeStoredValueForKey( value, "ignorePunctuation" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>ignoreWhitespace</code> value.
* @return the value of the attribute
*/
public boolean ignoreWhitespace()
{
Integer returnValue =
(Integer)storedValueForKey( "ignoreWhitespace" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>ignoreWhitespace</code>
* property.
*
* @param value The new value for this property
*/
public void setIgnoreWhitespace( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setIgnoreWhitespace("
+ value + "): was " + ignoreWhitespace() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setIgnoreWhitespaceRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>ignoreWhitespace</code> value.
* @return the value of the attribute
*/
public Integer ignoreWhitespaceRaw()
{
return (Integer)storedValueForKey( "ignoreWhitespace" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>ignoreWhitespace</code>
* property.
*
* @param value The new value for this property
*/
public void setIgnoreWhitespaceRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setIgnoreWhitespaceRaw("
+ value + "): was " + ignoreWhitespaceRaw() );
}
takeStoredValueForKey( value, "ignoreWhitespace" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>name</code> value.
* @return the value of the attribute
*/
public String name()
{
return (String)storedValueForKey( "name" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>name</code>
* property.
*
* @param value The new value for this property
*/
public void setName( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setName("
+ value + "): was " + name() );
}
takeStoredValueForKey( value, "name" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>normalizeWhitespace</code> value.
* @return the value of the attribute
*/
public boolean normalizeWhitespace()
{
Integer returnValue =
(Integer)storedValueForKey( "normalizeWhitespace" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>normalizeWhitespace</code>
* property.
*
* @param value The new value for this property
*/
public void setNormalizeWhitespace( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setNormalizeWhitespace("
+ value + "): was " + normalizeWhitespace() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setNormalizeWhitespaceRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>normalizeWhitespace</code> value.
* @return the value of the attribute
*/
public Integer normalizeWhitespaceRaw()
{
return (Integer)storedValueForKey( "normalizeWhitespace" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>normalizeWhitespace</code>
* property.
*
* @param value The new value for this property
*/
public void setNormalizeWhitespaceRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setNormalizeWhitespaceRaw("
+ value + "): was " + normalizeWhitespaceRaw() );
}
takeStoredValueForKey( value, "normalizeWhitespace" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>punctuationToIgnore</code> value.
* @return the value of the attribute
*/
public String punctuationToIgnore()
{
return (String)storedValueForKey( "punctuationToIgnore" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>punctuationToIgnore</code>
* property.
*
* @param value The new value for this property
*/
public void setPunctuationToIgnore( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setPunctuationToIgnore("
+ value + "): was " + punctuationToIgnore() );
}
takeStoredValueForKey( value, "punctuationToIgnore" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>stringComparsionStyle</code> value.
* @return the value of the attribute
*/
public int stringComparsionStyle()
{
Integer returnValue =
(Integer)storedValueForKey( "stringComparsionStyle" );
return ( returnValue == null )
? 0
: returnValue.intValue();
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>stringComparsionStyle</code>
* property.
*
* @param value The new value for this property
*/
public void setStringComparsionStyle( int value )
{
if (log.isDebugEnabled())
{
log.debug( "setStringComparsionStyle("
+ value + "): was " + stringComparsionStyle() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value );
setStringComparsionStyleRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>stringComparsionStyle</code> value.
* @return the value of the attribute
*/
public Integer stringComparsionStyleRaw()
{
return (Integer)storedValueForKey( "stringComparsionStyle" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>stringComparsionStyle</code>
* property.
*
* @param value The new value for this property
*/
public void setStringComparsionStyleRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setStringComparsionStyleRaw("
+ value + "): was " + stringComparsionStyleRaw() );
}
takeStoredValueForKey( value, "stringComparsionStyle" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>tokenizingStyle</code> value.
* @return the value of the attribute
*/
public boolean tokenizingStyle()
{
Integer returnValue =
(Integer)storedValueForKey( "tokenizingStyle" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>tokenizingStyle</code>
* property.
*
* @param value The new value for this property
*/
public void setTokenizingStyle( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setTokenizingStyle("
+ value + "): was " + tokenizingStyle() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setTokenizingStyleRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>tokenizingStyle</code> value.
* @return the value of the attribute
*/
public Integer tokenizingStyleRaw()
{
return (Integer)storedValueForKey( "tokenizingStyle" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>tokenizingStyle</code>
* property.
*
* @param value The new value for this property
*/
public void setTokenizingStyleRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setTokenizingStyleRaw("
+ value + "): was " + tokenizingStyleRaw() );
}
takeStoredValueForKey( value, "tokenizingStyle" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>trimWhitespace</code> value.
* @return the value of the attribute
*/
public boolean trimWhitespace()
{
Integer returnValue =
(Integer)storedValueForKey( "trimWhitespace" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>trimWhitespace</code>
* property.
*
* @param value The new value for this property
*/
public void setTrimWhitespace( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setTrimWhitespace("
+ value + "): was " + trimWhitespace() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setTrimWhitespaceRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>trimWhitespace</code> value.
* @return the value of the attribute
*/
public Integer trimWhitespaceRaw()
{
return (Integer)storedValueForKey( "trimWhitespace" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>trimWhitespace</code>
* property.
*
* @param value The new value for this property
*/
public void setTrimWhitespaceRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setTrimWhitespaceRaw("
+ value + "): was " + trimWhitespaceRaw() );
}
takeStoredValueForKey( value, "trimWhitespace" );
}
// ----------------------------------------------------------
/**
* Retrieve the entity pointed to by the <code>author</code>
* relationship.
* @return the entity in the relationship
*/
public org.webcat.core.User author()
{
return (org.webcat.core.User)storedValueForKey( "author" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>author</code>
* relationship (DO NOT USE--instead, use
* <code>setAuthorRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void setAuthor( org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "setAuthor("
+ value + "): was " + author() );
}
takeStoredValueForKey( value, "author" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>author</code>
* relationship. This method is a type-safe version of
* <code>addObjectToBothSidesOfRelationshipWithKey()</code>.
*
* @param value The new entity to relate to
*/
public void setAuthorRelationship(
org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "setAuthorRelationship("
+ value + "): was " + author() );
}
if ( value == null )
{
org.webcat.core.User object = author();
if ( object != null )
removeObjectFromBothSidesOfRelationshipWithKey( object, "author" );
}
else
{
addObjectToBothSidesOfRelationshipWithKey( value, "author" );
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>assignment</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.grader.Assignment> assignment()
{
return (NSArray)storedValueForKey( "assignment" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>assignment</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setAssignment( NSMutableArray<org.webcat.grader.Assignment> value )
{
if (log.isDebugEnabled())
{
log.debug( "setAssignment("
+ value + "): was " + assignment() );
}
takeStoredValueForKey( value, "assignment" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>assignment</code>
* relationship (DO NOT USE--instead, use
* <code>addToAssignmentRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToAssignment( org.webcat.grader.Assignment value )
{
if (log.isDebugEnabled())
{
log.debug( "addToAssignment("
+ value + "): was " + assignment() );
}
NSMutableArray<org.webcat.grader.Assignment> array =
(NSMutableArray<org.webcat.grader.Assignment>)assignment();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>assignment</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromAssignmentRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromAssignment( org.webcat.grader.Assignment value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromAssignment("
+ value + "): was " + assignment() );
}
NSMutableArray<org.webcat.grader.Assignment> array =
(NSMutableArray<org.webcat.grader.Assignment>)assignment();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>assignment</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToAssignmentRelationship( org.webcat.grader.Assignment value )
{
if (log.isDebugEnabled())
{
log.debug( "addToAssignmentRelationship("
+ value + "): was " + assignment() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "assignment" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>assignment</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromAssignmentRelationship( org.webcat.grader.Assignment value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromAssignmentRelationship("
+ value + "): was " + assignment() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "assignment" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>assignment</code> relationship.
*
* @return The new entity
*/
public org.webcat.grader.Assignment createAssignmentRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createAssignmentRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "Assignment" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "assignment" );
return (org.webcat.grader.Assignment)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>assignment</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteAssignmentRelationship( org.webcat.grader.Assignment value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteAssignmentRelationship("
+ value + "): was " + assignment() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "assignment" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>assignment</code> relationship.
*/
public void deleteAllAssignmentRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllAssignmentRelationships(): was "
+ assignment() );
}
for (org.webcat.grader.Assignment object : assignment())
{
deleteAssignmentRelationship(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<GradingCriteria> 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<GradingCriteria> 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<GradingCriteria> 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<GradingCriteria> 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 GradingCriteria firstObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier,
NSArray<EOSortOrdering> sortOrderings)
{
NSArray<GradingCriteria> 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 GradingCriteria uniqueObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier) throws EOUtilities.MoreThanOneException
{
NSArray<GradingCriteria> objects =
objectsMatchingQualifier(context, qualifier);
if (objects.size() > 1)
{
String msg = "fetching GradingCriteria";
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<GradingCriteria> 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<GradingCriteria> 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 GradingCriteria 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 GradingCriteria 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<GradingCriteria> 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 GradingCriteria 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 GradingCriteria uniqueObjectMatchingValues(
EOEditingContext context,
NSDictionary<String, Object> keysAndValues)
throws EOUtilities.MoreThanOneException
{
try
{
return (GradingCriteria)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));
}
// ----------------------------------------------------------
/**
* 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(GradingCriteria.class);
}