/*==========================================================================*\
| _SendMessageJob.java
|*-------------------------------------------------------------------------*|
| Created by eogenerator
| DO NOT EDIT. Make changes to SendMessageJob.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.notifications;
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
* SendMessageJob.java.
*
* @author Generated by eogenerator
* @version version suppressed to control auto-generation
*/
public abstract class _SendMessageJob
extends org.webcat.jobqueue.JobBase
implements org.webcat.core.MutableContainer.MutableContainerOwner
{
//~ Constructors ..........................................................
// ----------------------------------------------------------
/**
* Creates a new _SendMessageJob object.
*/
public _SendMessageJob()
{
super();
}
// ----------------------------------------------------------
/**
* A static factory method for creating a new
* SendMessageJob object given required
* attributes and relationships.
* @param editingContext The context in which the new object will be
* inserted
* @param enqueueTimeValue
* @param isCancelledValue
* @param isReadyValue
* @param isSevereValue
* @param updateMutableFieldsValue
* @return The newly created object
*/
public static SendMessageJob create(
EOEditingContext editingContext,
NSTimestamp enqueueTimeValue,
boolean isCancelledValue,
boolean isReadyValue,
boolean isSevereValue,
boolean updateMutableFieldsValue
)
{
SendMessageJob eoObject = (SendMessageJob)
EOUtilities.createAndInsertInstance(
editingContext,
_SendMessageJob.ENTITY_NAME);
eoObject.setEnqueueTime(enqueueTimeValue);
eoObject.setIsCancelled(isCancelledValue);
eoObject.setIsReady(isReadyValue);
eoObject.setIsSevere(isSevereValue);
eoObject.setUpdateMutableFields(updateMutableFieldsValue);
return eoObject;
}
// ----------------------------------------------------------
/**
* Get a local instance of the given object in another editing context.
* @param editingContext The target editing context
* @param eo The object to import
* @return An instance of the given object in the target editing context
*/
public static SendMessageJob localInstance(
EOEditingContext editingContext, SendMessageJob eo)
{
return (eo == null)
? null
: (SendMessageJob)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 SendMessageJob forId(
EOEditingContext ec, int id)
{
SendMessageJob obj = null;
if (id > 0)
{
NSArray<SendMessageJob> 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 SendMessageJob forId(
EOEditingContext ec, String id)
{
return forId(ec, er.extensions.foundation.ERXValueUtilities.intValue(id));
}
//~ Constants (for key names) .............................................
// Attributes ---
public static final String ATTACHMENTS_KEY = "attachments";
public static final ERXKey<NSData> attachments =
new ERXKey<NSData>(ATTACHMENTS_KEY);
public static final String BROADCAST_PROTOCOL_SETTINGS_ID_KEY = "broadcastProtocolSettingsId";
public static final ERXKey<Long> broadcastProtocolSettingsId =
new ERXKey<Long>(BROADCAST_PROTOCOL_SETTINGS_ID_KEY);
public static final String BROADCAST_PROTOCOL_SETTINGS_SNAPSHOT_KEY = "broadcastProtocolSettingsSnapshot";
public static final ERXKey<NSData> broadcastProtocolSettingsSnapshot =
new ERXKey<NSData>(BROADCAST_PROTOCOL_SETTINGS_SNAPSHOT_KEY);
public static final String FULL_BODY_KEY = "fullBody";
public static final ERXKey<String> fullBody =
new ERXKey<String>(FULL_BODY_KEY);
public static final String IS_SEVERE_KEY = "isSevere";
public static final ERXKey<Integer> isSevere =
new ERXKey<Integer>(IS_SEVERE_KEY);
public static final String LINKS_KEY = "links";
public static final ERXKey<NSData> links =
new ERXKey<NSData>(LINKS_KEY);
public static final String MESSAGE_TYPE_KEY = "messageType";
public static final ERXKey<String> messageType =
new ERXKey<String>(MESSAGE_TYPE_KEY);
public static final String SHORT_BODY_KEY = "shortBody";
public static final ERXKey<String> shortBody =
new ERXKey<String>(SHORT_BODY_KEY);
public static final String TITLE_KEY = "title";
public static final ERXKey<String> title =
new ERXKey<String>(TITLE_KEY);
public static final String UPDATE_MUTABLE_FIELDS_KEY = "updateMutableFields";
public static final ERXKey<Integer> updateMutableFields =
new ERXKey<Integer>(UPDATE_MUTABLE_FIELDS_KEY);
// To-one relationships ---
public static final String BROADCAST_PROTOCOL_SETTINGS_KEY = "broadcastProtocolSettings";
public static final ERXKey<org.webcat.notifications.ProtocolSettings> broadcastProtocolSettings =
new ERXKey<org.webcat.notifications.ProtocolSettings>(BROADCAST_PROTOCOL_SETTINGS_KEY);
// To-many relationships ---
public static final String DESTINATION_USERS_KEY = "destinationUsers";
public static final ERXKey<org.webcat.core.User> destinationUsers =
new ERXKey<org.webcat.core.User>(DESTINATION_USERS_KEY);
// Fetch specifications ---
public static final String ENTITY_NAME = "SendMessageJob";
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 SendMessageJob localInstance(EOEditingContext editingContext)
{
return (SendMessageJob)EOUtilities.localInstanceOfObject(
editingContext, this);
}
//-- Local mutable cache --
private org.webcat.core.MutableDictionary attachmentsCache;
private NSData attachmentsRawCache;
// ----------------------------------------------------------
/**
* Retrieve this object's <code>attachments</code> value.
* @return the value of the attribute
*/
public org.webcat.core.MutableDictionary attachments()
{
NSData dbValue =
(NSData)storedValueForKey("attachments");
if (attachmentsRawCache != dbValue)
{
if (dbValue != null && dbValue.equals( attachmentsRawCache))
{
// They are still equal, so just update the raw cache
attachmentsRawCache = dbValue;
}
else
{
// Underlying attribute may have changed because
// of a concurrent update through another editing
// context, so throw away current values.
attachmentsRawCache = dbValue;
org.webcat.core.MutableDictionary newValue =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
if ( attachmentsCache != null )
{
attachmentsCache.copyFrom( newValue );
}
else
{
attachmentsCache = newValue;
}
attachmentsCache.setOwner( this );
setUpdateMutableFields( true );
}
}
else if ( dbValue == null && attachmentsCache == null )
{
attachmentsCache =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
attachmentsCache.setOwner( this );
setUpdateMutableFields( true );
}
return attachmentsCache;
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>attachments</code>
* property.
*
* @param value The new value for this property
*/
public void setAttachments( org.webcat.core.MutableDictionary value )
{
if (log.isDebugEnabled())
{
log.debug( "setAttachments("
+ value + ")" );
}
if ( attachmentsCache == null )
{
attachmentsCache = value;
value.setHasChanged( false );
attachmentsRawCache = value.archiveData();
takeStoredValueForKey( attachmentsRawCache, "attachments" );
}
else if ( attachmentsCache != value ) // ( attachmentsCache != null )
{
attachmentsCache.copyFrom( value );
setUpdateMutableFields( true );
}
else // ( attachmentsCache == non-null value )
{
// no nothing
}
}
// ----------------------------------------------------------
/**
* Clear the value of this object's <code>attachments</code>
* property.
*/
public void clearAttachments()
{
if (log.isDebugEnabled())
{
log.debug( "clearAttachments()" );
}
takeStoredValueForKey( null, "attachments" );
attachmentsRawCache = null;
attachmentsCache = null;
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>broadcastProtocolSettingsId</code> value.
* @return the value of the attribute
*/
public Long broadcastProtocolSettingsId()
{
return (Long)storedValueForKey( "broadcastProtocolSettingsId" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>broadcastProtocolSettingsId</code>
* property.
*
* @param value The new value for this property
*/
public void setBroadcastProtocolSettingsId( Long value )
{
if (log.isDebugEnabled())
{
log.debug( "setBroadcastProtocolSettingsId("
+ value + "): was " + broadcastProtocolSettingsId() );
}
takeStoredValueForKey( value, "broadcastProtocolSettingsId" );
}
//-- Local mutable cache --
private org.webcat.core.MutableDictionary broadcastProtocolSettingsSnapshotCache;
private NSData broadcastProtocolSettingsSnapshotRawCache;
// ----------------------------------------------------------
/**
* Retrieve this object's <code>broadcastProtocolSettingsSnapshot</code> value.
* @return the value of the attribute
*/
public org.webcat.core.MutableDictionary broadcastProtocolSettingsSnapshot()
{
NSData dbValue =
(NSData)storedValueForKey("broadcastProtocolSettingsSnapshot");
if (broadcastProtocolSettingsSnapshotRawCache != dbValue)
{
if (dbValue != null && dbValue.equals( broadcastProtocolSettingsSnapshotRawCache))
{
// They are still equal, so just update the raw cache
broadcastProtocolSettingsSnapshotRawCache = dbValue;
}
else
{
// Underlying attribute may have changed because
// of a concurrent update through another editing
// context, so throw away current values.
broadcastProtocolSettingsSnapshotRawCache = dbValue;
org.webcat.core.MutableDictionary newValue =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
if ( broadcastProtocolSettingsSnapshotCache != null )
{
broadcastProtocolSettingsSnapshotCache.copyFrom( newValue );
}
else
{
broadcastProtocolSettingsSnapshotCache = newValue;
}
broadcastProtocolSettingsSnapshotCache.setOwner( this );
setUpdateMutableFields( true );
}
}
else if ( dbValue == null && broadcastProtocolSettingsSnapshotCache == null )
{
broadcastProtocolSettingsSnapshotCache =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
broadcastProtocolSettingsSnapshotCache.setOwner( this );
setUpdateMutableFields( true );
}
return broadcastProtocolSettingsSnapshotCache;
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>broadcastProtocolSettingsSnapshot</code>
* property.
*
* @param value The new value for this property
*/
public void setBroadcastProtocolSettingsSnapshot( org.webcat.core.MutableDictionary value )
{
if (log.isDebugEnabled())
{
log.debug( "setBroadcastProtocolSettingsSnapshot("
+ value + ")" );
}
if ( broadcastProtocolSettingsSnapshotCache == null )
{
broadcastProtocolSettingsSnapshotCache = value;
value.setHasChanged( false );
broadcastProtocolSettingsSnapshotRawCache = value.archiveData();
takeStoredValueForKey( broadcastProtocolSettingsSnapshotRawCache, "broadcastProtocolSettingsSnapshot" );
}
else if ( broadcastProtocolSettingsSnapshotCache != value ) // ( broadcastProtocolSettingsSnapshotCache != null )
{
broadcastProtocolSettingsSnapshotCache.copyFrom( value );
setUpdateMutableFields( true );
}
else // ( broadcastProtocolSettingsSnapshotCache == non-null value )
{
// no nothing
}
}
// ----------------------------------------------------------
/**
* Clear the value of this object's <code>broadcastProtocolSettingsSnapshot</code>
* property.
*/
public void clearBroadcastProtocolSettingsSnapshot()
{
if (log.isDebugEnabled())
{
log.debug( "clearBroadcastProtocolSettingsSnapshot()" );
}
takeStoredValueForKey( null, "broadcastProtocolSettingsSnapshot" );
broadcastProtocolSettingsSnapshotRawCache = null;
broadcastProtocolSettingsSnapshotCache = null;
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>fullBody</code> value.
* @return the value of the attribute
*/
public String fullBody()
{
return (String)storedValueForKey( "fullBody" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>fullBody</code>
* property.
*
* @param value The new value for this property
*/
public void setFullBody( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setFullBody("
+ value + "): was " + fullBody() );
}
takeStoredValueForKey( value, "fullBody" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>isSevere</code> value.
* @return the value of the attribute
*/
public boolean isSevere()
{
Integer returnValue =
(Integer)storedValueForKey( "isSevere" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>isSevere</code>
* property.
*
* @param value The new value for this property
*/
public void setIsSevere( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setIsSevere("
+ value + "): was " + isSevere() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setIsSevereRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>isSevere</code> value.
* @return the value of the attribute
*/
public Integer isSevereRaw()
{
return (Integer)storedValueForKey( "isSevere" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>isSevere</code>
* property.
*
* @param value The new value for this property
*/
public void setIsSevereRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setIsSevereRaw("
+ value + "): was " + isSevereRaw() );
}
takeStoredValueForKey( value, "isSevere" );
}
//-- Local mutable cache --
private org.webcat.core.MutableDictionary linksCache;
private NSData linksRawCache;
// ----------------------------------------------------------
/**
* Retrieve this object's <code>links</code> value.
* @return the value of the attribute
*/
public org.webcat.core.MutableDictionary links()
{
NSData dbValue =
(NSData)storedValueForKey("links");
if (linksRawCache != dbValue)
{
if (dbValue != null && dbValue.equals( linksRawCache))
{
// They are still equal, so just update the raw cache
linksRawCache = dbValue;
}
else
{
// Underlying attribute may have changed because
// of a concurrent update through another editing
// context, so throw away current values.
linksRawCache = dbValue;
org.webcat.core.MutableDictionary newValue =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
if ( linksCache != null )
{
linksCache.copyFrom( newValue );
}
else
{
linksCache = newValue;
}
linksCache.setOwner( this );
setUpdateMutableFields( true );
}
}
else if ( dbValue == null && linksCache == null )
{
linksCache =
org.webcat.core.MutableDictionary
.objectWithArchiveData( dbValue );
linksCache.setOwner( this );
setUpdateMutableFields( true );
}
return linksCache;
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>links</code>
* property.
*
* @param value The new value for this property
*/
public void setLinks( org.webcat.core.MutableDictionary value )
{
if (log.isDebugEnabled())
{
log.debug( "setLinks("
+ value + ")" );
}
if ( linksCache == null )
{
linksCache = value;
value.setHasChanged( false );
linksRawCache = value.archiveData();
takeStoredValueForKey( linksRawCache, "links" );
}
else if ( linksCache != value ) // ( linksCache != null )
{
linksCache.copyFrom( value );
setUpdateMutableFields( true );
}
else // ( linksCache == non-null value )
{
// no nothing
}
}
// ----------------------------------------------------------
/**
* Clear the value of this object's <code>links</code>
* property.
*/
public void clearLinks()
{
if (log.isDebugEnabled())
{
log.debug( "clearLinks()" );
}
takeStoredValueForKey( null, "links" );
linksRawCache = null;
linksCache = null;
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>messageType</code> value.
* @return the value of the attribute
*/
public String messageType()
{
return (String)storedValueForKey( "messageType" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>messageType</code>
* property.
*
* @param value The new value for this property
*/
public void setMessageType( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setMessageType("
+ value + "): was " + messageType() );
}
takeStoredValueForKey( value, "messageType" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>shortBody</code> value.
* @return the value of the attribute
*/
public String shortBody()
{
return (String)storedValueForKey( "shortBody" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>shortBody</code>
* property.
*
* @param value The new value for this property
*/
public void setShortBody( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setShortBody("
+ value + "): was " + shortBody() );
}
takeStoredValueForKey( value, "shortBody" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>title</code> value.
* @return the value of the attribute
*/
public String title()
{
return (String)storedValueForKey( "title" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>title</code>
* property.
*
* @param value The new value for this property
*/
public void setTitle( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setTitle("
+ value + "): was " + title() );
}
takeStoredValueForKey( value, "title" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>updateMutableFields</code> value.
* @return the value of the attribute
*/
public boolean updateMutableFields()
{
Integer returnValue =
(Integer)storedValueForKey( "updateMutableFields" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>updateMutableFields</code>
* property.
*
* @param value The new value for this property
*/
public void setUpdateMutableFields( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setUpdateMutableFields("
+ value + "): was " + updateMutableFields() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setUpdateMutableFieldsRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>updateMutableFields</code> value.
* @return the value of the attribute
*/
public Integer updateMutableFieldsRaw()
{
return (Integer)storedValueForKey( "updateMutableFields" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>updateMutableFields</code>
* property.
*
* @param value The new value for this property
*/
public void setUpdateMutableFieldsRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setUpdateMutableFieldsRaw("
+ value + "): was " + updateMutableFieldsRaw() );
}
takeStoredValueForKey( value, "updateMutableFields" );
}
// ----------------------------------------------------------
/**
* Called just before this object is saved to the database.
*/
public void saveMutables()
{
log.debug("saveMutables()");
if ( attachmentsCache != null
&& attachmentsCache.hasChanged() )
{
attachmentsRawCache = attachmentsCache.archiveData();
takeStoredValueForKey( attachmentsRawCache, "attachments" );
attachmentsCache.setHasChanged( false );
}
if ( broadcastProtocolSettingsSnapshotCache != null
&& broadcastProtocolSettingsSnapshotCache.hasChanged() )
{
broadcastProtocolSettingsSnapshotRawCache = broadcastProtocolSettingsSnapshotCache.archiveData();
takeStoredValueForKey( broadcastProtocolSettingsSnapshotRawCache, "broadcastProtocolSettingsSnapshot" );
broadcastProtocolSettingsSnapshotCache.setHasChanged( false );
}
if ( linksCache != null
&& linksCache.hasChanged() )
{
linksRawCache = linksCache.archiveData();
takeStoredValueForKey( linksRawCache, "links" );
linksCache.setHasChanged( false );
}
setUpdateMutableFields( false );
}
// ----------------------------------------------------------
/**
* Called just before this object is saved to the database.
*/
public void willUpdate()
{
log.debug("willUpdate()");
saveMutables();
super.willUpdate();
}
// ----------------------------------------------------------
/**
* Called just before this object is inserted into the database.
*/
public void willInsert()
{
log.debug("willInsert()");
saveMutables();
super.willInsert();
}
// ----------------------------------------------------------
/**
* Called when the object is invalidated.
*/
public void flushCaches()
{
log.debug("flushCaches()");
attachmentsCache = null;
attachmentsRawCache = null;
broadcastProtocolSettingsSnapshotCache = null;
broadcastProtocolSettingsSnapshotRawCache = null;
linksCache = null;
linksRawCache = null;
super.flushCaches();
}
// ----------------------------------------------------------
/**
* Called when an owned mutable container object is changed.
*/
public void mutableContainerHasChanged()
{
setUpdateMutableFields( true );
}
// ----------------------------------------------------------
/**
* Retrieve the entity pointed to by the <code>broadcastProtocolSettings</code>
* relationship.
* @return the entity in the relationship
*/
public org.webcat.notifications.ProtocolSettings broadcastProtocolSettings()
{
return (org.webcat.notifications.ProtocolSettings)storedValueForKey( "broadcastProtocolSettings" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>broadcastProtocolSettings</code>
* relationship (DO NOT USE--instead, use
* <code>setBroadcastProtocolSettingsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void setBroadcastProtocolSettings( org.webcat.notifications.ProtocolSettings value )
{
if (log.isDebugEnabled())
{
log.debug( "setBroadcastProtocolSettings("
+ value + "): was " + broadcastProtocolSettings() );
}
takeStoredValueForKey( value, "broadcastProtocolSettings" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>broadcastProtocolSettings</code>
* relationship. This method is a type-safe version of
* <code>addObjectToBothSidesOfRelationshipWithKey()</code>.
*
* @param value The new entity to relate to
*/
public void setBroadcastProtocolSettingsRelationship(
org.webcat.notifications.ProtocolSettings value )
{
if (log.isDebugEnabled())
{
log.debug( "setBroadcastProtocolSettingsRelationship("
+ value + "): was " + broadcastProtocolSettings() );
}
if ( value == null )
{
org.webcat.notifications.ProtocolSettings object = broadcastProtocolSettings();
if ( object != null )
removeObjectFromBothSidesOfRelationshipWithKey( object, "broadcastProtocolSettings" );
}
else
{
addObjectToBothSidesOfRelationshipWithKey( value, "broadcastProtocolSettings" );
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>destinationUsers</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.core.User> destinationUsers()
{
return (NSArray)storedValueForKey( "destinationUsers" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>destinationUsers</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setDestinationUsers( NSMutableArray<org.webcat.core.User> value )
{
if (log.isDebugEnabled())
{
log.debug( "setDestinationUsers("
+ value + "): was " + destinationUsers() );
}
takeStoredValueForKey( value, "destinationUsers" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>destinationUsers</code>
* relationship (DO NOT USE--instead, use
* <code>addToDestinationUsersRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToDestinationUsers( org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "addToDestinationUsers("
+ value + "): was " + destinationUsers() );
}
NSMutableArray<org.webcat.core.User> array =
(NSMutableArray<org.webcat.core.User>)destinationUsers();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>destinationUsers</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromDestinationUsersRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromDestinationUsers( org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromDestinationUsers("
+ value + "): was " + destinationUsers() );
}
NSMutableArray<org.webcat.core.User> array =
(NSMutableArray<org.webcat.core.User>)destinationUsers();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>destinationUsers</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToDestinationUsersRelationship( org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "addToDestinationUsersRelationship("
+ value + "): was " + destinationUsers() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "destinationUsers" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>destinationUsers</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromDestinationUsersRelationship( org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromDestinationUsersRelationship("
+ value + "): was " + destinationUsers() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "destinationUsers" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>destinationUsers</code> relationship.
*
* @return The new entity
*/
public org.webcat.core.User createDestinationUsersRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createDestinationUsersRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "User" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "destinationUsers" );
return (org.webcat.core.User)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>destinationUsers</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteDestinationUsersRelationship( org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteDestinationUsersRelationship("
+ value + "): was " + destinationUsers() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "destinationUsers" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>destinationUsers</code> relationship.
*/
public void deleteAllDestinationUsersRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllDestinationUsersRelationships(): was "
+ destinationUsers() );
}
for (org.webcat.core.User object : destinationUsers())
{
deleteDestinationUsersRelationship(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<SendMessageJob> 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<SendMessageJob> 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<SendMessageJob> 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<SendMessageJob> 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 SendMessageJob firstObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier,
NSArray<EOSortOrdering> sortOrderings)
{
NSArray<SendMessageJob> 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 SendMessageJob uniqueObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier) throws EOUtilities.MoreThanOneException
{
NSArray<SendMessageJob> objects =
objectsMatchingQualifier(context, qualifier);
if (objects.size() > 1)
{
String msg = "fetching SendMessageJob";
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<SendMessageJob> 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<SendMessageJob> 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 SendMessageJob 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 SendMessageJob 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<SendMessageJob> 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 SendMessageJob 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 SendMessageJob uniqueObjectMatchingValues(
EOEditingContext context,
NSDictionary<String, Object> keysAndValues)
throws EOUtilities.MoreThanOneException
{
try
{
return (SendMessageJob)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(SendMessageJob.class);
}