/*==========================================================================*\
| _ReportTemplate.java
|*-------------------------------------------------------------------------*|
| Created by eogenerator
| DO NOT EDIT. Make changes to ReportTemplate.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.reporter;
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
* ReportTemplate.java.
*
* @author Generated by eogenerator
* @version version suppressed to control auto-generation
*/
public abstract class _ReportTemplate
extends org.webcat.core.EOBase
implements org.webcat.core.MutableContainer.MutableContainerOwner
{
//~ Constructors ..........................................................
// ----------------------------------------------------------
/**
* Creates a new _ReportTemplate object.
*/
public _ReportTemplate()
{
super();
}
// ----------------------------------------------------------
/**
* A static factory method for creating a new
* ReportTemplate object given required
* attributes and relationships.
* @param editingContext The context in which the new object will be
* inserted
* @param isPublishedValue
* @param updateMutableFieldsValue
* @return The newly created object
*/
public static ReportTemplate create(
EOEditingContext editingContext,
boolean isPublishedValue,
boolean updateMutableFieldsValue
)
{
ReportTemplate eoObject = (ReportTemplate)
EOUtilities.createAndInsertInstance(
editingContext,
_ReportTemplate.ENTITY_NAME);
eoObject.setIsPublished(isPublishedValue);
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 ReportTemplate localInstance(
EOEditingContext editingContext, ReportTemplate eo)
{
return (eo == null)
? null
: (ReportTemplate)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 ReportTemplate forId(
EOEditingContext ec, int id)
{
ReportTemplate obj = null;
if (id > 0)
{
NSArray<ReportTemplate> 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 ReportTemplate forId(
EOEditingContext ec, String id)
{
return forId(ec, er.extensions.foundation.ERXValueUtilities.intValue(id));
}
//~ Constants (for key names) .............................................
// Attributes ---
public static final String CHANGE_HISTORY_KEY = "changeHistory";
public static final ERXKey<String> changeHistory =
new ERXKey<String>(CHANGE_HISTORY_KEY);
public static final String CHECKSUM_KEY = "checksum";
public static final ERXKey<String> checksum =
new ERXKey<String>(CHECKSUM_KEY);
public static final String DESCRIPTION_KEY = "description";
public static final ERXKey<String> description =
new ERXKey<String>(DESCRIPTION_KEY);
public static final String DESIGN_ELEMENTS_RAW_KEY = "designElementsRaw";
public static final ERXKey<String> designElementsRaw =
new ERXKey<String>(DESIGN_ELEMENTS_RAW_KEY);
public static final String IS_PUBLISHED_KEY = "isPublished";
public static final ERXKey<Integer> isPublished =
new ERXKey<Integer>(IS_PUBLISHED_KEY);
public static final String LANGUAGE_KEY = "language";
public static final ERXKey<String> language =
new ERXKey<String>(LANGUAGE_KEY);
public static final String NAME_KEY = "name";
public static final ERXKey<String> name =
new ERXKey<String>(NAME_KEY);
public static final String PARAMETERS_KEY = "parameters";
public static final ERXKey<NSData> parameters =
new ERXKey<NSData>(PARAMETERS_KEY);
public static final String PREFERRED_RENDERER_KEY = "preferredRenderer";
public static final ERXKey<String> preferredRenderer =
new ERXKey<String>(PREFERRED_RENDERER_KEY);
public static final String UPDATE_MUTABLE_FIELDS_KEY = "updateMutableFields";
public static final ERXKey<Integer> updateMutableFields =
new ERXKey<Integer>(UPDATE_MUTABLE_FIELDS_KEY);
public static final String UPLOADED_TIME_KEY = "uploadedTime";
public static final ERXKey<NSTimestamp> uploadedTime =
new ERXKey<NSTimestamp>(UPLOADED_TIME_KEY);
public static final String VERSION_KEY = "version";
public static final ERXKey<String> version =
new ERXKey<String>(VERSION_KEY);
// To-one relationships ---
public static final String BRANCHED_FROM_TEMPLATE_KEY = "branchedFromTemplate";
public static final ERXKey<org.webcat.reporter.ReportTemplate> branchedFromTemplate =
new ERXKey<org.webcat.reporter.ReportTemplate>(BRANCHED_FROM_TEMPLATE_KEY);
public static final String PREDECESSOR_TEMPLATE_KEY = "predecessorTemplate";
public static final ERXKey<org.webcat.reporter.ReportTemplate> predecessorTemplate =
new ERXKey<org.webcat.reporter.ReportTemplate>(PREDECESSOR_TEMPLATE_KEY);
public static final String ROOT_TEMPLATE_KEY = "rootTemplate";
public static final ERXKey<org.webcat.reporter.ReportTemplate> rootTemplate =
new ERXKey<org.webcat.reporter.ReportTemplate>(ROOT_TEMPLATE_KEY);
public static final String USER_KEY = "user";
public static final ERXKey<org.webcat.core.User> user =
new ERXKey<org.webcat.core.User>(USER_KEY);
// To-many relationships ---
public static final String BRANCHED_TEMPLATES_KEY = "branchedTemplates";
public static final ERXKey<org.webcat.reporter.ReportTemplate> branchedTemplates =
new ERXKey<org.webcat.reporter.ReportTemplate>(BRANCHED_TEMPLATES_KEY);
public static final String DATA_SETS_KEY = "dataSets";
public static final ERXKey<org.webcat.reporter.ReportDataSet> dataSets =
new ERXKey<org.webcat.reporter.ReportDataSet>(DATA_SETS_KEY);
// Fetch specifications ---
public static final String ALL_TEMPLATES_ORDERED_BY_NAME_FSPEC = "allTemplatesOrderedByName";
public static final String PUBLISHED_TEMPLATES_FSPEC = "publishedTemplates";
public static final String TEMPLATES_FOR_USER_FSPEC = "templatesForUser";
public static final String ENTITY_NAME = "ReportTemplate";
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 ReportTemplate localInstance(EOEditingContext editingContext)
{
return (ReportTemplate)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>changeHistory</code> value.
* @return the value of the attribute
*/
public String changeHistory()
{
return (String)storedValueForKey( "changeHistory" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>changeHistory</code>
* property.
*
* @param value The new value for this property
*/
public void setChangeHistory( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setChangeHistory("
+ value + "): was " + changeHistory() );
}
takeStoredValueForKey( value, "changeHistory" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>checksum</code> value.
* @return the value of the attribute
*/
public String checksum()
{
return (String)storedValueForKey( "checksum" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>checksum</code>
* property.
*
* @param value The new value for this property
*/
public void setChecksum( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setChecksum("
+ value + "): was " + checksum() );
}
takeStoredValueForKey( value, "checksum" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>description</code> value.
* @return the value of the attribute
*/
public String description()
{
return (String)storedValueForKey( "description" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>description</code>
* property.
*
* @param value The new value for this property
*/
public void setDescription( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setDescription("
+ value + "): was " + description() );
}
takeStoredValueForKey( value, "description" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>designElementsRaw</code> value.
* @return the value of the attribute
*/
public String designElementsRaw()
{
return (String)storedValueForKey( "designElementsRaw" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>designElementsRaw</code>
* property.
*
* @param value The new value for this property
*/
public void setDesignElementsRaw( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setDesignElementsRaw("
+ value + "): was " + designElementsRaw() );
}
takeStoredValueForKey( value, "designElementsRaw" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>isPublished</code> value.
* @return the value of the attribute
*/
public boolean isPublished()
{
Integer returnValue =
(Integer)storedValueForKey( "isPublished" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>isPublished</code>
* property.
*
* @param value The new value for this property
*/
public void setIsPublished( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setIsPublished("
+ value + "): was " + isPublished() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setIsPublishedRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>isPublished</code> value.
* @return the value of the attribute
*/
public Integer isPublishedRaw()
{
return (Integer)storedValueForKey( "isPublished" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>isPublished</code>
* property.
*
* @param value The new value for this property
*/
public void setIsPublishedRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setIsPublishedRaw("
+ value + "): was " + isPublishedRaw() );
}
takeStoredValueForKey( value, "isPublished" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>language</code> value.
* @return the value of the attribute
*/
public String language()
{
return (String)storedValueForKey( "language" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>language</code>
* property.
*
* @param value The new value for this property
*/
public void setLanguage( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setLanguage("
+ value + "): was " + language() );
}
takeStoredValueForKey( value, "language" );
}
// ----------------------------------------------------------
/**
* 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" );
}
//-- Local mutable cache --
private org.webcat.core.MutableArray parametersCache;
private NSData parametersRawCache;
// ----------------------------------------------------------
/**
* Retrieve this object's <code>parameters</code> value.
* @return the value of the attribute
*/
public org.webcat.core.MutableArray parameters()
{
NSData dbValue =
(NSData)storedValueForKey("parameters");
if (parametersRawCache != dbValue)
{
if (dbValue != null && dbValue.equals( parametersRawCache))
{
// They are still equal, so just update the raw cache
parametersRawCache = dbValue;
}
else
{
// Underlying attribute may have changed because
// of a concurrent update through another editing
// context, so throw away current values.
parametersRawCache = dbValue;
org.webcat.core.MutableArray newValue =
org.webcat.core.MutableArray
.objectWithArchiveData( dbValue );
if ( parametersCache != null )
{
parametersCache.copyFrom( newValue );
}
else
{
parametersCache = newValue;
}
parametersCache.setOwner( this );
setUpdateMutableFields( true );
}
}
else if ( dbValue == null && parametersCache == null )
{
parametersCache =
org.webcat.core.MutableArray
.objectWithArchiveData( dbValue );
parametersCache.setOwner( this );
setUpdateMutableFields( true );
}
return parametersCache;
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>parameters</code>
* property.
*
* @param value The new value for this property
*/
public void setParameters( org.webcat.core.MutableArray value )
{
if (log.isDebugEnabled())
{
log.debug( "setParameters("
+ value + ")" );
}
if ( parametersCache == null )
{
parametersCache = value;
value.setHasChanged( false );
parametersRawCache = value.archiveData();
takeStoredValueForKey( parametersRawCache, "parameters" );
}
else if ( parametersCache != value ) // ( parametersCache != null )
{
parametersCache.copyFrom( value );
setUpdateMutableFields( true );
}
else // ( parametersCache == non-null value )
{
// no nothing
}
}
// ----------------------------------------------------------
/**
* Clear the value of this object's <code>parameters</code>
* property.
*/
public void clearParameters()
{
if (log.isDebugEnabled())
{
log.debug( "clearParameters()" );
}
takeStoredValueForKey( null, "parameters" );
parametersRawCache = null;
parametersCache = null;
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>preferredRenderer</code> value.
* @return the value of the attribute
*/
public String preferredRenderer()
{
return (String)storedValueForKey( "preferredRenderer" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>preferredRenderer</code>
* property.
*
* @param value The new value for this property
*/
public void setPreferredRenderer( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setPreferredRenderer("
+ value + "): was " + preferredRenderer() );
}
takeStoredValueForKey( value, "preferredRenderer" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>updateMutableFields</code> value.
* @return the value of the attribute
*/
public boolean updateMutableFields()
{
Integer returnValue =
(Integer)storedValueForKey( "updateMutableFields" );
return ( returnValue == null )
? false
: ( returnValue.intValue() > 0 );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>updateMutableFields</code>
* property.
*
* @param value The new value for this property
*/
public void setUpdateMutableFields( boolean value )
{
if (log.isDebugEnabled())
{
log.debug( "setUpdateMutableFields("
+ value + "): was " + updateMutableFields() );
}
Integer actual =
er.extensions.eof.ERXConstant.integerForInt( value ? 1 : 0 );
setUpdateMutableFieldsRaw( actual );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>updateMutableFields</code> value.
* @return the value of the attribute
*/
public Integer updateMutableFieldsRaw()
{
return (Integer)storedValueForKey( "updateMutableFields" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>updateMutableFields</code>
* property.
*
* @param value The new value for this property
*/
public void setUpdateMutableFieldsRaw( Integer value )
{
if (log.isDebugEnabled())
{
log.debug( "setUpdateMutableFieldsRaw("
+ value + "): was " + updateMutableFieldsRaw() );
}
takeStoredValueForKey( value, "updateMutableFields" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>uploadedTime</code> value.
* @return the value of the attribute
*/
public NSTimestamp uploadedTime()
{
return (NSTimestamp)storedValueForKey( "uploadedTime" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>uploadedTime</code>
* property.
*
* @param value The new value for this property
*/
public void setUploadedTime( NSTimestamp value )
{
if (log.isDebugEnabled())
{
log.debug( "setUploadedTime("
+ value + "): was " + uploadedTime() );
}
takeStoredValueForKey( value, "uploadedTime" );
}
// ----------------------------------------------------------
/**
* Retrieve this object's <code>version</code> value.
* @return the value of the attribute
*/
public String version()
{
return (String)storedValueForKey( "version" );
}
// ----------------------------------------------------------
/**
* Change the value of this object's <code>version</code>
* property.
*
* @param value The new value for this property
*/
public void setVersion( String value )
{
if (log.isDebugEnabled())
{
log.debug( "setVersion("
+ value + "): was " + version() );
}
takeStoredValueForKey( value, "version" );
}
// ----------------------------------------------------------
/**
* Called just before this object is saved to the database.
*/
public void saveMutables()
{
log.debug("saveMutables()");
if ( parametersCache != null
&& parametersCache.hasChanged() )
{
parametersRawCache = parametersCache.archiveData();
takeStoredValueForKey( parametersRawCache, "parameters" );
parametersCache.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()");
parametersCache = null;
parametersRawCache = 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>branchedFromTemplate</code>
* relationship.
* @return the entity in the relationship
*/
public org.webcat.reporter.ReportTemplate branchedFromTemplate()
{
return (org.webcat.reporter.ReportTemplate)storedValueForKey( "branchedFromTemplate" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>branchedFromTemplate</code>
* relationship (DO NOT USE--instead, use
* <code>setBranchedFromTemplateRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void setBranchedFromTemplate( org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "setBranchedFromTemplate("
+ value + "): was " + branchedFromTemplate() );
}
takeStoredValueForKey( value, "branchedFromTemplate" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>branchedFromTemplate</code>
* relationship. This method is a type-safe version of
* <code>addObjectToBothSidesOfRelationshipWithKey()</code>.
*
* @param value The new entity to relate to
*/
public void setBranchedFromTemplateRelationship(
org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "setBranchedFromTemplateRelationship("
+ value + "): was " + branchedFromTemplate() );
}
if ( value == null )
{
org.webcat.reporter.ReportTemplate object = branchedFromTemplate();
if ( object != null )
removeObjectFromBothSidesOfRelationshipWithKey( object, "branchedFromTemplate" );
}
else
{
addObjectToBothSidesOfRelationshipWithKey( value, "branchedFromTemplate" );
}
}
// ----------------------------------------------------------
/**
* Retrieve the entity pointed to by the <code>predecessorTemplate</code>
* relationship.
* @return the entity in the relationship
*/
public org.webcat.reporter.ReportTemplate predecessorTemplate()
{
return (org.webcat.reporter.ReportTemplate)storedValueForKey( "predecessorTemplate" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>predecessorTemplate</code>
* relationship (DO NOT USE--instead, use
* <code>setPredecessorTemplateRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void setPredecessorTemplate( org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "setPredecessorTemplate("
+ value + "): was " + predecessorTemplate() );
}
takeStoredValueForKey( value, "predecessorTemplate" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>predecessorTemplate</code>
* relationship. This method is a type-safe version of
* <code>addObjectToBothSidesOfRelationshipWithKey()</code>.
*
* @param value The new entity to relate to
*/
public void setPredecessorTemplateRelationship(
org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "setPredecessorTemplateRelationship("
+ value + "): was " + predecessorTemplate() );
}
if ( value == null )
{
org.webcat.reporter.ReportTemplate object = predecessorTemplate();
if ( object != null )
removeObjectFromBothSidesOfRelationshipWithKey( object, "predecessorTemplate" );
}
else
{
addObjectToBothSidesOfRelationshipWithKey( value, "predecessorTemplate" );
}
}
// ----------------------------------------------------------
/**
* Retrieve the entity pointed to by the <code>rootTemplate</code>
* relationship.
* @return the entity in the relationship
*/
public org.webcat.reporter.ReportTemplate rootTemplate()
{
return (org.webcat.reporter.ReportTemplate)storedValueForKey( "rootTemplate" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>rootTemplate</code>
* relationship (DO NOT USE--instead, use
* <code>setRootTemplateRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void setRootTemplate( org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "setRootTemplate("
+ value + "): was " + rootTemplate() );
}
takeStoredValueForKey( value, "rootTemplate" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>rootTemplate</code>
* relationship. This method is a type-safe version of
* <code>addObjectToBothSidesOfRelationshipWithKey()</code>.
*
* @param value The new entity to relate to
*/
public void setRootTemplateRelationship(
org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "setRootTemplateRelationship("
+ value + "): was " + rootTemplate() );
}
if ( value == null )
{
org.webcat.reporter.ReportTemplate object = rootTemplate();
if ( object != null )
removeObjectFromBothSidesOfRelationshipWithKey( object, "rootTemplate" );
}
else
{
addObjectToBothSidesOfRelationshipWithKey( value, "rootTemplate" );
}
}
// ----------------------------------------------------------
/**
* Retrieve the entity pointed to by the <code>user</code>
* relationship.
* @return the entity in the relationship
*/
public org.webcat.core.User user()
{
return (org.webcat.core.User)storedValueForKey( "user" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>user</code>
* relationship (DO NOT USE--instead, use
* <code>setUserRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void setUser( org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "setUser("
+ value + "): was " + user() );
}
takeStoredValueForKey( value, "user" );
}
// ----------------------------------------------------------
/**
* Set the entity pointed to by the <code>user</code>
* relationship. This method is a type-safe version of
* <code>addObjectToBothSidesOfRelationshipWithKey()</code>.
*
* @param value The new entity to relate to
*/
public void setUserRelationship(
org.webcat.core.User value )
{
if (log.isDebugEnabled())
{
log.debug( "setUserRelationship("
+ value + "): was " + user() );
}
if ( value == null )
{
org.webcat.core.User object = user();
if ( object != null )
removeObjectFromBothSidesOfRelationshipWithKey( object, "user" );
}
else
{
addObjectToBothSidesOfRelationshipWithKey( value, "user" );
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>branchedTemplates</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.reporter.ReportTemplate> branchedTemplates()
{
return (NSArray)storedValueForKey( "branchedTemplates" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>branchedTemplates</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setBranchedTemplates( NSMutableArray<org.webcat.reporter.ReportTemplate> value )
{
if (log.isDebugEnabled())
{
log.debug( "setBranchedTemplates("
+ value + "): was " + branchedTemplates() );
}
takeStoredValueForKey( value, "branchedTemplates" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>branchedTemplates</code>
* relationship (DO NOT USE--instead, use
* <code>addToBranchedTemplatesRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToBranchedTemplates( org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "addToBranchedTemplates("
+ value + "): was " + branchedTemplates() );
}
NSMutableArray<org.webcat.reporter.ReportTemplate> array =
(NSMutableArray<org.webcat.reporter.ReportTemplate>)branchedTemplates();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>branchedTemplates</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromBranchedTemplatesRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromBranchedTemplates( org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromBranchedTemplates("
+ value + "): was " + branchedTemplates() );
}
NSMutableArray<org.webcat.reporter.ReportTemplate> array =
(NSMutableArray<org.webcat.reporter.ReportTemplate>)branchedTemplates();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>branchedTemplates</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToBranchedTemplatesRelationship( org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "addToBranchedTemplatesRelationship("
+ value + "): was " + branchedTemplates() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "branchedTemplates" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>branchedTemplates</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromBranchedTemplatesRelationship( org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromBranchedTemplatesRelationship("
+ value + "): was " + branchedTemplates() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "branchedTemplates" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>branchedTemplates</code> relationship.
*
* @return The new entity
*/
public org.webcat.reporter.ReportTemplate createBranchedTemplatesRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createBranchedTemplatesRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "ReportTemplate" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "branchedTemplates" );
return (org.webcat.reporter.ReportTemplate)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>branchedTemplates</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteBranchedTemplatesRelationship( org.webcat.reporter.ReportTemplate value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteBranchedTemplatesRelationship("
+ value + "): was " + branchedTemplates() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "branchedTemplates" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>branchedTemplates</code> relationship.
*/
public void deleteAllBranchedTemplatesRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllBranchedTemplatesRelationships(): was "
+ branchedTemplates() );
}
for (org.webcat.reporter.ReportTemplate object : branchedTemplates())
{
deleteBranchedTemplatesRelationship(object);
}
}
// ----------------------------------------------------------
/**
* Retrieve the entities pointed to by the <code>dataSets</code>
* relationship.
* @return an NSArray of the entities in the relationship
*/
@SuppressWarnings("unchecked")
public NSArray<org.webcat.reporter.ReportDataSet> dataSets()
{
return (NSArray)storedValueForKey( "dataSets" );
}
// ----------------------------------------------------------
/**
* Replace the list of entities pointed to by the
* <code>dataSets</code> relationship.
*
* @param value The new set of entities to relate to
*/
public void setDataSets( NSMutableArray<org.webcat.reporter.ReportDataSet> value )
{
if (log.isDebugEnabled())
{
log.debug( "setDataSets("
+ value + "): was " + dataSets() );
}
takeStoredValueForKey( value, "dataSets" );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>dataSets</code>
* relationship (DO NOT USE--instead, use
* <code>addToDataSetsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The new entity to relate to
*/
public void addToDataSets( org.webcat.reporter.ReportDataSet value )
{
if (log.isDebugEnabled())
{
log.debug( "addToDataSets("
+ value + "): was " + dataSets() );
}
NSMutableArray<org.webcat.reporter.ReportDataSet> array =
(NSMutableArray<org.webcat.reporter.ReportDataSet>)dataSets();
willChange();
array.addObject( value );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>dataSets</code>
* relationship (DO NOT USE--instead, use
* <code>removeFromDataSetsRelationship()</code>.
* This method is provided for WebObjects use.
*
* @param value The entity to remove from the relationship
*/
public void removeFromDataSets( org.webcat.reporter.ReportDataSet value )
{
if (log.isDebugEnabled())
{
log.debug( "RemoveFromDataSets("
+ value + "): was " + dataSets() );
}
NSMutableArray<org.webcat.reporter.ReportDataSet> array =
(NSMutableArray<org.webcat.reporter.ReportDataSet>)dataSets();
willChange();
array.removeObject( value );
}
// ----------------------------------------------------------
/**
* Add a new entity to the <code>dataSets</code>
* relationship.
*
* @param value The new entity to relate to
*/
public void addToDataSetsRelationship( org.webcat.reporter.ReportDataSet value )
{
if (log.isDebugEnabled())
{
log.debug( "addToDataSetsRelationship("
+ value + "): was " + dataSets() );
}
addObjectToBothSidesOfRelationshipWithKey(
value, "dataSets" );
}
// ----------------------------------------------------------
/**
* Remove a specific entity from the <code>dataSets</code>
* relationship.
*
* @param value The entity to remove from the relationship
*/
public void removeFromDataSetsRelationship( org.webcat.reporter.ReportDataSet value )
{
if (log.isDebugEnabled())
{
log.debug( "removeFromDataSetsRelationship("
+ value + "): was " + dataSets() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "dataSets" );
}
// ----------------------------------------------------------
/**
* Create a brand new object that is a member of the
* <code>dataSets</code> relationship.
*
* @return The new entity
*/
public org.webcat.reporter.ReportDataSet createDataSetsRelationship()
{
if (log.isDebugEnabled())
{
log.debug( "createDataSetsRelationship()" );
}
EOClassDescription eoClassDesc = EOClassDescription
.classDescriptionForEntityName( "ReportDataSet" );
EOEnterpriseObject eoObject = eoClassDesc
.createInstanceWithEditingContext( editingContext(), null );
editingContext().insertObject( eoObject );
addObjectToBothSidesOfRelationshipWithKey(
eoObject, "dataSets" );
return (org.webcat.reporter.ReportDataSet)eoObject;
}
// ----------------------------------------------------------
/**
* Remove and then delete a specific entity that is a member of the
* <code>dataSets</code> relationship.
*
* @param value The entity to remove from the relationship and then delete
*/
public void deleteDataSetsRelationship( org.webcat.reporter.ReportDataSet value )
{
if (log.isDebugEnabled())
{
log.debug( "deleteDataSetsRelationship("
+ value + "): was " + dataSets() );
}
removeObjectFromBothSidesOfRelationshipWithKey(
value, "dataSets" );
editingContext().deleteObject( value );
}
// ----------------------------------------------------------
/**
* Remove (and then delete, if owned) all entities that are members of the
* <code>dataSets</code> relationship.
*/
public void deleteAllDataSetsRelationships()
{
if (log.isDebugEnabled())
{
log.debug( "deleteAllDataSetsRelationships(): was "
+ dataSets() );
}
for (org.webcat.reporter.ReportDataSet object : dataSets())
{
deleteDataSetsRelationship(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<ReportTemplate> 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<ReportTemplate> 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<ReportTemplate> 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<ReportTemplate> 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 ReportTemplate firstObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier,
NSArray<EOSortOrdering> sortOrderings)
{
NSArray<ReportTemplate> 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 ReportTemplate uniqueObjectMatchingQualifier(
EOEditingContext context,
EOQualifier qualifier) throws EOUtilities.MoreThanOneException
{
NSArray<ReportTemplate> objects =
objectsMatchingQualifier(context, qualifier);
if (objects.size() > 1)
{
String msg = "fetching ReportTemplate";
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<ReportTemplate> 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<ReportTemplate> 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 ReportTemplate 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 ReportTemplate 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<ReportTemplate> 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 ReportTemplate 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 ReportTemplate uniqueObjectMatchingValues(
EOEditingContext context,
NSDictionary<String, Object> keysAndValues)
throws EOUtilities.MoreThanOneException
{
try
{
return (ReportTemplate)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>allTemplatesOrderedByName</code>
* fetch specification.
*
* @param context The editing context to use
* @return an NSArray of the entities retrieved
*/
public static NSArray<ReportTemplate> allTemplatesOrderedByName(
EOEditingContext context)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("allTemplatesOrderedByName", "ReportTemplate");
NSArray<ReportTemplate> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("allTemplatesOrderedByName(ec"
+ "): " + objects);
}
return objects;
}
// ----------------------------------------------------------
/**
* Retrieve objects according to the <code>publishedTemplates</code>
* fetch specification.
*
* @param context The editing context to use
* @return an NSArray of the entities retrieved
*/
public static NSArray<ReportTemplate> publishedTemplates(
EOEditingContext context)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("publishedTemplates", "ReportTemplate");
NSArray<ReportTemplate> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("publishedTemplates(ec"
+ "): " + objects);
}
return objects;
}
// ----------------------------------------------------------
/**
* Retrieve objects according to the <code>templatesForUser</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<ReportTemplate> templatesForUser(
EOEditingContext context,
org.webcat.core.User userBinding)
{
EOFetchSpecification spec = WCFetchSpecification
.fetchSpecificationNamed("templatesForUser", "ReportTemplate");
NSMutableDictionary<String, Object> bindings =
new NSMutableDictionary<String, Object>();
if (userBinding != null)
{
bindings.setObjectForKey(userBinding,
"user");
}
spec = spec.fetchSpecificationWithQualifierBindings(bindings);
NSArray<ReportTemplate> objects =
objectsWithFetchSpecification(context, spec);
if (log.isDebugEnabled())
{
log.debug("templatesForUser(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(ReportTemplate.class);
}