/*==========================================================================*\ | _SubmissionProfile.java |*-------------------------------------------------------------------------*| | Created by eogenerator | DO NOT EDIT. Make changes to SubmissionProfile.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 * SubmissionProfile.java. * * @author Generated by eogenerator * @version version suppressed to control auto-generation */ public abstract class _SubmissionProfile extends org.webcat.core.EOBase { //~ Constructors .......................................................... // ---------------------------------------------------------- /** * Creates a new _SubmissionProfile object. */ public _SubmissionProfile() { super(); } // ---------------------------------------------------------- /** * A static factory method for creating a new * SubmissionProfile object given required * attributes and relationships. * @param editingContext The context in which the new object will be * inserted * @param allowPartnersValue * @param awardEarlyBonusValue * @param deductLatePenaltyValue * @return The newly created object */ public static SubmissionProfile create( EOEditingContext editingContext, boolean allowPartnersValue, boolean awardEarlyBonusValue, boolean deductLatePenaltyValue ) { SubmissionProfile eoObject = (SubmissionProfile) EOUtilities.createAndInsertInstance( editingContext, _SubmissionProfile.ENTITY_NAME); eoObject.setAllowPartners(allowPartnersValue); eoObject.setAwardEarlyBonus(awardEarlyBonusValue); eoObject.setDeductLatePenalty(deductLatePenaltyValue); 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 SubmissionProfile localInstance( EOEditingContext editingContext, SubmissionProfile eo) { return (eo == null) ? null : (SubmissionProfile)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 SubmissionProfile forId( EOEditingContext ec, int id) { SubmissionProfile obj = null; if (id > 0) { NSArray<SubmissionProfile> 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 SubmissionProfile forId( EOEditingContext ec, String id) { return forId(ec, er.extensions.foundation.ERXValueUtilities.intValue(id)); } //~ Constants (for key names) ............................................. // Attributes --- public static final String ALLOW_PARTNERS_KEY = "allowPartners"; public static final ERXKey<Integer> allowPartners = new ERXKey<Integer>(ALLOW_PARTNERS_KEY); public static final String AVAILABLE_POINTS_KEY = "availablePoints"; public static final ERXKey<Double> availablePoints = new ERXKey<Double>(AVAILABLE_POINTS_KEY); public static final String AVAILABLE_TIME_DELTA_KEY = "availableTimeDelta"; public static final ERXKey<Long> availableTimeDelta = new ERXKey<Long>(AVAILABLE_TIME_DELTA_KEY); public static final String AWARD_EARLY_BONUS_KEY = "awardEarlyBonus"; public static final ERXKey<Integer> awardEarlyBonus = new ERXKey<Integer>(AWARD_EARLY_BONUS_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 DEDUCT_LATE_PENALTY_KEY = "deductLatePenalty"; public static final ERXKey<Integer> deductLatePenalty = new ERXKey<Integer>(DEDUCT_LATE_PENALTY_KEY); public static final String EARLY_BONUS_MAX_PTS_KEY = "earlyBonusMaxPts"; public static final ERXKey<Double> earlyBonusMaxPts = new ERXKey<Double>(EARLY_BONUS_MAX_PTS_KEY); public static final String EARLY_BONUS_UNIT_PTS_KEY = "earlyBonusUnitPts"; public static final ERXKey<Double> earlyBonusUnitPts = new ERXKey<Double>(EARLY_BONUS_UNIT_PTS_KEY); public static final String EARLY_BONUS_UNIT_TIME_KEY = "earlyBonusUnitTime"; public static final ERXKey<Long> earlyBonusUnitTime = new ERXKey<Long>(EARLY_BONUS_UNIT_TIME_KEY); public static final String EXCLUDED_FILE_PATTERNS_KEY = "excludedFilePatterns"; public static final ERXKey<String> excludedFilePatterns = new ERXKey<String>(EXCLUDED_FILE_PATTERNS_KEY); public static final String INCLUDED_FILE_PATTERNS_KEY = "includedFilePatterns"; public static final ERXKey<String> includedFilePatterns = new ERXKey<String>(INCLUDED_FILE_PATTERNS_KEY); public static final String LATE_PENALTY_MAX_PTS_KEY = "latePenaltyMaxPts"; public static final ERXKey<Double> latePenaltyMaxPts = new ERXKey<Double>(LATE_PENALTY_MAX_PTS_KEY); public static final String LATE_PENALTY_UNIT_PTS_KEY = "latePenaltyUnitPts"; public static final ERXKey<Double> latePenaltyUnitPts = new ERXKey<Double>(LATE_PENALTY_UNIT_PTS_KEY); public static final String LATE_PENALTY_UNIT_TIME_KEY = "latePenaltyUnitTime"; public static final ERXKey<Long> latePenaltyUnitTime = new ERXKey<Long>(LATE_PENALTY_UNIT_TIME_KEY); public static final String MAX_FILE_UPLOAD_SIZE_KEY = "maxFileUploadSize"; public static final ERXKey<Long> maxFileUploadSize = new ERXKey<Long>(MAX_FILE_UPLOAD_SIZE_KEY); public static final String MAX_SUBMISSIONS_KEY = "maxSubmissions"; public static final ERXKey<Integer> maxSubmissions = new ERXKey<Integer>(MAX_SUBMISSIONS_KEY); public static final String NAME_KEY = "name"; public static final ERXKey<String> name = new ERXKey<String>(NAME_KEY); public static final String REQUIRED_FILE_PATTERNS_KEY = "requiredFilePatterns"; public static final ERXKey<String> requiredFilePatterns = new ERXKey<String>(REQUIRED_FILE_PATTERNS_KEY); public static final String SCORE_FORMAT_KEY = "scoreFormat"; public static final ERXKey<String> scoreFormat = new ERXKey<String>(SCORE_FORMAT_KEY); public static final String TA_POINTS_KEY = "taPoints"; public static final ERXKey<Double> taPoints = new ERXKey<Double>(TA_POINTS_KEY); public static final String TOOL_POINTS_KEY = "toolPoints"; public static final ERXKey<Double> toolPoints = new ERXKey<Double>(TOOL_POINTS_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); public static final String COURSE_OFFERINGS_KEY = "courseOfferings"; public static final ERXKey<org.webcat.core.CourseOffering> courseOfferings = new ERXKey<org.webcat.core.CourseOffering>(COURSE_OFFERINGS_KEY); // Fetch specifications --- public static final String PROFILES_FOR_COURSE_FSPEC = "profilesForCourse"; public static final String PROFILES_FOR_USER_FSPEC = "profilesForUser"; public static final String ENTITY_NAME = "SubmissionProfile"; 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 SubmissionProfile localInstance(EOEditingContext editingContext) { return (SubmissionProfile)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>allowPartners</code> value. * @return the value of the attribute */ public boolean allowPartners() { Integer returnValue = (Integer)storedValueForKey( "allowPartners" ); return ( returnValue == null ) ? true : ( returnValue.intValue() > 0 ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>allowPartners</code> * property. * * @param value The new value for this property */ public void setAllowPartners( boolean value ) { if (log.isDebugEnabled()) { log.debug( "setAllowPartners(" + value + "): was " + allowPartners() ); } Integer actual = er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 ); setAllowPartnersRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>allowPartners</code> value. * @return the value of the attribute */ public Integer allowPartnersRaw() { return (Integer)storedValueForKey( "allowPartners" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>allowPartners</code> * property. * * @param value The new value for this property */ public void setAllowPartnersRaw( Integer value ) { if (log.isDebugEnabled()) { log.debug( "setAllowPartnersRaw(" + value + "): was " + allowPartnersRaw() ); } takeStoredValueForKey( value, "allowPartners" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>availablePoints</code> value. * @return the value of the attribute */ public double availablePoints() { Double returnValue = (Double)storedValueForKey( "availablePoints" ); return ( returnValue == null ) ? 0.0 : returnValue.doubleValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>availablePoints</code> * property. * * @param value The new value for this property */ public void setAvailablePoints( double value ) { if (log.isDebugEnabled()) { log.debug( "setAvailablePoints(" + value + "): was " + availablePoints() ); } Double actual = new Double( value ); setAvailablePointsRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>availablePoints</code> value. * @return the value of the attribute */ public Double availablePointsRaw() { return (Double)storedValueForKey( "availablePoints" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>availablePoints</code> * property. * * @param value The new value for this property */ public void setAvailablePointsRaw( Double value ) { if (log.isDebugEnabled()) { log.debug( "setAvailablePointsRaw(" + value + "): was " + availablePointsRaw() ); } takeStoredValueForKey( value, "availablePoints" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>availableTimeDelta</code> value. * @return the value of the attribute */ public long availableTimeDelta() { Long returnValue = (Long)storedValueForKey( "availableTimeDelta" ); return ( returnValue == null ) ? 0L : returnValue.longValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>availableTimeDelta</code> * property. * * @param value The new value for this property */ public void setAvailableTimeDelta( long value ) { if (log.isDebugEnabled()) { log.debug( "setAvailableTimeDelta(" + value + "): was " + availableTimeDelta() ); } Long actual = new Long( value ); setAvailableTimeDeltaRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>availableTimeDelta</code> value. * @return the value of the attribute */ public Long availableTimeDeltaRaw() { return (Long)storedValueForKey( "availableTimeDelta" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>availableTimeDelta</code> * property. * * @param value The new value for this property */ public void setAvailableTimeDeltaRaw( Long value ) { if (log.isDebugEnabled()) { log.debug( "setAvailableTimeDeltaRaw(" + value + "): was " + availableTimeDeltaRaw() ); } takeStoredValueForKey( value, "availableTimeDelta" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>awardEarlyBonus</code> value. * @return the value of the attribute */ public boolean awardEarlyBonus() { Integer returnValue = (Integer)storedValueForKey( "awardEarlyBonus" ); return ( returnValue == null ) ? false : ( returnValue.intValue() > 0 ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>awardEarlyBonus</code> * property. * * @param value The new value for this property */ public void setAwardEarlyBonus( boolean value ) { if (log.isDebugEnabled()) { log.debug( "setAwardEarlyBonus(" + value + "): was " + awardEarlyBonus() ); } Integer actual = er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 ); setAwardEarlyBonusRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>awardEarlyBonus</code> value. * @return the value of the attribute */ public Integer awardEarlyBonusRaw() { return (Integer)storedValueForKey( "awardEarlyBonus" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>awardEarlyBonus</code> * property. * * @param value The new value for this property */ public void setAwardEarlyBonusRaw( Integer value ) { if (log.isDebugEnabled()) { log.debug( "setAwardEarlyBonusRaw(" + value + "): was " + awardEarlyBonusRaw() ); } takeStoredValueForKey( value, "awardEarlyBonus" ); } // ---------------------------------------------------------- /** * 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>deductLatePenalty</code> value. * @return the value of the attribute */ public boolean deductLatePenalty() { Integer returnValue = (Integer)storedValueForKey( "deductLatePenalty" ); return ( returnValue == null ) ? false : ( returnValue.intValue() > 0 ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>deductLatePenalty</code> * property. * * @param value The new value for this property */ public void setDeductLatePenalty( boolean value ) { if (log.isDebugEnabled()) { log.debug( "setDeductLatePenalty(" + value + "): was " + deductLatePenalty() ); } Integer actual = er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 ); setDeductLatePenaltyRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>deductLatePenalty</code> value. * @return the value of the attribute */ public Integer deductLatePenaltyRaw() { return (Integer)storedValueForKey( "deductLatePenalty" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>deductLatePenalty</code> * property. * * @param value The new value for this property */ public void setDeductLatePenaltyRaw( Integer value ) { if (log.isDebugEnabled()) { log.debug( "setDeductLatePenaltyRaw(" + value + "): was " + deductLatePenaltyRaw() ); } takeStoredValueForKey( value, "deductLatePenalty" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>earlyBonusMaxPts</code> value. * @return the value of the attribute */ public double earlyBonusMaxPts() { Double returnValue = (Double)storedValueForKey( "earlyBonusMaxPts" ); return ( returnValue == null ) ? 0.0 : returnValue.doubleValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>earlyBonusMaxPts</code> * property. * * @param value The new value for this property */ public void setEarlyBonusMaxPts( double value ) { if (log.isDebugEnabled()) { log.debug( "setEarlyBonusMaxPts(" + value + "): was " + earlyBonusMaxPts() ); } Double actual = new Double( value ); setEarlyBonusMaxPtsRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>earlyBonusMaxPts</code> value. * @return the value of the attribute */ public Double earlyBonusMaxPtsRaw() { return (Double)storedValueForKey( "earlyBonusMaxPts" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>earlyBonusMaxPts</code> * property. * * @param value The new value for this property */ public void setEarlyBonusMaxPtsRaw( Double value ) { if (log.isDebugEnabled()) { log.debug( "setEarlyBonusMaxPtsRaw(" + value + "): was " + earlyBonusMaxPtsRaw() ); } takeStoredValueForKey( value, "earlyBonusMaxPts" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>earlyBonusUnitPts</code> value. * @return the value of the attribute */ public double earlyBonusUnitPts() { Double returnValue = (Double)storedValueForKey( "earlyBonusUnitPts" ); return ( returnValue == null ) ? 0.0 : returnValue.doubleValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>earlyBonusUnitPts</code> * property. * * @param value The new value for this property */ public void setEarlyBonusUnitPts( double value ) { if (log.isDebugEnabled()) { log.debug( "setEarlyBonusUnitPts(" + value + "): was " + earlyBonusUnitPts() ); } Double actual = new Double( value ); setEarlyBonusUnitPtsRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>earlyBonusUnitPts</code> value. * @return the value of the attribute */ public Double earlyBonusUnitPtsRaw() { return (Double)storedValueForKey( "earlyBonusUnitPts" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>earlyBonusUnitPts</code> * property. * * @param value The new value for this property */ public void setEarlyBonusUnitPtsRaw( Double value ) { if (log.isDebugEnabled()) { log.debug( "setEarlyBonusUnitPtsRaw(" + value + "): was " + earlyBonusUnitPtsRaw() ); } takeStoredValueForKey( value, "earlyBonusUnitPts" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>earlyBonusUnitTime</code> value. * @return the value of the attribute */ public long earlyBonusUnitTime() { Long returnValue = (Long)storedValueForKey( "earlyBonusUnitTime" ); return ( returnValue == null ) ? 0L : returnValue.longValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>earlyBonusUnitTime</code> * property. * * @param value The new value for this property */ public void setEarlyBonusUnitTime( long value ) { if (log.isDebugEnabled()) { log.debug( "setEarlyBonusUnitTime(" + value + "): was " + earlyBonusUnitTime() ); } Long actual = new Long( value ); setEarlyBonusUnitTimeRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>earlyBonusUnitTime</code> value. * @return the value of the attribute */ public Long earlyBonusUnitTimeRaw() { return (Long)storedValueForKey( "earlyBonusUnitTime" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>earlyBonusUnitTime</code> * property. * * @param value The new value for this property */ public void setEarlyBonusUnitTimeRaw( Long value ) { if (log.isDebugEnabled()) { log.debug( "setEarlyBonusUnitTimeRaw(" + value + "): was " + earlyBonusUnitTimeRaw() ); } takeStoredValueForKey( value, "earlyBonusUnitTime" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>excludedFilePatterns</code> value. * @return the value of the attribute */ public String excludedFilePatterns() { return (String)storedValueForKey( "excludedFilePatterns" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>excludedFilePatterns</code> * property. * * @param value The new value for this property */ public void setExcludedFilePatterns( String value ) { if (log.isDebugEnabled()) { log.debug( "setExcludedFilePatterns(" + value + "): was " + excludedFilePatterns() ); } takeStoredValueForKey( value, "excludedFilePatterns" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>includedFilePatterns</code> value. * @return the value of the attribute */ public String includedFilePatterns() { return (String)storedValueForKey( "includedFilePatterns" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>includedFilePatterns</code> * property. * * @param value The new value for this property */ public void setIncludedFilePatterns( String value ) { if (log.isDebugEnabled()) { log.debug( "setIncludedFilePatterns(" + value + "): was " + includedFilePatterns() ); } takeStoredValueForKey( value, "includedFilePatterns" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>latePenaltyMaxPts</code> value. * @return the value of the attribute */ public double latePenaltyMaxPts() { Double returnValue = (Double)storedValueForKey( "latePenaltyMaxPts" ); return ( returnValue == null ) ? 0.0 : returnValue.doubleValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>latePenaltyMaxPts</code> * property. * * @param value The new value for this property */ public void setLatePenaltyMaxPts( double value ) { if (log.isDebugEnabled()) { log.debug( "setLatePenaltyMaxPts(" + value + "): was " + latePenaltyMaxPts() ); } Double actual = new Double( value ); setLatePenaltyMaxPtsRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>latePenaltyMaxPts</code> value. * @return the value of the attribute */ public Double latePenaltyMaxPtsRaw() { return (Double)storedValueForKey( "latePenaltyMaxPts" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>latePenaltyMaxPts</code> * property. * * @param value The new value for this property */ public void setLatePenaltyMaxPtsRaw( Double value ) { if (log.isDebugEnabled()) { log.debug( "setLatePenaltyMaxPtsRaw(" + value + "): was " + latePenaltyMaxPtsRaw() ); } takeStoredValueForKey( value, "latePenaltyMaxPts" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>latePenaltyUnitPts</code> value. * @return the value of the attribute */ public double latePenaltyUnitPts() { Double returnValue = (Double)storedValueForKey( "latePenaltyUnitPts" ); return ( returnValue == null ) ? 0.0 : returnValue.doubleValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>latePenaltyUnitPts</code> * property. * * @param value The new value for this property */ public void setLatePenaltyUnitPts( double value ) { if (log.isDebugEnabled()) { log.debug( "setLatePenaltyUnitPts(" + value + "): was " + latePenaltyUnitPts() ); } Double actual = new Double( value ); setLatePenaltyUnitPtsRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>latePenaltyUnitPts</code> value. * @return the value of the attribute */ public Double latePenaltyUnitPtsRaw() { return (Double)storedValueForKey( "latePenaltyUnitPts" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>latePenaltyUnitPts</code> * property. * * @param value The new value for this property */ public void setLatePenaltyUnitPtsRaw( Double value ) { if (log.isDebugEnabled()) { log.debug( "setLatePenaltyUnitPtsRaw(" + value + "): was " + latePenaltyUnitPtsRaw() ); } takeStoredValueForKey( value, "latePenaltyUnitPts" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>latePenaltyUnitTime</code> value. * @return the value of the attribute */ public long latePenaltyUnitTime() { Long returnValue = (Long)storedValueForKey( "latePenaltyUnitTime" ); return ( returnValue == null ) ? 0L : returnValue.longValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>latePenaltyUnitTime</code> * property. * * @param value The new value for this property */ public void setLatePenaltyUnitTime( long value ) { if (log.isDebugEnabled()) { log.debug( "setLatePenaltyUnitTime(" + value + "): was " + latePenaltyUnitTime() ); } Long actual = new Long( value ); setLatePenaltyUnitTimeRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>latePenaltyUnitTime</code> value. * @return the value of the attribute */ public Long latePenaltyUnitTimeRaw() { return (Long)storedValueForKey( "latePenaltyUnitTime" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>latePenaltyUnitTime</code> * property. * * @param value The new value for this property */ public void setLatePenaltyUnitTimeRaw( Long value ) { if (log.isDebugEnabled()) { log.debug( "setLatePenaltyUnitTimeRaw(" + value + "): was " + latePenaltyUnitTimeRaw() ); } takeStoredValueForKey( value, "latePenaltyUnitTime" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>maxFileUploadSize</code> value. * @return the value of the attribute */ public long maxFileUploadSize() { Long returnValue = (Long)storedValueForKey( "maxFileUploadSize" ); return ( returnValue == null ) ? 0L : returnValue.longValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>maxFileUploadSize</code> * property. * * @param value The new value for this property */ public void setMaxFileUploadSize( long value ) { if (log.isDebugEnabled()) { log.debug( "setMaxFileUploadSize(" + value + "): was " + maxFileUploadSize() ); } Long actual = new Long( value ); setMaxFileUploadSizeRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>maxFileUploadSize</code> value. * @return the value of the attribute */ public Long maxFileUploadSizeRaw() { return (Long)storedValueForKey( "maxFileUploadSize" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>maxFileUploadSize</code> * property. * * @param value The new value for this property */ public void setMaxFileUploadSizeRaw( Long value ) { if (log.isDebugEnabled()) { log.debug( "setMaxFileUploadSizeRaw(" + value + "): was " + maxFileUploadSizeRaw() ); } takeStoredValueForKey( value, "maxFileUploadSize" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>maxSubmissions</code> value. * @return the value of the attribute */ public int maxSubmissions() { Integer returnValue = (Integer)storedValueForKey( "maxSubmissions" ); return ( returnValue == null ) ? 0 : returnValue.intValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>maxSubmissions</code> * property. * * @param value The new value for this property */ public void setMaxSubmissions( int value ) { if (log.isDebugEnabled()) { log.debug( "setMaxSubmissions(" + value + "): was " + maxSubmissions() ); } Integer actual = er.extensions.eof.ERXConstant.integerForInt( value ); setMaxSubmissionsRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>maxSubmissions</code> value. * @return the value of the attribute */ public Integer maxSubmissionsRaw() { return (Integer)storedValueForKey( "maxSubmissions" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>maxSubmissions</code> * property. * * @param value The new value for this property */ public void setMaxSubmissionsRaw( Integer value ) { if (log.isDebugEnabled()) { log.debug( "setMaxSubmissionsRaw(" + value + "): was " + maxSubmissionsRaw() ); } takeStoredValueForKey( value, "maxSubmissions" ); } // ---------------------------------------------------------- /** * 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>requiredFilePatterns</code> value. * @return the value of the attribute */ public String requiredFilePatterns() { return (String)storedValueForKey( "requiredFilePatterns" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>requiredFilePatterns</code> * property. * * @param value The new value for this property */ public void setRequiredFilePatterns( String value ) { if (log.isDebugEnabled()) { log.debug( "setRequiredFilePatterns(" + value + "): was " + requiredFilePatterns() ); } takeStoredValueForKey( value, "requiredFilePatterns" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>scoreFormat</code> value. * @return the value of the attribute */ public String scoreFormat() { return (String)storedValueForKey( "scoreFormat" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>scoreFormat</code> * property. * * @param value The new value for this property */ public void setScoreFormat( String value ) { if (log.isDebugEnabled()) { log.debug( "setScoreFormat(" + value + "): was " + scoreFormat() ); } takeStoredValueForKey( value, "scoreFormat" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>taPoints</code> value. * @return the value of the attribute */ public double taPoints() { Double returnValue = (Double)storedValueForKey( "taPoints" ); return ( returnValue == null ) ? 0.0 : returnValue.doubleValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>taPoints</code> * property. * * @param value The new value for this property */ public void setTaPoints( double value ) { if (log.isDebugEnabled()) { log.debug( "setTaPoints(" + value + "): was " + taPoints() ); } Double actual = new Double( value ); setTaPointsRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>taPoints</code> value. * @return the value of the attribute */ public Double taPointsRaw() { return (Double)storedValueForKey( "taPoints" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>taPoints</code> * property. * * @param value The new value for this property */ public void setTaPointsRaw( Double value ) { if (log.isDebugEnabled()) { log.debug( "setTaPointsRaw(" + value + "): was " + taPointsRaw() ); } takeStoredValueForKey( value, "taPoints" ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>toolPoints</code> value. * @return the value of the attribute */ public double toolPoints() { Double returnValue = (Double)storedValueForKey( "toolPoints" ); return ( returnValue == null ) ? 0.0 : returnValue.doubleValue(); } // ---------------------------------------------------------- /** * Change the value of this object's <code>toolPoints</code> * property. * * @param value The new value for this property */ public void setToolPoints( double value ) { if (log.isDebugEnabled()) { log.debug( "setToolPoints(" + value + "): was " + toolPoints() ); } Double actual = new Double( value ); setToolPointsRaw( actual ); } // ---------------------------------------------------------- /** * Retrieve this object's <code>toolPoints</code> value. * @return the value of the attribute */ public Double toolPointsRaw() { return (Double)storedValueForKey( "toolPoints" ); } // ---------------------------------------------------------- /** * Change the value of this object's <code>toolPoints</code> * property. * * @param value The new value for this property */ public void setToolPointsRaw( Double value ) { if (log.isDebugEnabled()) { log.debug( "setToolPointsRaw(" + value + "): was " + toolPointsRaw() ); } takeStoredValueForKey( value, "toolPoints" ); } // ---------------------------------------------------------- /** * 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 the entities pointed to by the <code>courseOfferings</code> * relationship. * @return an NSArray of the entities in the relationship */ @SuppressWarnings("unchecked") public NSArray<org.webcat.core.CourseOffering> courseOfferings() { return (NSArray)storedValueForKey( "courseOfferings" ); } // ---------------------------------------------------------- /** * Replace the list of entities pointed to by the * <code>courseOfferings</code> relationship. * * @param value The new set of entities to relate to */ public void setCourseOfferings( NSMutableArray<org.webcat.core.CourseOffering> value ) { if (log.isDebugEnabled()) { log.debug( "setCourseOfferings(" + value + "): was " + courseOfferings() ); } takeStoredValueForKey( value, "courseOfferings" ); } // ---------------------------------------------------------- /** * Add a new entity to the <code>courseOfferings</code> * relationship (DO NOT USE--instead, use * <code>addToCourseOfferingsRelationship()</code>. * This method is provided for WebObjects use. * * @param value The new entity to relate to */ public void addToCourseOfferings( org.webcat.core.CourseOffering value ) { if (log.isDebugEnabled()) { log.debug( "addToCourseOfferings(" + value + "): was " + courseOfferings() ); } NSMutableArray<org.webcat.core.CourseOffering> array = (NSMutableArray<org.webcat.core.CourseOffering>)courseOfferings(); willChange(); array.addObject( value ); } // ---------------------------------------------------------- /** * Remove a specific entity from the <code>courseOfferings</code> * relationship (DO NOT USE--instead, use * <code>removeFromCourseOfferingsRelationship()</code>. * This method is provided for WebObjects use. * * @param value The entity to remove from the relationship */ public void removeFromCourseOfferings( org.webcat.core.CourseOffering value ) { if (log.isDebugEnabled()) { log.debug( "RemoveFromCourseOfferings(" + value + "): was " + courseOfferings() ); } NSMutableArray<org.webcat.core.CourseOffering> array = (NSMutableArray<org.webcat.core.CourseOffering>)courseOfferings(); willChange(); array.removeObject( value ); } // ---------------------------------------------------------- /** * Add a new entity to the <code>courseOfferings</code> * relationship. * * @param value The new entity to relate to */ public void addToCourseOfferingsRelationship( org.webcat.core.CourseOffering value ) { if (log.isDebugEnabled()) { log.debug( "addToCourseOfferingsRelationship(" + value + "): was " + courseOfferings() ); } addObjectToBothSidesOfRelationshipWithKey( value, "courseOfferings" ); } // ---------------------------------------------------------- /** * Remove a specific entity from the <code>courseOfferings</code> * relationship. * * @param value The entity to remove from the relationship */ public void removeFromCourseOfferingsRelationship( org.webcat.core.CourseOffering value ) { if (log.isDebugEnabled()) { log.debug( "removeFromCourseOfferingsRelationship(" + value + "): was " + courseOfferings() ); } removeObjectFromBothSidesOfRelationshipWithKey( value, "courseOfferings" ); } // ---------------------------------------------------------- /** * Create a brand new object that is a member of the * <code>courseOfferings</code> relationship. * * @return The new entity */ public org.webcat.core.CourseOffering createCourseOfferingsRelationship() { if (log.isDebugEnabled()) { log.debug( "createCourseOfferingsRelationship()" ); } EOClassDescription eoClassDesc = EOClassDescription .classDescriptionForEntityName( "CourseOffering" ); EOEnterpriseObject eoObject = eoClassDesc .createInstanceWithEditingContext( editingContext(), null ); editingContext().insertObject( eoObject ); addObjectToBothSidesOfRelationshipWithKey( eoObject, "courseOfferings" ); return (org.webcat.core.CourseOffering)eoObject; } // ---------------------------------------------------------- /** * Remove and then delete a specific entity that is a member of the * <code>courseOfferings</code> relationship. * * @param value The entity to remove from the relationship and then delete */ public void deleteCourseOfferingsRelationship( org.webcat.core.CourseOffering value ) { if (log.isDebugEnabled()) { log.debug( "deleteCourseOfferingsRelationship(" + value + "): was " + courseOfferings() ); } removeObjectFromBothSidesOfRelationshipWithKey( value, "courseOfferings" ); editingContext().deleteObject( value ); } // ---------------------------------------------------------- /** * Remove (and then delete, if owned) all entities that are members of the * <code>courseOfferings</code> relationship. */ public void deleteAllCourseOfferingsRelationships() { if (log.isDebugEnabled()) { log.debug( "deleteAllCourseOfferingsRelationships(): was " + courseOfferings() ); } for (org.webcat.core.CourseOffering object : courseOfferings()) { deleteCourseOfferingsRelationship(object); } } // ---------------------------------------------------------- /** * Retrieve 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<SubmissionProfile> 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<SubmissionProfile> 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<SubmissionProfile> 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<SubmissionProfile> 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 SubmissionProfile firstObjectMatchingQualifier( EOEditingContext context, EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) { NSArray<SubmissionProfile> 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 SubmissionProfile uniqueObjectMatchingQualifier( EOEditingContext context, EOQualifier qualifier) throws EOUtilities.MoreThanOneException { NSArray<SubmissionProfile> objects = objectsMatchingQualifier(context, qualifier); if (objects.size() > 1) { String msg = "fetching SubmissionProfile"; 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<SubmissionProfile> 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<SubmissionProfile> 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 SubmissionProfile 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 SubmissionProfile 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<SubmissionProfile> 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 SubmissionProfile 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 SubmissionProfile uniqueObjectMatchingValues( EOEditingContext context, NSDictionary<String, Object> keysAndValues) throws EOUtilities.MoreThanOneException { try { return (SubmissionProfile)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>profilesForCourse</code> * fetch specification. * * @param context The editing context to use * @param courseBinding fetch spec parameter * @return an NSArray of the entities retrieved */ public static NSArray<SubmissionProfile> profilesForCourse( EOEditingContext context, org.webcat.core.Course courseBinding) { EOFetchSpecification spec = WCFetchSpecification .fetchSpecificationNamed("profilesForCourse", "SubmissionProfile"); NSMutableDictionary<String, Object> bindings = new NSMutableDictionary<String, Object>(); if (courseBinding != null) { bindings.setObjectForKey(courseBinding, "course"); } spec = spec.fetchSpecificationWithQualifierBindings(bindings); NSArray<SubmissionProfile> objects = objectsWithFetchSpecification(context, spec); if (log.isDebugEnabled()) { log.debug("profilesForCourse(ec" + ", " + courseBinding + "): " + objects); } return objects; } // ---------------------------------------------------------- /** * Retrieve objects according to the <code>profilesForUser</code> * fetch specification. * * @param context The editing context to use * @param userBinding fetch spec parameter * @return an NSArray of the entities retrieved */ public static NSArray<SubmissionProfile> profilesForUser( EOEditingContext context, org.webcat.core.User userBinding) { EOFetchSpecification spec = WCFetchSpecification .fetchSpecificationNamed("profilesForUser", "SubmissionProfile"); NSMutableDictionary<String, Object> bindings = new NSMutableDictionary<String, Object>(); if (userBinding != null) { bindings.setObjectForKey(userBinding, "user"); } spec = spec.fetchSpecificationWithQualifierBindings(bindings); NSArray<SubmissionProfile> objects = objectsWithFetchSpecification(context, spec); if (log.isDebugEnabled()) { log.debug("profilesForUser(ec" + ", " + 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(SubmissionProfile.class); }