Commit fbb0ee82 by Nilu

By default, show only Jobs that are Open and owned by the current user. Include…

By default, show only Jobs that are Open and owned by the current user. Include checkbox (or Boolean slider) to show all Jobs for current Hiring Team that are Open. (See below about how Job Owner is specified)
parent 07d197a7
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">it_does_not_matter</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="xxxx" type="Boolean" nullable="true"/>
<column name="xxxx" type="Long" length="11" nullable="true"/>
<column name="xxxx" type="Long" length="11" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE it_does_not_matter;
CREATE TABLE it_does_not_matter (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
xxxx char(1) NULL,
xxxx numeric(12) NULL,
xxxx numeric(12) NULL
);
ALTER TABLE it_does_not_matter ADD
CONSTRAINT PK_it_does_not_matter PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE it_does_not_matter;
CREATE TABLE it_does_not_matter (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
xxxx char(1) NULL,
xxxx number(12) NULL,
xxxx number(12) NULL
);
ALTER TABLE it_does_not_matter ADD
CONSTRAINT PK_it_does_not_matter PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- @AutoRun
-- drop table it_does_not_matter;
CREATE TABLE it_does_not_matter (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
xxxx char(1) NULL,
xxxx numeric(12) NULL,
xxxx numeric(12) NULL
);
ALTER TABLE it_does_not_matter ADD
CONSTRAINT pk_it_does_not_matter PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.search;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
import oneit.servlets.orm.*;
import performa.orm.*;
public abstract class BaseSearchHome extends SearchExecutor
{
// Reference instance for the object
public static final SearchHome REFERENCE_SearchHome = new SearchHome ();
// Reference instance for the object
public static final SearchHome DUMMY_SearchHome = new DummySearchHome ();
// Static constants corresponding to field names
public static final String FIELD_ShowAllJobs = "ShowAllJobs";
public static final String SINGLEREFERENCE_HiringTeam = "HiringTeam";
public static final String SINGLEREFERENCE_CompanyUser = "CompanyUser";
// Static constants corresponding to searches
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<SearchHome> HELPER_ShowAllJobs = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private Boolean _ShowAllJobs;
// Private attributes corresponding to single references
private SingleAssociation<SearchHome, HiringTeam> _HiringTeam;
private SingleAssociation<SearchHome, CompanyUser> _CompanyUser;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_SearchHome = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_ShowAllJobs_Validators;
// Arrays of behaviour decorators
private static final SearchHomeBehaviourDecorator[] SearchHome_BehaviourDecorators;
static
{
try
{
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_HiringTeam();
setupAssocMetaData_CompanyUser();
FIELD_ShowAllJobs_Validators = (AttributeValidator[])setupAttribMetaData_ShowAllJobs(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_SearchHome.initialiseReference ();
DUMMY_SearchHome.initialiseReference ();
SearchHome_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(SearchHome.class).toArray(new SearchHomeBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static void setupAssocMetaData_HiringTeam()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "xxxx");
metaInfo.put ("name", "HiringTeam");
metaInfo.put ("type", "HiringTeam");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for SearchHome.HiringTeam:", metaInfo);
ATTRIBUTES_METADATA_SearchHome.put (SINGLEREFERENCE_HiringTeam, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_CompanyUser()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "xxxx");
metaInfo.put ("name", "CompanyUser");
metaInfo.put ("type", "CompanyUser");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for SearchHome.CompanyUser:", metaInfo);
ATTRIBUTES_METADATA_SearchHome.put (SINGLEREFERENCE_CompanyUser, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_ShowAllJobs(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "xxxx");
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("name", "ShowAllJobs");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for SearchHome.ShowAllJobs:", metaInfo);
ATTRIBUTES_METADATA_SearchHome.put (FIELD_ShowAllJobs, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(SearchHome.class, "ShowAllJobs", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for SearchHome.ShowAllJobs:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseSearchHome ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return SearchHome_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_ShowAllJobs = (Boolean)(Boolean.FALSE);
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_HiringTeam = new SingleAssociation<SearchHome, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, null, HiringTeam.REFERENCE_HiringTeam, "it_does_not_matter");
_CompanyUser = new SingleAssociation<SearchHome, CompanyUser> (this, SINGLEREFERENCE_CompanyUser, null, CompanyUser.REFERENCE_CompanyUser, "it_does_not_matter");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_HiringTeam = new SingleAssociation<SearchHome, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, null, HiringTeam.REFERENCE_HiringTeam, "it_does_not_matter");
_CompanyUser = new SingleAssociation<SearchHome, CompanyUser> (this, SINGLEREFERENCE_CompanyUser, null, CompanyUser.REFERENCE_CompanyUser, "it_does_not_matter");
return this;
}
/**
* Get the attribute ShowAllJobs
*/
public Boolean getShowAllJobs ()
{
assertValid();
Boolean valToReturn = _ShowAllJobs;
for (SearchHomeBehaviourDecorator bhd : SearchHome_BehaviourDecorators)
{
valToReturn = bhd.getShowAllJobs ((SearchHome)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preShowAllJobsChange (Boolean newShowAllJobs) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postShowAllJobsChange () throws FieldException
{
}
public FieldWriteability getWriteability_ShowAllJobs ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ShowAllJobs. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setShowAllJobs (Boolean newShowAllJobs) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ShowAllJobs.compare (_ShowAllJobs, newShowAllJobs);
try
{
for (SearchHomeBehaviourDecorator bhd : SearchHome_BehaviourDecorators)
{
newShowAllJobs = bhd.setShowAllJobs ((SearchHome)this, newShowAllJobs);
oldAndNewIdentical = HELPER_ShowAllJobs.compare (_ShowAllJobs, newShowAllJobs);
}
if (FIELD_ShowAllJobs_Validators.length > 0)
{
Object newShowAllJobsObj = HELPER_ShowAllJobs.toObject (newShowAllJobs);
if (newShowAllJobsObj != null)
{
int loopMax = FIELD_ShowAllJobs_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_SearchHome.get (FIELD_ShowAllJobs);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ShowAllJobs_Validators[v].checkAttribute (this, FIELD_ShowAllJobs, metadata, newShowAllJobsObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ShowAllJobs () != FieldWriteability.FALSE, "Field ShowAllJobs is not writeable");
preShowAllJobsChange (newShowAllJobs);
markFieldChange (FIELD_ShowAllJobs);
_ShowAllJobs = newShowAllJobs;
postFieldChange (FIELD_ShowAllJobs);
postShowAllJobsChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
result.add("HiringTeam");
result.add("CompanyUser");
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return _HiringTeam.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_CompanyUser))
{
return _CompanyUser.getReferencedType ();
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return null ;
}else if (assocName.equals (SINGLEREFERENCE_CompanyUser))
{
return null ;
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeam ();
}else if (assocName.equals (SINGLEREFERENCE_CompanyUser))
{
return getCompanyUser ();
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeam (getType);
}else if (assocName.equals (SINGLEREFERENCE_CompanyUser))
{
return getCompanyUser (getType);
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeamID ();
}else if (assocName.equals (SINGLEREFERENCE_CompanyUser))
{
return getCompanyUserID ();
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
setHiringTeam ((HiringTeam)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_CompanyUser))
{
setCompanyUser ((CompanyUser)(newValue));
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* Get the reference HiringTeam
*/
public HiringTeam getHiringTeam () throws StorageException
{
assertValid();
try
{
return (HiringTeam)(_HiringTeam.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in SearchHome:", this.getObjectID (), ", was trying to get HiringTeam:", getHiringTeamID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _HiringTeam.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public HiringTeam getHiringTeam (Get getType) throws StorageException
{
assertValid();
return _HiringTeam.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getHiringTeamID ()
{
assertValid();
if (_HiringTeam == null)
{
return null;
}
else
{
return _HiringTeam.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preHiringTeamChange (HiringTeam newHiringTeam) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postHiringTeamChange () throws FieldException
{
}
public FieldWriteability getWriteability_HiringTeam ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference HiringTeam. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setHiringTeam (HiringTeam newHiringTeam) throws StorageException, FieldException
{
if (_HiringTeam.wouldReferencedChange (newHiringTeam))
{
assertValid();
Debug.assertion (getWriteability_HiringTeam () != FieldWriteability.FALSE, "Assoc HiringTeam is not writeable");
preHiringTeamChange (newHiringTeam);
_HiringTeam.set (newHiringTeam);
postHiringTeamChange ();
}
}
/**
* Get the reference CompanyUser
*/
public CompanyUser getCompanyUser () throws StorageException
{
assertValid();
try
{
return (CompanyUser)(_CompanyUser.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in SearchHome:", this.getObjectID (), ", was trying to get CompanyUser:", getCompanyUserID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _CompanyUser.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public CompanyUser getCompanyUser (Get getType) throws StorageException
{
assertValid();
return _CompanyUser.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCompanyUserID ()
{
assertValid();
if (_CompanyUser == null)
{
return null;
}
else
{
return _CompanyUser.getID ();
}
}
/**
* Called prior to the assoc changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preCompanyUserChange (CompanyUser newCompanyUser) throws FieldException
{
}
/**
* Called after the assoc changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postCompanyUserChange () throws FieldException
{
}
public FieldWriteability getWriteability_CompanyUser ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference CompanyUser. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setCompanyUser (CompanyUser newCompanyUser) throws StorageException, FieldException
{
if (_CompanyUser.wouldReferencedChange (newCompanyUser))
{
assertValid();
Debug.assertion (getWriteability_CompanyUser () != FieldWriteability.FALSE, "Assoc CompanyUser is not writeable");
preCompanyUserChange (newCompanyUser);
_CompanyUser.set (newCompanyUser);
postCompanyUserChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public SearchHome newInstance ()
{
return new SearchHome ();
}
public SearchHome referenceInstance ()
{
return REFERENCE_SearchHome;
}
public SearchHome getInTransaction (ObjectTransaction t) throws StorageException
{
return getSearchHomeByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_SearchHome;
}
public String getBaseSetName ()
{
return "it_does_not_matter";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet it_does_not_matterPSet = allSets.getPersistentSet (myID, "it_does_not_matter", myPSetStatus);
it_does_not_matterPSet.setAttrib (FIELD_ObjectID, myID);
it_does_not_matterPSet.setAttrib (FIELD_ShowAllJobs, HELPER_ShowAllJobs.toObject (_ShowAllJobs)); //
_HiringTeam.getPersistentSets (allSets);
_CompanyUser.getPersistentSets (allSets);
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet it_does_not_matterPSet = allSets.getPersistentSet (objectID, "it_does_not_matter");
_ShowAllJobs = (Boolean)(HELPER_ShowAllJobs.fromObject (_ShowAllJobs, it_does_not_matterPSet.getAttrib (FIELD_ShowAllJobs))); //
_HiringTeam.setFromPersistentSets (objectID, allSets);
_CompanyUser.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof SearchHome)
{
SearchHome otherSearchHome = (SearchHome)other;
try
{
setShowAllJobs (otherSearchHome.getShowAllJobs ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseSearchHome)
{
BaseSearchHome sourceSearchHome = (BaseSearchHome)(source);
_ShowAllJobs = sourceSearchHome._ShowAllJobs;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseSearchHome)
{
BaseSearchHome sourceSearchHome = (BaseSearchHome)(source);
_HiringTeam.copyFrom (sourceSearchHome._HiringTeam, linkToGhosts);
_CompanyUser.copyFrom (sourceSearchHome._CompanyUser, linkToGhosts);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseSearchHome)
{
BaseSearchHome sourceSearchHome = (BaseSearchHome)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_ShowAllJobs = (Boolean)(HELPER_ShowAllJobs.readExternal (_ShowAllJobs, vals.get(FIELD_ShowAllJobs))); //
_HiringTeam.readExternalData(vals.get(SINGLEREFERENCE_HiringTeam));
_CompanyUser.readExternalData(vals.get(SINGLEREFERENCE_CompanyUser));
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_ShowAllJobs, HELPER_ShowAllJobs.writeExternal (_ShowAllJobs));
vals.put (SINGLEREFERENCE_HiringTeam, _HiringTeam.writeExternalData());
vals.put (SINGLEREFERENCE_CompanyUser, _CompanyUser.writeExternalData());
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseSearchHome)
{
BaseSearchHome otherSearchHome = (BaseSearchHome)(other);
if (!HELPER_ShowAllJobs.compare(this._ShowAllJobs, otherSearchHome._ShowAllJobs))
{
listener.notifyFieldChange(this, other, FIELD_ShowAllJobs, HELPER_ShowAllJobs.toObject(this._ShowAllJobs), HELPER_ShowAllJobs.toObject(otherSearchHome._ShowAllJobs));
}
// Compare single assocs
_HiringTeam.compare (otherSearchHome._HiringTeam, listener);
_CompanyUser.compare (otherSearchHome._CompanyUser, listener);
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_ShowAllJobs, HELPER_ShowAllJobs.toObject(getShowAllJobs()));
visitor.visitAssociation (_HiringTeam);
visitor.visitAssociation (_CompanyUser);
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
if (scope.includes (_HiringTeam))
{
visitor.visit (_HiringTeam);
}
if (scope.includes (_CompanyUser))
{
visitor.visit (_CompanyUser);
}
}
public static SearchHome createSearchHome (ObjectTransaction transaction) throws StorageException
{
SearchHome result = new SearchHome ();
result.initialiseNewObject (transaction);
return result;
}
public static SearchHome getSearchHomeByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (SearchHome)(transaction.getObjectByID (REFERENCE_SearchHome, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ShowAllJobs))
{
return filter.matches (getShowAllJobs ());
}
else if (attribName.equals (SINGLEREFERENCE_HiringTeam))
{
return filter.matches (getHiringTeam ());
}
else if (attribName.equals (SINGLEREFERENCE_CompanyUser))
{
return filter.matches (getCompanyUser ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ShowAllJobs))
{
return HELPER_ShowAllJobs.toObject (getShowAllJobs ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ShowAllJobs))
{
return HELPER_ShowAllJobs;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ShowAllJobs))
{
setShowAllJobs ((Boolean)(HELPER_ShowAllJobs.fromObject (_ShowAllJobs, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_ShowAllJobs))
{
return getWriteability_ShowAllJobs ();
}
else if (fieldName.equals (SINGLEREFERENCE_HiringTeam))
{
return getWriteability_HiringTeam ();
}
else if (fieldName.equals (SINGLEREFERENCE_CompanyUser))
{
return getWriteability_CompanyUser ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_ShowAllJobs () != FieldWriteability.TRUE)
{
fields.add (FIELD_ShowAllJobs);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_ShowAllJobs.getAttribObject (getClass (), _ShowAllJobs, false, FIELD_ShowAllJobs));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_SearchHome.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_SearchHome.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_SearchHome.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_SearchHome.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class SearchHomeBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<SearchHome>
{
/**
* Get the attribute ShowAllJobs
*/
public Boolean getShowAllJobs (SearchHome obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute ShowAllJobs.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setShowAllJobs (SearchHome obj, Boolean newShowAllJobs) throws FieldException
{
return newShowAllJobs;
}
}
public ORMPipeLine pipes()
{
return new SearchHomePipeLineFactory<SearchHome, SearchHome> ((SearchHome)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public SearchHomePipeLineFactory<SearchHome, SearchHome> pipelineSearchHome()
{
return (SearchHomePipeLineFactory<SearchHome, SearchHome>) pipes();
}
public static SearchHomePipeLineFactory<SearchHome, SearchHome> pipesSearchHome(Collection<SearchHome> items)
{
return REFERENCE_SearchHome.new SearchHomePipeLineFactory<SearchHome, SearchHome> (items);
}
public static SearchHomePipeLineFactory<SearchHome, SearchHome> pipesSearchHome(SearchHome[] _items)
{
return pipesSearchHome(Arrays.asList (_items));
}
public static SearchHomePipeLineFactory<SearchHome, SearchHome> pipesSearchHome()
{
return pipesSearchHome((Collection)null);
}
public class SearchHomePipeLineFactory<From extends BaseBusinessClass, Me extends SearchHome> extends SearchExecutorPipeLineFactory<From, Me>
{
public <Prev> SearchHomePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public SearchHomePipeLineFactory (From seed)
{
super(seed);
}
public SearchHomePipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("ShowAllJobs"))
{
return toShowAllJobs ();
}
if (name.equals ("HiringTeam"))
{
return toHiringTeam ();
}
if (name.equals ("CompanyUser"))
{
return toCompanyUser ();
}
return super.to(name);
}
public PipeLine<From, Boolean> toShowAllJobs () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_ShowAllJobs)); }
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toHiringTeam () { return toHiringTeam (Filter.ALL); }
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toHiringTeam (Filter<HiringTeam> filter)
{
return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMSingleAssocPipe<Me, HiringTeam>(SINGLEREFERENCE_HiringTeam, filter));
}
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toCompanyUser () { return toCompanyUser (Filter.ALL); }
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toCompanyUser (Filter<CompanyUser> filter)
{
return CompanyUser.REFERENCE_CompanyUser.new CompanyUserPipeLineFactory<From, CompanyUser> (this, new ORMSingleAssocPipe<Me, CompanyUser>(SINGLEREFERENCE_CompanyUser, filter));
}
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummySearchHome extends SearchHome
{
// Default constructor primarily to support Externalisable
public DummySearchHome()
{
super();
}
public void assertValid ()
{
}
public HiringTeam getHiringTeam () throws StorageException
{
return (HiringTeam)(HiringTeam.DUMMY_HiringTeam);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getHiringTeamID ()
{
return HiringTeam.DUMMY_HiringTeam.getObjectID();
}
public CompanyUser getCompanyUser () throws StorageException
{
return (CompanyUser)(CompanyUser.DUMMY_CompanyUser);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getCompanyUserID ()
{
return CompanyUser.DUMMY_CompanyUser.getObjectID();
}
}
package performa.search;
import oneit.objstore.BaseBusinessClass;
import oneit.objstore.rdbms.filters.EqualsFilter;
import performa.orm.BaseJob;
import performa.orm.Job;
import performa.orm.types.JobStatus;
public class SearchHome extends BaseSearchHome
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public SearchHome ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
@Override
public BaseBusinessClass[] doSearch()
{
BaseJob.SearchAll search = Job.SearchByAll()
.andHiringTeam(new EqualsFilter<>(getHiringTeam()))
.andJobStatus(new EqualsFilter<>(JobStatus.OPEN));
if(!getShowAllJobs())
{
search = search.andCreatedBy(new EqualsFilter<>(getCompanyUser()));
}
return search.search(getTransaction());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="SearchHome" package="performa.search" superclass="SearchExecutor" >
<IMPORT value="oneit.servlets.orm.*"/>
<IMPORT value="performa.orm.*"/>
<TABLE name="it_does_not_matter" tablePrefix="object" polymorphic="FALSE" >
<ATTRIB name="ShowAllJobs" type="Boolean" dbcol="xxxx" defaultValue="Boolean.FALSE"/>
<SINGLEREFERENCE name="HiringTeam" type="HiringTeam" dbcol="xxxx" />
<SINGLEREFERENCE name="CompanyUser" type="CompanyUser" dbcol="xxxx" />
</TABLE>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.search;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
import oneit.servlets.orm.*;
import performa.orm.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class SearchHomePersistenceMgr extends SearchExecutorPersistenceMgr
{
private static final LoggingArea SearchHomePersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "SearchHome");
// Private attributes corresponding to business object data
private Boolean dummyShowAllJobs;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_ShowAllJobs = DefaultAttributeHelper.INSTANCE;
public SearchHomePersistenceMgr ()
{
dummyShowAllJobs = (Boolean)(HELPER_ShowAllJobs.initialise (dummyShowAllJobs));
}
private String SELECT_COLUMNS = "{PREFIX}it_does_not_matter.object_id as id, {PREFIX}it_does_not_matter.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}it_does_not_matter.object_CREATED_DATE as CREATED_DATE, {PREFIX}it_does_not_matter.xxxx, {PREFIX}it_does_not_matter.xxxx, {PREFIX}it_does_not_matter.xxxx, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, SearchHome.REFERENCE_SearchHome);
if (objectToReturn instanceof SearchHome)
{
LogMgr.log (SearchHomePersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a SearchHome");
}
}
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(id, "it_does_not_matter", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !it_does_not_matterPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!it_does_not_matterPSet.containsAttrib(SearchHome.FIELD_ShowAllJobs)||
!it_does_not_matterPSet.containsAttrib(SearchHome.SINGLEREFERENCE_HiringTeam)||
!it_does_not_matterPSet.containsAttrib(SearchHome.SINGLEREFERENCE_CompanyUser))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (SearchHomePersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
SearchHome result = new SearchHome ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}it_does_not_matter " +
"WHERE " + SELECT_JOINS + "{PREFIX}it_does_not_matter.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(objectID, "it_does_not_matter");
if (it_does_not_matterPSet.getStatus () != PersistentSetStatus.PROCESSED &&
it_does_not_matterPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}it_does_not_matter " +
"SET xxxx = ?, xxxx = ? , xxxx = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE it_does_not_matter.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_ShowAllJobs.getForSQL(dummyShowAllJobs, it_does_not_matterPSet.getAttrib (SearchHome.FIELD_ShowAllJobs))).listEntry (SQLManager.CheckNull((Long)(it_does_not_matterPSet.getAttrib (SearchHome.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(it_does_not_matterPSet.getAttrib (SearchHome.SINGLEREFERENCE_CompanyUser)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}it_does_not_matter WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "it_does_not_matter", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (SearchHomePersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "it_does_not_matter");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:it_does_not_matter for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (SearchHomePersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (SearchHomePersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(objectID, "it_does_not_matter");
LogMgr.log (SearchHomePersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (it_does_not_matterPSet.getStatus () != PersistentSetStatus.PROCESSED &&
it_does_not_matterPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}it_does_not_matter " +
"WHERE it_does_not_matter.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}it_does_not_matter WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "it_does_not_matter");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:it_does_not_matter for row:" + objectID;
LogMgr.log (SearchHomePersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, SearchHome> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (SearchHome.REFERENCE_SearchHome.getObjectIDSpace (), r.getLong ("id"));
SearchHome resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, SearchHome.REFERENCE_SearchHome);
if (cachedElement instanceof SearchHome)
{
LogMgr.log (SearchHomePersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (SearchHome)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a SearchHome");
}
}
else
{
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(objectID, "it_does_not_matter", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new SearchHome ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (SearchHomePersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}it_does_not_matter " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else
{
BaseBusinessClass[] resultsArray = super.find(searchType, allPSets, criteria, context, sqlMgr);
Vector results = new Vector ();
for (int x = 0 ; x < resultsArray.length ; ++x)
{
if (resultsArray[x] instanceof SearchHome)
{
results.add (resultsArray[x]);
}
else
{
// Ignore
}
}
resultsArray = new BaseBusinessClass[results.size ()];
results.copyInto (resultsArray);
return resultsArray;
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(objectID, "it_does_not_matter", PersistentSetStatus.FETCHED);
// Object Modified
it_does_not_matterPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
it_does_not_matterPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
it_does_not_matterPSet.setAttrib(SearchHome.FIELD_ShowAllJobs, HELPER_ShowAllJobs.getFromRS(dummyShowAllJobs, r, "xxxx"));
it_does_not_matterPSet.setAttrib(SearchHome.SINGLEREFERENCE_HiringTeam, r.getObject ("xxxx"));
it_does_not_matterPSet.setAttrib(SearchHome.SINGLEREFERENCE_CompanyUser, r.getObject ("xxxx"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(objectID, "it_does_not_matter");
if (it_does_not_matterPSet.getStatus () != PersistentSetStatus.PROCESSED &&
it_does_not_matterPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}it_does_not_matter " +
" (xxxx, xxxx, xxxx, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_ShowAllJobs.getForSQL(dummyShowAllJobs, it_does_not_matterPSet.getAttrib (SearchHome.FIELD_ShowAllJobs))) .listEntry (SQLManager.CheckNull((Long)(it_does_not_matterPSet.getAttrib (SearchHome.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(it_does_not_matterPSet.getAttrib (SearchHome.SINGLEREFERENCE_CompanyUser)))) .listEntry (objectID.longID ()).toList().toArray());
it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() $(document).ready(function()
{ {
recalcFunction = setupRecalc ($("editJob"), {'recalcOnError':true}); recalcFunction = setupRecalc ($("form#editJob"), {'recalcOnError':true});
$(".switch input[type='checkbox']").change(function() { $(".switch input[type='checkbox']").change(function() {
$("button[name$='changeAssessmentCriteria']").click(); $("button[name$='changeAssessmentCriteria']").click();
......
...@@ -46,17 +46,23 @@ ...@@ -46,17 +46,23 @@
CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser); CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
HiringTeam hiringTeam = companyUser.getSelectedTeam(); HiringTeam hiringTeam = companyUser.getSelectedTeam();
SearchHome searchHome = (SearchHome) RunSearchExecutorFP.setupExecutor(request, SearchHome.REFERENCE_SearchHome, true);
Job[] allJobs = (Job[])process.getAttribute("allJobs");
searchHome.setHiringTeam(hiringTeam);
searchHome.setCompanyUser(companyUser);
if(allJobs == null)
{
allJobs = (Job[]) searchHome.doSearch();
}
Job[] jobs = Job.SearchByAll().andJobStatus(new EqualsFilter<>(JobStatus.OPEN)) Job[] jobs = Job.SearchByAll().andJobStatus(new EqualsFilter<>(JobStatus.OPEN))
.andHiringTeam(new EqualsFilter<>(hiringTeam)) .andHiringTeam(new EqualsFilter<>(hiringTeam))
.search(transaction); .search(transaction);
Job[] allJobs = Job.SearchByAll().andHiringTeam(new EqualsFilter<>(hiringTeam))
.search(transaction);
List<Job> recentJobs = ObjstoreUtils.sort(Arrays.asList(allJobs), List<Job> recentJobs = ObjstoreUtils.sort(Arrays.asList(allJobs),
new ObjectTransform[]{ Job.pipesJob().toLastEdited() , new ObjectTransform[]{ Job.pipesJob().toLastEdited() ,
Job.pipesJob().toObjectLastModified()}, Job.pipesJob().toObjectLastModified()},
new Comparator[]{ CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR), CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR), CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR) }); new Comparator[]{ CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR), CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR), CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR) });
...@@ -68,6 +74,18 @@ ...@@ -68,6 +74,18 @@
boolean firstTime = request.getParameter("firstTime") != null ? Boolean.parseBoolean(request.getParameter("firstTime")) : false; boolean firstTime = request.getParameter("firstTime") != null ? Boolean.parseBoolean(request.getParameter("firstTime")) : false;
boolean canCreateJob = Utils.allowJobCreation(hiringTeam); boolean canCreateJob = Utils.allowJobCreation(hiringTeam);
%> %>
<script type="text/javascript">
$(document).ready(function()
{
recalcFunction = setupRecalc ($("form#editJob"), {'recalcOnError':true});
$(".switch input[type='checkbox']").change(function() {
$("button[name$='search']").click();
});
});
</script>
<oneit:form name="editJob" method="post" enctype="multipart/form-data"> <oneit:form name="editJob" method="post" enctype="multipart/form-data">
<div class="dashboard-content-area"> <div class="dashboard-content-area">
<div class="dashboard-first-part"> <div class="dashboard-first-part">
...@@ -144,7 +162,19 @@ ...@@ -144,7 +162,19 @@
</div> </div>
<div class="second-part"> <div class="second-part">
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/> <oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="d-job-title">Recent Jobs</div> <div class="d-job-title">Your Open Jobs</div>
<div class ="form-group">
<label>Show all open jobs for team</label>
<span class="pull-right">
<label class="switch">
<oneit:recalcClass htmlTag="span" classScript="searchHome.getShowAllJobs() ? 'checkbox checked': 'checkbox unchecked'" searchHome="<%= searchHome %>">
<oneit:ormInput obj="<%= searchHome %>" attributeName="ShowAllJobs" type="checkbox"/>
</oneit:recalcClass>
<div class="slider round"></div>
</label>
<oneit:button value="Search" name="search" cssClass="hide"/>
</span>
</div>
<% <%
if(recentJobs.isEmpty()) if(recentJobs.isEmpty())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment