Commit 247c76d3 by Nilu

client related changes

parent 95e9f7d6
...@@ -19,9 +19,12 @@ ...@@ -19,9 +19,12 @@
<column name="post_code" type="String" nullable="true" length="10"/> <column name="post_code" type="String" nullable="true" length="10"/>
<column name="city" type="String" nullable="true" length="100"/> <column name="city" type="String" nullable="true" length="100"/>
<column name="time_zone" type="String" nullable="true" length="200"/> <column name="time_zone" type="String" nullable="true" length="200"/>
<column name="company_id" type="Long" length="11" nullable="false"/> <column name="hiring_team_id" type="Long" length="11" nullable="false"/>
<column name="company_id" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_client" indexName="idx_tl_client_hiring_team_id" isUnique="false"><column name="hiring_team_id"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_client" indexName="idx_tl_client_company_id" isUnique="false"><column name="company_id"/></NODE> <NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_client" indexName="idx_tl_client_company_id" isUnique="false"><column name="company_id"/></NODE>
</NODE></OBJECTS> </NODE></OBJECTS>
\ No newline at end of file
...@@ -19,7 +19,8 @@ CREATE TABLE tl_client ( ...@@ -19,7 +19,8 @@ CREATE TABLE tl_client (
post_code varchar(10) NULL, post_code varchar(10) NULL,
city varchar(100) NULL, city varchar(100) NULL,
time_zone varchar(200) NULL, time_zone varchar(200) NULL,
company_id numeric(12) NOT NULL hiring_team_id numeric(12) NOT NULL,
company_id numeric(12) NULL
); );
...@@ -32,5 +33,8 @@ ALTER TABLE tl_client ADD ...@@ -32,5 +33,8 @@ ALTER TABLE tl_client ADD
CREATE INDEX idx_tl_client_hiring_team_id
ON tl_client (hiring_team_id);
CREATE INDEX idx_tl_client_company_id CREATE INDEX idx_tl_client_company_id
ON tl_client (company_id); ON tl_client (company_id);
...@@ -20,7 +20,8 @@ CREATE TABLE tl_client ( ...@@ -20,7 +20,8 @@ CREATE TABLE tl_client (
post_code varchar2(10) NULL, post_code varchar2(10) NULL,
city varchar2(100) NULL, city varchar2(100) NULL,
time_zone varchar2(200) NULL, time_zone varchar2(200) NULL,
company_id number(12) NOT NULL hiring_team_id number(12) NOT NULL,
company_id number(12) NULL
); );
...@@ -33,5 +34,8 @@ ALTER TABLE tl_client ADD ...@@ -33,5 +34,8 @@ ALTER TABLE tl_client ADD
CREATE INDEX idx_tl_client_hiring_team_id
ON tl_client (hiring_team_id);
CREATE INDEX idx_tl_client_company_id CREATE INDEX idx_tl_client_company_id
ON tl_client (company_id); ON tl_client (company_id);
...@@ -20,7 +20,8 @@ CREATE TABLE tl_client ( ...@@ -20,7 +20,8 @@ CREATE TABLE tl_client (
post_code varchar(10) NULL, post_code varchar(10) NULL,
city varchar(100) NULL, city varchar(100) NULL,
time_zone varchar(200) NULL, time_zone varchar(200) NULL,
company_id numeric(12) NOT NULL hiring_team_id numeric(12) NOT NULL,
company_id numeric(12) NULL
); );
...@@ -33,5 +34,8 @@ ALTER TABLE tl_client ADD ...@@ -33,5 +34,8 @@ ALTER TABLE tl_client ADD
CREATE INDEX idx_tl_client_hiring_team_id
ON tl_client (hiring_team_id);
CREATE INDEX idx_tl_client_company_id CREATE INDEX idx_tl_client_company_id
ON tl_client (company_id); ON tl_client (company_id);
...@@ -56,6 +56,8 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -56,6 +56,8 @@ public abstract class BaseClient extends BaseBusinessClass
public static final String FIELD_City = "City"; public static final String FIELD_City = "City";
public static final String FIELD_TimeZone = "TimeZone"; public static final String FIELD_TimeZone = "TimeZone";
public static final String FIELD_IsLogoDeleted = "IsLogoDeleted"; public static final String FIELD_IsLogoDeleted = "IsLogoDeleted";
public static final String SINGLEREFERENCE_HiringTeam = "HiringTeam";
public static final String BACKREF_HiringTeam = "";
public static final String SINGLEREFERENCE_Company = "Company"; public static final String SINGLEREFERENCE_Company = "Company";
public static final String BACKREF_Company = ""; public static final String BACKREF_Company = "";
public static final String MULTIPLEREFERENCE_Jobs = "Jobs"; public static final String MULTIPLEREFERENCE_Jobs = "Jobs";
...@@ -96,6 +98,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -96,6 +98,7 @@ public abstract class BaseClient extends BaseBusinessClass
// Private attributes corresponding to single references // Private attributes corresponding to single references
private SingleAssociation<Client, HiringTeam> _HiringTeam;
private SingleAssociation<Client, Company> _Company; private SingleAssociation<Client, Company> _Company;
...@@ -130,11 +133,13 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -130,11 +133,13 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
String tmp_Jobs = Job.BACKREF_Client; String tmp_Jobs = Job.BACKREF_Client;
String tmp_HiringTeam = HiringTeam.BACKREF_Clients;
String tmp_Company = Company.BACKREF_Clients; String tmp_Company = Company.BACKREF_Clients;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Jobs(); setupAssocMetaData_Jobs();
setupAssocMetaData_HiringTeam();
setupAssocMetaData_Company(); setupAssocMetaData_Company();
FIELD_IsLogoDeleted_Validators = (AttributeValidator[])setupAttribMetaData_IsLogoDeleted(validatorMapping).toArray (new AttributeValidator[0]); FIELD_IsLogoDeleted_Validators = (AttributeValidator[])setupAttribMetaData_IsLogoDeleted(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ClientName_Validators = (AttributeValidator[])setupAttribMetaData_ClientName(validatorMapping).toArray (new AttributeValidator[0]); FIELD_ClientName_Validators = (AttributeValidator[])setupAttribMetaData_ClientName(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -177,13 +182,29 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -177,13 +182,29 @@ public abstract class BaseClient extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_HiringTeam()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Clients");
metaInfo.put ("dbcol", "hiring_team_id");
metaInfo.put ("mandatory", "true");
metaInfo.put ("name", "HiringTeam");
metaInfo.put ("type", "HiringTeam");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Client.HiringTeam:", metaInfo);
ATTRIBUTES_METADATA_Client.put (SINGLEREFERENCE_HiringTeam, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Company() private static void setupAssocMetaData_Company()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Clients"); metaInfo.put ("backreferenceName", "Clients");
metaInfo.put ("dbcol", "company_id"); metaInfo.put ("dbcol", "company_id");
metaInfo.put ("mandatory", "true"); metaInfo.put ("mandatory", "false");
metaInfo.put ("name", "Company"); metaInfo.put ("name", "Company");
metaInfo.put ("type", "Company"); metaInfo.put ("type", "Company");
...@@ -482,6 +503,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -482,6 +503,7 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
super._initialiseAssociations (); super._initialiseAssociations ();
_HiringTeam = new SingleAssociation<Client, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, HiringTeam.MULTIPLEREFERENCE_Clients, HiringTeam.REFERENCE_HiringTeam, "tl_client");
_Company = new SingleAssociation<Client, Company> (this, SINGLEREFERENCE_Company, Company.MULTIPLEREFERENCE_Clients, Company.REFERENCE_Company, "tl_client"); _Company = new SingleAssociation<Client, Company> (this, SINGLEREFERENCE_Company, Company.MULTIPLEREFERENCE_Clients, Company.REFERENCE_Company, "tl_client");
_Jobs = new MultipleAssociation<Client, Job> (this, MULTIPLEREFERENCE_Jobs, Job.SINGLEREFERENCE_Client, Job.REFERENCE_Job); _Jobs = new MultipleAssociation<Client, Job> (this, MULTIPLEREFERENCE_Jobs, Job.SINGLEREFERENCE_Client, Job.REFERENCE_Job);
...@@ -493,6 +515,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -493,6 +515,7 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
super.initialiseReference (); super.initialiseReference ();
_HiringTeam = new SingleAssociation<Client, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, HiringTeam.MULTIPLEREFERENCE_Clients, HiringTeam.REFERENCE_HiringTeam, "tl_client");
_Company = new SingleAssociation<Client, Company> (this, SINGLEREFERENCE_Company, Company.MULTIPLEREFERENCE_Clients, Company.REFERENCE_Company, "tl_client"); _Company = new SingleAssociation<Client, Company> (this, SINGLEREFERENCE_Company, Company.MULTIPLEREFERENCE_Clients, Company.REFERENCE_Company, "tl_client");
_Jobs = new MultipleAssociation<Client, Job> (this, MULTIPLEREFERENCE_Jobs, Job.SINGLEREFERENCE_Client, Job.REFERENCE_Job); _Jobs = new MultipleAssociation<Client, Job> (this, MULTIPLEREFERENCE_Jobs, Job.SINGLEREFERENCE_Client, Job.REFERENCE_Job);
...@@ -1689,6 +1712,8 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -1689,6 +1712,8 @@ public abstract class BaseClient extends BaseBusinessClass
List result = super.getSingleAssocs (); List result = super.getSingleAssocs ();
result.add("HiringTeam");
result.add("Company"); result.add("Company");
...@@ -1702,7 +1727,10 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -1702,7 +1727,10 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return _HiringTeam.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
return _Company.getReferencedType (); return _Company.getReferencedType ();
} }
...@@ -1719,7 +1747,10 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -1719,7 +1747,10 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return HiringTeam.MULTIPLEREFERENCE_Clients ;
}else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
return Company.MULTIPLEREFERENCE_Clients ; return Company.MULTIPLEREFERENCE_Clients ;
} }
...@@ -1736,7 +1767,10 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -1736,7 +1767,10 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeam ();
}else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
return getCompany (); return getCompany ();
} }
...@@ -1753,7 +1787,10 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -1753,7 +1787,10 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeam (getType);
}else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
return getCompany (getType); return getCompany (getType);
} }
...@@ -1770,7 +1807,10 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -1770,7 +1807,10 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
return getHiringTeamID ();
}else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
return getCompanyID (); return getCompanyID ();
} }
...@@ -1787,7 +1827,10 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -1787,7 +1827,10 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
{
setHiringTeam ((HiringTeam)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
setCompany ((Company)(newValue)); setCompany ((Company)(newValue));
} }
...@@ -1800,6 +1843,114 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -1800,6 +1843,114 @@ public abstract class BaseClient extends BaseBusinessClass
/** /**
* 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 Client:", 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
{
BusinessObjectParser.assertFieldCondition (newHiringTeam != null, this, SINGLEREFERENCE_HiringTeam, "mandatory");
if (_HiringTeam.wouldReferencedChange (newHiringTeam))
{
assertValid();
Debug.assertion (getWriteability_HiringTeam () != FieldWriteability.FALSE, "Assoc HiringTeam is not writeable");
preHiringTeamChange (newHiringTeam);
HiringTeam oldHiringTeam = getHiringTeam ();
if (oldHiringTeam != null)
{
// This is to stop validation from triggering when we are removed
_HiringTeam.set (null);
oldHiringTeam.removeFromClients ((Client)(this));
}
_HiringTeam.set (newHiringTeam);
if (newHiringTeam != null)
{
newHiringTeam.addToClients ((Client)(this));
}
postHiringTeamChange ();
}
}
/**
* Get the reference Company * Get the reference Company
*/ */
public Company getCompany () throws StorageException public Company getCompany () throws StorageException
...@@ -1879,7 +2030,6 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -1879,7 +2030,6 @@ public abstract class BaseClient extends BaseBusinessClass
*/ */
public void setCompany (Company newCompany) throws StorageException, FieldException public void setCompany (Company newCompany) throws StorageException, FieldException
{ {
BusinessObjectParser.assertFieldCondition (newCompany != null, this, SINGLEREFERENCE_Company, "mandatory");
if (_Company.wouldReferencedChange (newCompany)) if (_Company.wouldReferencedChange (newCompany))
...@@ -2122,6 +2272,20 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2122,6 +2272,20 @@ public abstract class BaseClient extends BaseBusinessClass
try try
{ {
// Ensure we are removed from any loaded multi-associations that aren't mandatory // Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_HiringTeam.isLoaded () || getTransaction ().isObjectLoaded (_HiringTeam.getReferencedType (), getHiringTeamID ()))
{
HiringTeam referenced = getHiringTeam ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Clients from ", getObjectID (), " to ", referenced.getObjectID ());
_HiringTeam.set (null);
referenced.removeFromClients ((Client)this);
}
}
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_Company.isLoaded () || getTransaction ().isObjectLoaded (_Company.getReferencedType (), getCompanyID ())) if (_Company.isLoaded () || getTransaction ().isObjectLoaded (_Company.getReferencedType (), getCompanyID ()))
{ {
Company referenced = getCompany (); Company referenced = getCompany ();
...@@ -2212,6 +2376,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2212,6 +2376,7 @@ public abstract class BaseClient extends BaseBusinessClass
tl_clientPSet.setAttrib (FIELD_PostCode, HELPER_PostCode.toObject (_PostCode)); // tl_clientPSet.setAttrib (FIELD_PostCode, HELPER_PostCode.toObject (_PostCode)); //
tl_clientPSet.setAttrib (FIELD_City, HELPER_City.toObject (_City)); // tl_clientPSet.setAttrib (FIELD_City, HELPER_City.toObject (_City)); //
tl_clientPSet.setAttrib (FIELD_TimeZone, HELPER_TimeZone.toObject (_TimeZone)); // tl_clientPSet.setAttrib (FIELD_TimeZone, HELPER_TimeZone.toObject (_TimeZone)); //
_HiringTeam.getPersistentSets (allSets);
_Company.getPersistentSets (allSets); _Company.getPersistentSets (allSets);
} }
...@@ -2238,6 +2403,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2238,6 +2403,7 @@ public abstract class BaseClient extends BaseBusinessClass
_PostCode = (String)(HELPER_PostCode.fromObject (_PostCode, tl_clientPSet.getAttrib (FIELD_PostCode))); // _PostCode = (String)(HELPER_PostCode.fromObject (_PostCode, tl_clientPSet.getAttrib (FIELD_PostCode))); //
_City = (String)(HELPER_City.fromObject (_City, tl_clientPSet.getAttrib (FIELD_City))); // _City = (String)(HELPER_City.fromObject (_City, tl_clientPSet.getAttrib (FIELD_City))); //
_TimeZone = (TimeZone)(HELPER_TimeZone.fromObject (_TimeZone, tl_clientPSet.getAttrib (FIELD_TimeZone))); // _TimeZone = (TimeZone)(HELPER_TimeZone.fromObject (_TimeZone, tl_clientPSet.getAttrib (FIELD_TimeZone))); //
_HiringTeam.setFromPersistentSets (objectID, allSets);
_Company.setFromPersistentSets (objectID, allSets); _Company.setFromPersistentSets (objectID, allSets);
} }
...@@ -2396,6 +2562,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2396,6 +2562,7 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
BaseClient sourceClient = (BaseClient)(source); BaseClient sourceClient = (BaseClient)(source);
_HiringTeam.copyFrom (sourceClient._HiringTeam, linkToGhosts);
_Company.copyFrom (sourceClient._Company, linkToGhosts); _Company.copyFrom (sourceClient._Company, linkToGhosts);
} }
...@@ -2424,7 +2591,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2424,7 +2591,7 @@ public abstract class BaseClient extends BaseBusinessClass
super.validate (context); super.validate (context);
context.check (getCompanyID() != null, this, SINGLEREFERENCE_Company, "mandatory"); context.check (getHiringTeamID() != null, this, SINGLEREFERENCE_HiringTeam, "mandatory");
} }
...@@ -2448,6 +2615,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2448,6 +2615,7 @@ public abstract class BaseClient extends BaseBusinessClass
_City = (String)(HELPER_City.readExternal (_City, vals.get(FIELD_City))); // _City = (String)(HELPER_City.readExternal (_City, vals.get(FIELD_City))); //
_TimeZone = (TimeZone)(HELPER_TimeZone.readExternal (_TimeZone, vals.get(FIELD_TimeZone))); // _TimeZone = (TimeZone)(HELPER_TimeZone.readExternal (_TimeZone, vals.get(FIELD_TimeZone))); //
_IsLogoDeleted = (Boolean)(HELPER_IsLogoDeleted.readExternal (_IsLogoDeleted, vals.get(FIELD_IsLogoDeleted))); // _IsLogoDeleted = (Boolean)(HELPER_IsLogoDeleted.readExternal (_IsLogoDeleted, vals.get(FIELD_IsLogoDeleted))); //
_HiringTeam.readExternalData(vals.get(SINGLEREFERENCE_HiringTeam));
_Company.readExternalData(vals.get(SINGLEREFERENCE_Company)); _Company.readExternalData(vals.get(SINGLEREFERENCE_Company));
_Jobs.readExternalData(vals.get(MULTIPLEREFERENCE_Jobs)); _Jobs.readExternalData(vals.get(MULTIPLEREFERENCE_Jobs));
...@@ -2473,6 +2641,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2473,6 +2641,7 @@ public abstract class BaseClient extends BaseBusinessClass
vals.put (FIELD_City, HELPER_City.writeExternal (_City)); vals.put (FIELD_City, HELPER_City.writeExternal (_City));
vals.put (FIELD_TimeZone, HELPER_TimeZone.writeExternal (_TimeZone)); vals.put (FIELD_TimeZone, HELPER_TimeZone.writeExternal (_TimeZone));
vals.put (FIELD_IsLogoDeleted, HELPER_IsLogoDeleted.writeExternal (_IsLogoDeleted)); vals.put (FIELD_IsLogoDeleted, HELPER_IsLogoDeleted.writeExternal (_IsLogoDeleted));
vals.put (SINGLEREFERENCE_HiringTeam, _HiringTeam.writeExternalData());
vals.put (SINGLEREFERENCE_Company, _Company.writeExternalData()); vals.put (SINGLEREFERENCE_Company, _Company.writeExternalData());
vals.put (MULTIPLEREFERENCE_Jobs, _Jobs.writeExternalData()); vals.put (MULTIPLEREFERENCE_Jobs, _Jobs.writeExternalData());
...@@ -2534,6 +2703,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2534,6 +2703,7 @@ public abstract class BaseClient extends BaseBusinessClass
} }
// Compare single assocs // Compare single assocs
_HiringTeam.compare (otherClient._HiringTeam, listener);
_Company.compare (otherClient._Company, listener); _Company.compare (otherClient._Company, listener);
...@@ -2568,6 +2738,7 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2568,6 +2738,7 @@ public abstract class BaseClient extends BaseBusinessClass
visitor.visitField(this, FIELD_PostCode, HELPER_PostCode.toObject(getPostCode())); visitor.visitField(this, FIELD_PostCode, HELPER_PostCode.toObject(getPostCode()));
visitor.visitField(this, FIELD_City, HELPER_City.toObject(getCity())); visitor.visitField(this, FIELD_City, HELPER_City.toObject(getCity()));
visitor.visitField(this, FIELD_TimeZone, HELPER_TimeZone.toObject(getTimeZone())); visitor.visitField(this, FIELD_TimeZone, HELPER_TimeZone.toObject(getTimeZone()));
visitor.visitAssociation (_HiringTeam);
visitor.visitAssociation (_Company); visitor.visitAssociation (_Company);
visitor.visitAssociation (_Jobs); visitor.visitAssociation (_Jobs);
...@@ -2578,6 +2749,10 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2578,6 +2749,10 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
super.visitAssociations (visitor, scope); super.visitAssociations (visitor, scope);
if (scope.includes (_HiringTeam))
{
visitor.visit (_HiringTeam);
}
if (scope.includes (_Company)) if (scope.includes (_Company))
{ {
visitor.visit (_Company); visitor.visit (_Company);
...@@ -2655,6 +2830,10 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2655,6 +2830,10 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
return filter.matches (getTimeZone ()); return filter.matches (getTimeZone ());
} }
else if (attribName.equals (SINGLEREFERENCE_HiringTeam))
{
return filter.matches (getHiringTeam ());
}
else if (attribName.equals (SINGLEREFERENCE_Company)) else if (attribName.equals (SINGLEREFERENCE_Company))
{ {
return filter.matches (getCompany ()); return filter.matches (getCompany ());
...@@ -2756,6 +2935,12 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -2756,6 +2935,12 @@ public abstract class BaseClient extends BaseBusinessClass
return this; return this;
} }
public SearchAll andHiringTeam (QueryFilter<HiringTeam> filter)
{
filter.addFilter (context, "tl_client.hiring_team_id", "HiringTeam");
return this;
}
public SearchAll andCompany (QueryFilter<Company> filter) public SearchAll andCompany (QueryFilter<Company> filter)
{ {
filter.addFilter (context, "tl_client.company_id", "Company"); filter.addFilter (context, "tl_client.company_id", "Company");
...@@ -3035,6 +3220,10 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -3035,6 +3220,10 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
return getWriteability_Jobs (); return getWriteability_Jobs ();
} }
else if (fieldName.equals (SINGLEREFERENCE_HiringTeam))
{
return getWriteability_HiringTeam ();
}
else if (fieldName.equals (SINGLEREFERENCE_Company)) else if (fieldName.equals (SINGLEREFERENCE_Company))
{ {
return getWriteability_Company (); return getWriteability_Company ();
...@@ -3522,6 +3711,10 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -3522,6 +3711,10 @@ public abstract class BaseClient extends BaseBusinessClass
{ {
return toTimeZone (); return toTimeZone ();
} }
if (name.equals ("HiringTeam"))
{
return toHiringTeam ();
}
if (name.equals ("Company")) if (name.equals ("Company"))
{ {
return toCompany (); return toCompany ();
...@@ -3555,6 +3748,12 @@ public abstract class BaseClient extends BaseBusinessClass ...@@ -3555,6 +3748,12 @@ public abstract class BaseClient extends BaseBusinessClass
public PipeLine<From, String> toCity () { return pipe(new ORMAttributePipe<Me, String>(FIELD_City)); } public PipeLine<From, String> toCity () { return pipe(new ORMAttributePipe<Me, String>(FIELD_City)); }
public PipeLine<From, TimeZone> toTimeZone () { return pipe(new ORMAttributePipe<Me, TimeZone>(FIELD_TimeZone)); } public PipeLine<From, TimeZone> toTimeZone () { return pipe(new ORMAttributePipe<Me, TimeZone>(FIELD_TimeZone)); }
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 Company.CompanyPipeLineFactory<From, Company> toCompany () { return toCompany (Filter.ALL); } public Company.CompanyPipeLineFactory<From, Company> toCompany () { return toCompany (Filter.ALL); }
public Company.CompanyPipeLineFactory<From, Company> toCompany (Filter<Company> filter) public Company.CompanyPipeLineFactory<From, Company> toCompany (Filter<Company> filter)
...@@ -3603,6 +3802,20 @@ class DummyClient extends Client ...@@ -3603,6 +3802,20 @@ class DummyClient extends Client
} }
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 Company getCompany () throws StorageException public Company getCompany () throws StorageException
{ {
return (Company)(Company.DUMMY_Company); return (Company)(Company.DUMMY_Company);
......
...@@ -70,6 +70,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -70,6 +70,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public static final String SINGLEREFERENCE_PaymentPlan = "PaymentPlan"; public static final String SINGLEREFERENCE_PaymentPlan = "PaymentPlan";
public static final String MULTIPLEREFERENCE_Users = "Users"; public static final String MULTIPLEREFERENCE_Users = "Users";
public static final String BACKREF_Users = ""; public static final String BACKREF_Users = "";
public static final String MULTIPLEREFERENCE_Clients = "Clients";
public static final String BACKREF_Clients = "";
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All"; public static final String SEARCH_All = "All";
...@@ -128,6 +130,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -128,6 +130,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
// Private attributes corresponding to multiple references // Private attributes corresponding to multiple references
private MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> _Users; private MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> _Users;
private MultipleAssociation<HiringTeam, Client> _Clients;
// Map of maps of metadata // Map of maps of metadata
...@@ -164,11 +167,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -164,11 +167,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
String tmp_Users = CompanyUserHiringTeamLink.BACKREF_HiringTeam; String tmp_Users = CompanyUserHiringTeamLink.BACKREF_HiringTeam;
String tmp_Clients = Client.BACKREF_HiringTeam;
String tmp_Company = Company.BACKREF_HiringTeams; String tmp_Company = Company.BACKREF_HiringTeams;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Users(); setupAssocMetaData_Users();
setupAssocMetaData_Clients();
setupAssocMetaData_Company(); setupAssocMetaData_Company();
setupAssocMetaData_BillingTeam(); setupAssocMetaData_BillingTeam();
setupAssocMetaData_AddedByUser(); setupAssocMetaData_AddedByUser();
...@@ -221,6 +226,20 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -221,6 +226,20 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_Clients()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "HiringTeam");
metaInfo.put ("name", "Clients");
metaInfo.put ("type", "Client");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeam.Clients:", metaInfo);
ATTRIBUTES_METADATA_HiringTeam.put (MULTIPLEREFERENCE_Clients, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Company() private static void setupAssocMetaData_Company()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -714,6 +733,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -714,6 +733,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_AddedByUser = new SingleAssociation<HiringTeam, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_hiring_team"); _AddedByUser = new SingleAssociation<HiringTeam, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_hiring_team");
_PaymentPlan = new SingleAssociation<HiringTeam, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_hiring_team"); _PaymentPlan = new SingleAssociation<HiringTeam, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_hiring_team");
_Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink); _Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);
_Clients = new MultipleAssociation<HiringTeam, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_HiringTeam, Client.REFERENCE_Client);
} }
...@@ -728,6 +748,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -728,6 +748,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_AddedByUser = new SingleAssociation<HiringTeam, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_hiring_team"); _AddedByUser = new SingleAssociation<HiringTeam, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_hiring_team");
_PaymentPlan = new SingleAssociation<HiringTeam, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_hiring_team"); _PaymentPlan = new SingleAssociation<HiringTeam, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_hiring_team");
_Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink); _Users = new MultipleAssociation<HiringTeam, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_Users, CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);
_Clients = new MultipleAssociation<HiringTeam, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_HiringTeam, Client.REFERENCE_Client);
return this; return this;
...@@ -3179,6 +3200,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3179,6 +3200,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
result.add("Users"); result.add("Users");
result.add("Clients");
return result; return result;
} }
...@@ -3195,6 +3218,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3195,6 +3218,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink ; return CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink ;
} }
if (MULTIPLEREFERENCE_Clients.equals(attribName))
{
return Client.REFERENCE_Client ;
}
return super.getMultiAssocReferenceInstance(attribName); return super.getMultiAssocReferenceInstance(attribName);
} }
...@@ -3208,6 +3236,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3208,6 +3236,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam ; return CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam ;
} }
if (MULTIPLEREFERENCE_Clients.equals(attribName))
{
return Client.SINGLEREFERENCE_HiringTeam ;
}
return super.getMultiAssocBackReference(attribName); return super.getMultiAssocBackReference(attribName);
} }
...@@ -3224,6 +3257,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3224,6 +3257,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return this.getUsersCount(); return this.getUsersCount();
} }
if (MULTIPLEREFERENCE_Clients.equals(attribName))
{
return this.getClientsCount();
}
return super.getMultiAssocCount(attribName); return super.getMultiAssocCount(attribName);
} }
...@@ -3240,6 +3278,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3240,6 +3278,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return this.getUsersAt(index); return this.getUsersAt(index);
} }
if (MULTIPLEREFERENCE_Clients.equals(attribName))
{
return this.getClientsAt(index);
}
return super.getMultiAssocAt(attribName, index); return super.getMultiAssocAt(attribName, index);
} }
...@@ -3258,6 +3301,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3258,6 +3301,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_Clients.equals(attribName))
{
addToClients((Client)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement); super.addToMultiAssoc(attribName, newElement);
} }
...@@ -3275,6 +3325,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3275,6 +3325,13 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_Clients.equals(attribName))
{
removeFromClients((Client)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement); super.removeFromMultiAssoc(attribName, oldElement);
} }
...@@ -3289,6 +3346,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3289,6 +3346,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_Clients.equals(attribName))
{
_Clients.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements); super.__loadMultiAssoc(attribName, elements);
} }
...@@ -3302,6 +3365,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3302,6 +3365,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return _Users.isLoaded (); return _Users.isLoaded ();
} }
if (MULTIPLEREFERENCE_Clients.equals(attribName))
{
return _Clients.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName); return super.__isMultiAssocLoaded(attribName);
} }
...@@ -3377,6 +3445,75 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3377,6 +3445,75 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return _Users.getSet (); return _Users.getSet ();
} }
public FieldWriteability getWriteability_Clients ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getClientsCount () throws StorageException
{
assertValid();
return _Clients.getReferencedObjectsCount ();
}
public void addToClients (Client newElement) throws StorageException
{
if (_Clients.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_Clients () != FieldWriteability.FALSE, "MultiAssoc Clients is not writeable (add)");
_Clients.appendElement (newElement);
try
{
if (newElement.getHiringTeam () != this)
{
newElement.setHiringTeam ((HiringTeam)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromClients (Client elementToRemove) throws StorageException
{
if (_Clients.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_Clients () != FieldWriteability.FALSE, "MultiAssoc Clients is not writeable (remove)");
_Clients.removeElement (elementToRemove);
try
{
if (elementToRemove.getHiringTeam () != null)
{
elementToRemove.setHiringTeam (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public Client getClientsAt (int index) throws StorageException
{
return (Client)(_Clients.getElementAt (index));
}
public SortedSet<Client> getClientsSet () throws StorageException
{
return _Clients.getSet ();
}
public void onDelete () public void onDelete ()
...@@ -3403,6 +3540,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3403,6 +3540,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
referenced.setHiringTeam(null); referenced.setHiringTeam(null);
} }
for(Client referenced : CollectionUtils.reverse(getClientsSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null HiringTeam from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setHiringTeam(null);
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -3769,6 +3912,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3769,6 +3912,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
BaseHiringTeam sourceHiringTeam = (BaseHiringTeam)(source); BaseHiringTeam sourceHiringTeam = (BaseHiringTeam)(source);
_Users.copyFrom (sourceHiringTeam._Users, linkToGhosts); _Users.copyFrom (sourceHiringTeam._Users, linkToGhosts);
_Clients.copyFrom (sourceHiringTeam._Clients, linkToGhosts);
} }
} }
...@@ -3817,6 +3961,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3817,6 +3961,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_AddedByUser.readExternalData(vals.get(SINGLEREFERENCE_AddedByUser)); _AddedByUser.readExternalData(vals.get(SINGLEREFERENCE_AddedByUser));
_PaymentPlan.readExternalData(vals.get(SINGLEREFERENCE_PaymentPlan)); _PaymentPlan.readExternalData(vals.get(SINGLEREFERENCE_PaymentPlan));
_Users.readExternalData(vals.get(MULTIPLEREFERENCE_Users)); _Users.readExternalData(vals.get(MULTIPLEREFERENCE_Users));
_Clients.readExternalData(vals.get(MULTIPLEREFERENCE_Clients));
} }
...@@ -3852,6 +3997,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3852,6 +3997,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
vals.put (SINGLEREFERENCE_AddedByUser, _AddedByUser.writeExternalData()); vals.put (SINGLEREFERENCE_AddedByUser, _AddedByUser.writeExternalData());
vals.put (SINGLEREFERENCE_PaymentPlan, _PaymentPlan.writeExternalData()); vals.put (SINGLEREFERENCE_PaymentPlan, _PaymentPlan.writeExternalData());
vals.put (MULTIPLEREFERENCE_Users, _Users.writeExternalData()); vals.put (MULTIPLEREFERENCE_Users, _Users.writeExternalData());
vals.put (MULTIPLEREFERENCE_Clients, _Clients.writeExternalData());
} }
...@@ -3947,6 +4093,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3947,6 +4093,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
// Compare multiple assocs // Compare multiple assocs
_Users.compare (otherHiringTeam._Users, listener); _Users.compare (otherHiringTeam._Users, listener);
_Clients.compare (otherHiringTeam._Clients, listener);
} }
} }
...@@ -3988,6 +4135,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -3988,6 +4135,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
visitor.visitAssociation (_AddedByUser); visitor.visitAssociation (_AddedByUser);
visitor.visitAssociation (_PaymentPlan); visitor.visitAssociation (_PaymentPlan);
visitor.visitAssociation (_Users); visitor.visitAssociation (_Users);
visitor.visitAssociation (_Clients);
} }
...@@ -4016,6 +4164,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -4016,6 +4164,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
visitor.visit (_Users); visitor.visit (_Users);
} }
if (scope.includes (_Clients))
{
visitor.visit (_Clients);
}
} }
...@@ -4677,6 +4829,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -4677,6 +4829,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return getWriteability_Users (); return getWriteability_Users ();
} }
else if (fieldName.equals (MULTIPLEREFERENCE_Clients))
{
return getWriteability_Clients ();
}
else if (fieldName.equals (SINGLEREFERENCE_Company)) else if (fieldName.equals (SINGLEREFERENCE_Company))
{ {
return getWriteability_Company (); return getWriteability_Company ();
...@@ -5296,6 +5452,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5296,6 +5452,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return toUsers (); return toUsers ();
} }
if (name.equals ("Clients"))
{
return toClients ();
}
if (name.equals ("IsLogoDeleted")) if (name.equals ("IsLogoDeleted"))
{ {
return toIsLogoDeleted (); return toIsLogoDeleted ();
...@@ -5461,6 +5621,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass ...@@ -5461,6 +5621,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{ {
return CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink.new CompanyUserHiringTeamLinkPipeLineFactory<From, CompanyUserHiringTeamLink> (this, new ORMMultiAssocPipe<Me, CompanyUserHiringTeamLink>(MULTIPLEREFERENCE_Users, filter)); return CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink.new CompanyUserHiringTeamLinkPipeLineFactory<From, CompanyUserHiringTeamLink> (this, new ORMMultiAssocPipe<Me, CompanyUserHiringTeamLink>(MULTIPLEREFERENCE_Users, filter));
} }
public Client.ClientPipeLineFactory<From, Client> toClients () { return toClients(Filter.ALL); }
public Client.ClientPipeLineFactory<From, Client> toClients (Filter<Client> filter)
{
return Client.REFERENCE_Client.new ClientPipeLineFactory<From, Client> (this, new ORMMultiAssocPipe<Me, Client>(MULTIPLEREFERENCE_Clients, filter));
}
} }
...@@ -5570,6 +5736,23 @@ class DummyHiringTeam extends HiringTeam ...@@ -5570,6 +5736,23 @@ class DummyHiringTeam extends HiringTeam
return new TreeSet(); return new TreeSet();
} }
public int getClientsCount () throws StorageException
{
return 0;
}
public Client getClientsAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association Clients");
}
public SortedSet getClientsSet () throws StorageException
{
return new TreeSet();
}
} }
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
<ATTRIB name="City" type="String" dbcol="city" mandatory="false" length="100"/> <ATTRIB name="City" type="String" dbcol="city" mandatory="false" length="100"/>
<ATTRIB name="TimeZone" type="TimeZone" dbcol="time_zone" mandatory="false" attribHelper="EnumeratedAttributeHelper"/> <ATTRIB name="TimeZone" type="TimeZone" dbcol="time_zone" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<SINGLEREFERENCE name="Company" type="Company" dbcol="company_id" backreferenceName="Clients" mandatory="true"/> <SINGLEREFERENCE name="HiringTeam" type="HiringTeam" dbcol="hiring_team_id" backreferenceName="Clients" mandatory="true"/>
<SINGLEREFERENCE name="Company" type="Company" dbcol="company_id" backreferenceName="Clients" mandatory="false"/>
</TABLE> </TABLE>
......
...@@ -74,7 +74,7 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr ...@@ -74,7 +74,7 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr
} }
private String SELECT_COLUMNS = "{PREFIX}tl_client.object_id as id, {PREFIX}tl_client.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_client.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_client.client_name, {PREFIX}tl_client.client_logo, {PREFIX}tl_client.email, {PREFIX}tl_client.contact_name, {PREFIX}tl_client.contact_surname, {PREFIX}tl_client.phone, {PREFIX}tl_client.state, {PREFIX}tl_client.country, {PREFIX}tl_client.post_code, {PREFIX}tl_client.city, {PREFIX}tl_client.time_zone, {PREFIX}tl_client.company_id, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}tl_client.object_id as id, {PREFIX}tl_client.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_client.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_client.client_name, {PREFIX}tl_client.client_logo, {PREFIX}tl_client.email, {PREFIX}tl_client.contact_name, {PREFIX}tl_client.contact_surname, {PREFIX}tl_client.phone, {PREFIX}tl_client.state, {PREFIX}tl_client.country, {PREFIX}tl_client.post_code, {PREFIX}tl_client.city, {PREFIX}tl_client.time_zone, {PREFIX}tl_client.hiring_team_id, {PREFIX}tl_client.company_id, 1 AS commasafe ";
private String SELECT_JOINS = ""; private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
...@@ -136,6 +136,7 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr ...@@ -136,6 +136,7 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr
!tl_clientPSet.containsAttrib(Client.FIELD_PostCode)|| !tl_clientPSet.containsAttrib(Client.FIELD_PostCode)||
!tl_clientPSet.containsAttrib(Client.FIELD_City)|| !tl_clientPSet.containsAttrib(Client.FIELD_City)||
!tl_clientPSet.containsAttrib(Client.FIELD_TimeZone)|| !tl_clientPSet.containsAttrib(Client.FIELD_TimeZone)||
!tl_clientPSet.containsAttrib(Client.SINGLEREFERENCE_HiringTeam)||
!tl_clientPSet.containsAttrib(Client.SINGLEREFERENCE_Company)) !tl_clientPSet.containsAttrib(Client.SINGLEREFERENCE_Company))
{ {
// We will need to retrieve it // We will need to retrieve it
...@@ -182,6 +183,16 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr ...@@ -182,6 +183,16 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr
{ {
throw new RuntimeException (); throw new RuntimeException ();
} }
else if (refName.equals (Client.SINGLEREFERENCE_HiringTeam))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_client " +
"WHERE " + SELECT_JOINS + "hiring_team_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else if (refName.equals (Client.SINGLEREFERENCE_Company)) else if (refName.equals (Client.SINGLEREFERENCE_Company))
{ {
String query = "SELECT " + SELECT_COLUMNS + String query = "SELECT " + SELECT_COLUMNS +
...@@ -216,10 +227,10 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr ...@@ -216,10 +227,10 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_client " + "UPDATE {PREFIX}tl_client " +
"SET client_name = ?, client_logo = ?, email = ?, contact_name = ?, contact_surname = ?, phone = ?, state = ?, country = ?, post_code = ?, city = ?, time_zone = ?, company_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET client_name = ?, client_logo = ?, email = ?, contact_name = ?, contact_surname = ?, phone = ?, state = ?, country = ?, post_code = ?, city = ?, time_zone = ?, hiring_team_id = ? , company_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_client.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE tl_client.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_ClientName.getForSQL(dummyClientName, tl_clientPSet.getAttrib (Client.FIELD_ClientName))).listEntry (HELPER_ClientLogo.getForSQL(dummyClientLogo, tl_clientPSet.getAttrib (Client.FIELD_ClientLogo))).listEntry (HELPER_Email.getForSQL(dummyEmail, tl_clientPSet.getAttrib (Client.FIELD_Email))).listEntry (HELPER_ContactName.getForSQL(dummyContactName, tl_clientPSet.getAttrib (Client.FIELD_ContactName))).listEntry (HELPER_ContactSurname.getForSQL(dummyContactSurname, tl_clientPSet.getAttrib (Client.FIELD_ContactSurname))).listEntry (HELPER_Phone.getForSQL(dummyPhone, tl_clientPSet.getAttrib (Client.FIELD_Phone))).listEntry (HELPER_State.getForSQL(dummyState, tl_clientPSet.getAttrib (Client.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_clientPSet.getAttrib (Client.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_clientPSet.getAttrib (Client.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_clientPSet.getAttrib (Client.FIELD_City))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_clientPSet.getAttrib (Client.FIELD_TimeZone))).listEntry (SQLManager.CheckNull((Long)(tl_clientPSet.getAttrib (Client.SINGLEREFERENCE_Company)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_ClientName.getForSQL(dummyClientName, tl_clientPSet.getAttrib (Client.FIELD_ClientName))).listEntry (HELPER_ClientLogo.getForSQL(dummyClientLogo, tl_clientPSet.getAttrib (Client.FIELD_ClientLogo))).listEntry (HELPER_Email.getForSQL(dummyEmail, tl_clientPSet.getAttrib (Client.FIELD_Email))).listEntry (HELPER_ContactName.getForSQL(dummyContactName, tl_clientPSet.getAttrib (Client.FIELD_ContactName))).listEntry (HELPER_ContactSurname.getForSQL(dummyContactSurname, tl_clientPSet.getAttrib (Client.FIELD_ContactSurname))).listEntry (HELPER_Phone.getForSQL(dummyPhone, tl_clientPSet.getAttrib (Client.FIELD_Phone))).listEntry (HELPER_State.getForSQL(dummyState, tl_clientPSet.getAttrib (Client.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_clientPSet.getAttrib (Client.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_clientPSet.getAttrib (Client.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_clientPSet.getAttrib (Client.FIELD_City))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_clientPSet.getAttrib (Client.FIELD_TimeZone))).listEntry (SQLManager.CheckNull((Long)(tl_clientPSet.getAttrib (Client.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_clientPSet.getAttrib (Client.SINGLEREFERENCE_Company)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -487,6 +498,7 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr ...@@ -487,6 +498,7 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr
tl_clientPSet.setAttrib(Client.FIELD_City, HELPER_City.getFromRS(dummyCity, r, "city")); tl_clientPSet.setAttrib(Client.FIELD_City, HELPER_City.getFromRS(dummyCity, r, "city"));
tl_clientPSet.setAttrib(Client.FIELD_TimeZone, HELPER_TimeZone.getFromRS(dummyTimeZone, r, "time_zone")); tl_clientPSet.setAttrib(Client.FIELD_TimeZone, HELPER_TimeZone.getFromRS(dummyTimeZone, r, "time_zone"));
tl_clientPSet.setAttrib(Client.SINGLEREFERENCE_HiringTeam, r.getObject ("hiring_team_id"));
tl_clientPSet.setAttrib(Client.SINGLEREFERENCE_Company, r.getObject ("company_id")); tl_clientPSet.setAttrib(Client.SINGLEREFERENCE_Company, r.getObject ("company_id"));
} }
...@@ -504,10 +516,10 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr ...@@ -504,10 +516,10 @@ public class ClientPersistenceMgr extends ObjectPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_client " + "INSERT INTO {PREFIX}tl_client " +
" (client_name, client_logo, email, contact_name, contact_surname, phone, state, country, post_code, city, time_zone, company_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " + " (client_name, client_logo, email, contact_name, contact_surname, phone, state, country, post_code, city, time_zone, hiring_team_id, company_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " + "VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")", " (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_ClientName.getForSQL(dummyClientName, tl_clientPSet.getAttrib (Client.FIELD_ClientName))).listEntry (HELPER_ClientLogo.getForSQL(dummyClientLogo, tl_clientPSet.getAttrib (Client.FIELD_ClientLogo))).listEntry (HELPER_Email.getForSQL(dummyEmail, tl_clientPSet.getAttrib (Client.FIELD_Email))).listEntry (HELPER_ContactName.getForSQL(dummyContactName, tl_clientPSet.getAttrib (Client.FIELD_ContactName))).listEntry (HELPER_ContactSurname.getForSQL(dummyContactSurname, tl_clientPSet.getAttrib (Client.FIELD_ContactSurname))).listEntry (HELPER_Phone.getForSQL(dummyPhone, tl_clientPSet.getAttrib (Client.FIELD_Phone))).listEntry (HELPER_State.getForSQL(dummyState, tl_clientPSet.getAttrib (Client.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_clientPSet.getAttrib (Client.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_clientPSet.getAttrib (Client.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_clientPSet.getAttrib (Client.FIELD_City))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_clientPSet.getAttrib (Client.FIELD_TimeZone))) .listEntry (SQLManager.CheckNull((Long)(tl_clientPSet.getAttrib (Client.SINGLEREFERENCE_Company)))) .listEntry (objectID.longID ()).toList().toArray()); CollectionUtils.listEntry (HELPER_ClientName.getForSQL(dummyClientName, tl_clientPSet.getAttrib (Client.FIELD_ClientName))).listEntry (HELPER_ClientLogo.getForSQL(dummyClientLogo, tl_clientPSet.getAttrib (Client.FIELD_ClientLogo))).listEntry (HELPER_Email.getForSQL(dummyEmail, tl_clientPSet.getAttrib (Client.FIELD_Email))).listEntry (HELPER_ContactName.getForSQL(dummyContactName, tl_clientPSet.getAttrib (Client.FIELD_ContactName))).listEntry (HELPER_ContactSurname.getForSQL(dummyContactSurname, tl_clientPSet.getAttrib (Client.FIELD_ContactSurname))).listEntry (HELPER_Phone.getForSQL(dummyPhone, tl_clientPSet.getAttrib (Client.FIELD_Phone))).listEntry (HELPER_State.getForSQL(dummyState, tl_clientPSet.getAttrib (Client.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_clientPSet.getAttrib (Client.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_clientPSet.getAttrib (Client.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_clientPSet.getAttrib (Client.FIELD_City))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_clientPSet.getAttrib (Client.FIELD_TimeZone))) .listEntry (SQLManager.CheckNull((Long)(tl_clientPSet.getAttrib (Client.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_clientPSet.getAttrib (Client.SINGLEREFERENCE_Company)))) .listEntry (objectID.longID ()).toList().toArray());
tl_clientPSet.setStatus (PersistentSetStatus.PROCESSED); tl_clientPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<IMPORT value="oneit.business.shopping.orm.*"/> <IMPORT value="oneit.business.shopping.orm.*"/>
<MULTIPLEREFERENCE name="Users" type="CompanyUserHiringTeamLink" backreferenceName="HiringTeam" /> <MULTIPLEREFERENCE name="Users" type="CompanyUserHiringTeamLink" backreferenceName="HiringTeam" />
<!--<MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="HiringTeam" />--> <MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="HiringTeam" />
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/> <TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
......
...@@ -20,9 +20,9 @@ public class ClientSortOption extends AbstractEnumerated ...@@ -20,9 +20,9 @@ public class ClientSortOption extends AbstractEnumerated
public static final EnumeratedFactory FACTORY_ClientSortOption = new ClientSortOptionFactory(); public static final EnumeratedFactory FACTORY_ClientSortOption = new ClientSortOptionFactory();
public static final ClientSortOption ALPHA_A_Z = new ClientSortOption ("ALPHA_A_Z", "ALPHA_A_Z", "A-Z", false); public static final ClientSortOption ALPHA_A_Z = new ClientSortOption ("ALPHA_A_Z", "ALPHA_A_Z", "Alphabetical (A-Z)", false);
public static final ClientSortOption ALPHA_Z_A = new ClientSortOption ("ALPHA_Z_A", "ALPHA_Z_A", "Z-A", false); public static final ClientSortOption ALPHA_Z_A = new ClientSortOption ("ALPHA_Z_A", "ALPHA_Z_A", "Alphabetical (Z-A)", false);
public static final ClientSortOption OPEN_JOBS = new ClientSortOption ("OPEN_JOBS", "OPEN_JOBS", "Open Jobs", false); public static final ClientSortOption OPEN_JOBS = new ClientSortOption ("OPEN_JOBS", "OPEN_JOBS", "Open Jobs", false);
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<ROOT> <ROOT>
<CONSTANT package="performa.orm.types" name="ClientSortOption"> <CONSTANT package="performa.orm.types" name="ClientSortOption">
<VALUE name="ALPHA_A_Z" value="ALPHA_A_Z" description="A-Z"/> <VALUE name="ALPHA_A_Z" value="ALPHA_A_Z" description="Alphabetical (A-Z)"/>
<VALUE name="ALPHA_Z_A" value="ALPHA_Z_A" description="Z-A"/> <VALUE name="ALPHA_Z_A" value="ALPHA_Z_A" description="Alphabetical (Z-A)"/>
<VALUE name="OPEN_JOBS" value="OPEN_JOBS" description="Open Jobs"/> <VALUE name="OPEN_JOBS" value="OPEN_JOBS" description="Open Jobs"/>
<VALUE name="FILLED_JOBS" value="FILLED_JOBS" description="Filled Jobs"/> <VALUE name="FILLED_JOBS" value="FILLED_JOBS" description="Filled Jobs"/>
......
...@@ -334,7 +334,7 @@ public class Utils ...@@ -334,7 +334,7 @@ public class Utils
SecUser secUser = SecUser.getTXUser(transaction); SecUser secUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser); CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
return companyUser.getCompany().getClientsSet().toArray(new Client[0]); return companyUser.getSelectedTeam().getClientsSet().toArray(new Client[0]);
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
SecUser loggedInUser = SecUser.getTXUser(transaction); SecUser loggedInUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser); CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
client.setCompany(companyUser.getCompany()); client.setHiringTeam(companyUser.getSelectedTeam());
%><%@include file="/saferedirect.jsp"%><% %><%@include file="/saferedirect.jsp"%><%
} }
......
<?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.RedefineTableOperation">
<tableName factory="String">tl_client</tableName>
<column name="hiring_team_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_client" indexName="idx_tl_client_hiring_team_id" isUnique="false">
<column name="hiring_team_id"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?xml version="1.0"?>
<!-- @AutoRun -->
<OBJECTS name="">
<NODE name="Script" factory="Vector">
<NODE name="insertOp" factory="Participant" class="oneit.sql.transfer.InsertOperation"
query="select distinct(tl_company.*) from tl_company, tl_hiring_team where tl_hiring_team.company_id != tl_company.object_id">
<tableName factory="String">tl_hiring_team</tableName>
<value name='object_id' factory='Participant' class="oneit.sql.transfer.DBTransferer$ObjectID"/>
<value name='object_last_updated_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='object_created_date' class="oneit.sql.transfer.DBTransferer$Timestamp"/>
<value name='hiring_team_name' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="company_name" />
<value name='hiring_team_logo' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="company_logo" />
<value name='hiring_team_type' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="hiring_team_type" />
<value name='industry' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="industry" />
<value name='time_zone' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="time_zone" />
<value name='state' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="state" />
<value name='country' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="country" />
<value name='post_code' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="post_code" />
<value name='city' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="city" />
<value name='has_client_support' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="has_client_support" />
<value name='manage_own_billing' factory='Boolean'>true</value>
<value name='stripe_reference' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="stripe_reference" />
<value name='stripe_subscription' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="stripe_subscription" />
<value name='name_on_card' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="name_on_card" />
<value name='card_post_code' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="card_post_code" />
<value name='card_id' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="card_id" />
<value name='plan_renewed_on' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="plan_renewed_on" />
<value name='used_credits' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="used_credits" />
<value name='company_id' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="object_id" />
<value name='added_by_user_id' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="added_by_user_id" />
<value name='payment_plan_id' factory='Participant' class="oneit.sql.transfer.InsertOperation$QueryColumn" column="payment_plan_id" />
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
UPDATE tl_client
SET hiring_team_id = tl_hiring_team.object_id
FROM tl_hiring_team
WHERE tl_hiring_team.company_id = tl_client.company_id AND tl_client.hiring_team_id IS NULL;
\ No newline at end of file
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