Commit 52f3f572 by Nilu

Merge branch 'feature/Feature-Phase-3.1' into feature/Feature-Phase-3.1-2

parents e068d5b9 7db6b3ec
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<column name="is_email_changed" type="Boolean" nullable="true"/> <column name="is_email_changed" type="Boolean" nullable="true"/>
<column name="user_id" type="Long" length="11" nullable="true"/> <column name="user_id" type="Long" length="11" nullable="true"/>
<column name="company_id" type="Long" length="11" nullable="true"/> <column name="company_id" type="Long" length="11" nullable="true"/>
<column name="default_hiring_team_id" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="oneit_sec_user_extension" indexName="idx_oneit_sec_user_extension_user_id" isUnique="false"><column name="user_id"/></NODE> <NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="oneit_sec_user_extension" indexName="idx_oneit_sec_user_extension_user_id" isUnique="false"><column name="user_id"/></NODE>
......
<?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">tl_company_user_hiring_team_link</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="hiring_team_id" type="Long" length="11" nullable="true"/>
<column name="company_user_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_company_user_hiring_team_link" indexName="idx_tl_company_user_hiring_team_link_hiring_team_id" isUnique="false"><column name="hiring_team_id"/></NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_company_user_hiring_team_link" indexName="idx_tl_company_user_hiring_team_link_company_user_id" isUnique="false"><column name="company_user_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
<?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">tl_hiring_team</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="hiring_team_name" type="String" nullable="false" length="100"/>
<column name="hiring_team_logo" type="BLOB" nullable="true"/>
<column name="hiring_team_type" type="String" nullable="true" length="200"/>
<column name="industry" type="String" nullable="true" length="200"/>
<column name="time_zone" type="String" nullable="true" length="200"/>
<column name="state" type="String" nullable="true" length="200"/>
<column name="country" type="String" nullable="true" length="200"/>
<column name="post_code" type="String" nullable="true" length="10"/>
<column name="city" type="String" nullable="true" length="100"/>
<column name="has_client_support" type="Boolean" nullable="true"/>
<column name="manage_own_billing" type="Boolean" nullable="true"/>
<column name="stripe_reference" type="String" nullable="true" length="100"/>
<column name="stripe_subscription" type="String" nullable="true" length="100"/>
<column name="name_on_card" type="String" nullable="true" length="100"/>
<column name="card_post_code" type="String" nullable="true" length="10"/>
<column name="card_id" type="String" nullable="true" length="100"/>
<column name="plan_renewed_on" type="Date" nullable="true"/>
<column name="used_credits" type="Long" nullable="true"/>
<column name="company_id" type="Long" length="11" nullable="false"/>
<column name="billing_team_id" type="Long" length="11" nullable="true"/>
<column name="added_by_user_id" type="Long" length="11" nullable="false"/>
<column name="payment_plan_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_hiring_team" indexName="idx_tl_hiring_team_company_id" isUnique="false"><column name="company_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
...@@ -18,7 +18,8 @@ CREATE TABLE oneit_sec_user_extension ( ...@@ -18,7 +18,8 @@ CREATE TABLE oneit_sec_user_extension (
is_account_verified char(1) NULL, is_account_verified char(1) NULL,
is_email_changed char(1) NULL, is_email_changed char(1) NULL,
user_id numeric(12) NULL, user_id numeric(12) NULL,
company_id numeric(12) NULL company_id numeric(12) NULL,
default_hiring_team_id numeric(12) NULL
); );
......
-- DROP TABLE tl_company_user_hiring_team_link;
CREATE TABLE tl_company_user_hiring_team_link (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
hiring_team_id numeric(12) NULL,
company_user_id numeric(12) NULL
);
ALTER TABLE tl_company_user_hiring_team_link ADD
CONSTRAINT PK_tl_company_user_hiring_team_link PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_company_user_hiring_team_link_hiring_team_id
ON tl_company_user_hiring_team_link (hiring_team_id);
CREATE INDEX idx_tl_company_user_hiring_team_link_company_user_id
ON tl_company_user_hiring_team_link (company_user_id);
-- DROP TABLE tl_hiring_team;
CREATE TABLE tl_hiring_team (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
hiring_team_name varchar(100) NOT NULL,
hiring_team_logo image NULL,
hiring_team_type varchar(200) NULL,
industry varchar(200) NULL,
time_zone varchar(200) NULL,
state varchar(200) NULL,
country varchar(200) NULL,
post_code varchar(10) NULL,
city varchar(100) NULL,
has_client_support char(1) NULL,
manage_own_billing char(1) NULL,
stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL,
name_on_card varchar(100) NULL,
card_post_code varchar(10) NULL,
card_id varchar(100) NULL,
plan_renewed_on datetime NULL,
used_credits numeric(12) NULL,
company_id numeric(12) NOT NULL,
billing_team_id numeric(12) NULL,
added_by_user_id numeric(12) NOT NULL,
payment_plan_id numeric(12) NULL
);
ALTER TABLE tl_hiring_team ADD
CONSTRAINT PK_tl_hiring_team PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_hiring_team_company_id
ON tl_hiring_team (company_id);
...@@ -19,7 +19,8 @@ CREATE TABLE oneit_sec_user_extension ( ...@@ -19,7 +19,8 @@ CREATE TABLE oneit_sec_user_extension (
is_account_verified char(1) NULL, is_account_verified char(1) NULL,
is_email_changed char(1) NULL, is_email_changed char(1) NULL,
user_id number(12) NULL, user_id number(12) NULL,
company_id number(12) NULL company_id number(12) NULL,
default_hiring_team_id number(12) NULL
); );
......
-- DROP TABLE tl_company_user_hiring_team_link;
CREATE TABLE tl_company_user_hiring_team_link (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
hiring_team_id number(12) NULL,
company_user_id number(12) NULL
);
ALTER TABLE tl_company_user_hiring_team_link ADD
CONSTRAINT PK_tl_company_user_hiring_team_link PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_company_user_hiring_team_link_hiring_team_id
ON tl_company_user_hiring_team_link (hiring_team_id);
CREATE INDEX idx_tl_company_user_hiring_team_link_company_user_id
ON tl_company_user_hiring_team_link (company_user_id);
-- DROP TABLE tl_hiring_team;
CREATE TABLE tl_hiring_team (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
hiring_team_name varchar2(100) NOT NULL,
hiring_team_logo blob NULL,
hiring_team_type varchar2(200) NULL,
industry varchar2(200) NULL,
time_zone varchar2(200) NULL,
state varchar2(200) NULL,
country varchar2(200) NULL,
post_code varchar2(10) NULL,
city varchar2(100) NULL,
has_client_support char(1) NULL,
manage_own_billing char(1) NULL,
stripe_reference varchar2(100) NULL,
stripe_subscription varchar2(100) NULL,
name_on_card varchar2(100) NULL,
card_post_code varchar2(10) NULL,
card_id varchar2(100) NULL,
plan_renewed_on date NULL,
used_credits number(12) NULL,
company_id number(12) NOT NULL,
billing_team_id number(12) NULL,
added_by_user_id number(12) NOT NULL,
payment_plan_id number(12) NULL
);
ALTER TABLE tl_hiring_team ADD
CONSTRAINT PK_tl_hiring_team PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_hiring_team_company_id
ON tl_hiring_team (company_id);
...@@ -19,7 +19,8 @@ CREATE TABLE oneit_sec_user_extension ( ...@@ -19,7 +19,8 @@ CREATE TABLE oneit_sec_user_extension (
is_account_verified char(1) NULL, is_account_verified char(1) NULL,
is_email_changed char(1) NULL, is_email_changed char(1) NULL,
user_id numeric(12) NULL, user_id numeric(12) NULL,
company_id numeric(12) NULL company_id numeric(12) NULL,
default_hiring_team_id numeric(12) NULL
); );
......
-- @AutoRun
-- drop table tl_company_user_hiring_team_link;
CREATE TABLE tl_company_user_hiring_team_link (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
hiring_team_id numeric(12) NULL,
company_user_id numeric(12) NULL
);
ALTER TABLE tl_company_user_hiring_team_link ADD
CONSTRAINT pk_tl_company_user_hiring_team_link PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_company_user_hiring_team_link_hiring_team_id
ON tl_company_user_hiring_team_link (hiring_team_id);
CREATE INDEX idx_tl_company_user_hiring_team_link_company_user_id
ON tl_company_user_hiring_team_link (company_user_id);
-- @AutoRun
-- drop table tl_hiring_team;
CREATE TABLE tl_hiring_team (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
hiring_team_name varchar(100) NOT NULL,
hiring_team_logo bytea NULL,
hiring_team_type varchar(200) NULL,
industry varchar(200) NULL,
time_zone varchar(200) NULL,
state varchar(200) NULL,
country varchar(200) NULL,
post_code varchar(10) NULL,
city varchar(100) NULL,
has_client_support char(1) NULL,
manage_own_billing char(1) NULL,
stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL,
name_on_card varchar(100) NULL,
card_post_code varchar(10) NULL,
card_id varchar(100) NULL,
plan_renewed_on timestamp NULL,
used_credits numeric(12) NULL,
company_id numeric(12) NOT NULL,
billing_team_id numeric(12) NULL,
added_by_user_id numeric(12) NOT NULL,
payment_plan_id numeric(12) NULL
);
ALTER TABLE tl_hiring_team ADD
CONSTRAINT pk_tl_hiring_team PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_hiring_team_company_id
ON tl_hiring_team (company_id);
...@@ -35,9 +35,9 @@ public class SendVerificationMailFP extends SaveFP ...@@ -35,9 +35,9 @@ public class SendVerificationMailFP extends SaveFP
Job job = (Job) request.getAttribute("Job"); Job job = (Job) request.getAttribute("Job");
Company company = (Company) request.getAttribute("Company"); Company company = (Company) request.getAttribute("Company");
Debug.assertion(company != null || job!=null, "BO not avaialble"); Debug.assertion(company != null || job != null, "BO not avaialble");
if(company!=null) if(company != null)
{ {
CompanyUser companyUser = company.getAddedByUser(); CompanyUser companyUser = company.getAddedByUser();
SecUser secUser = companyUser.getUser(); SecUser secUser = companyUser.getUser();
...@@ -61,7 +61,7 @@ public class SendVerificationMailFP extends SaveFP ...@@ -61,7 +61,7 @@ public class SendVerificationMailFP extends SaveFP
Job job = (Job) request.getAttribute("Job"); Job job = (Job) request.getAttribute("Job");
Company company = (Company) request.getAttribute("Company"); Company company = (Company) request.getAttribute("Company");
if(company!=null) if(company != null)
{ {
CompanyUser companyUser = company.getAddedByUser(); CompanyUser companyUser = company.getAddedByUser();
SecUser secUser = companyUser.getUser(); SecUser secUser = companyUser.getUser();
...@@ -98,7 +98,12 @@ public class SendVerificationMailFP extends SaveFP ...@@ -98,7 +98,12 @@ public class SendVerificationMailFP extends SaveFP
//set default to admin //set default to admin
companyUser.setRole(RoleType.ADMIN); companyUser.setRole(RoleType.ADMIN);
if(companyUser.getDefaultHiringTeam() != null)
{
companyUser.getDefaultHiringTeam().setHiringTeamName(company.getCompanyName());
}
Utils.sendVerificationMail(companyUser, request, emailer, SendVerificationMailFP.class.getName()); Utils.sendVerificationMail(companyUser, request, emailer, SendVerificationMailFP.class.getName());
LogMgr.log(LOG, LogLevel.PROCESSING1, "End of sending varification email.", companyUser); LogMgr.log(LOG, LogLevel.PROCESSING1, "End of sending varification email.", companyUser);
......
...@@ -62,6 +62,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -62,6 +62,8 @@ public abstract class BaseCompany extends BaseBusinessClass
public static final String FIELD_CardID = "CardID"; public static final String FIELD_CardID = "CardID";
public static final String FIELD_PlanRenewedOn = "PlanRenewedOn"; public static final String FIELD_PlanRenewedOn = "PlanRenewedOn";
public static final String FIELD_UsedCredits = "UsedCredits"; public static final String FIELD_UsedCredits = "UsedCredits";
public static final String FIELD_HiringTeamName = "HiringTeamName";
public static final String FIELD_ManageOwnBilling = "ManageOwnBilling";
public static final String FIELD_UserEmail = "UserEmail"; public static final String FIELD_UserEmail = "UserEmail";
public static final String FIELD_FirstName = "FirstName"; public static final String FIELD_FirstName = "FirstName";
public static final String FIELD_LastName = "LastName"; public static final String FIELD_LastName = "LastName";
...@@ -71,12 +73,16 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -71,12 +73,16 @@ public abstract class BaseCompany extends BaseBusinessClass
public static final String FIELD_PaymentJobCount = "PaymentJobCount"; public static final String FIELD_PaymentJobCount = "PaymentJobCount";
public static final String FIELD_StripeLast4 = "StripeLast4"; public static final String FIELD_StripeLast4 = "StripeLast4";
public static final String FIELD_StripeBrand = "StripeBrand"; public static final String FIELD_StripeBrand = "StripeBrand";
public static final String SINGLEREFERENCE_Owner = "Owner";
public static final String SINGLEREFERENCE_BillingTeam = "BillingTeam";
public static final String SINGLEREFERENCE_AddedByUser = "AddedByUser"; public static final String SINGLEREFERENCE_AddedByUser = "AddedByUser";
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 MULTIPLEREFERENCE_Clients = "Clients";
public static final String BACKREF_Clients = ""; public static final String BACKREF_Clients = "";
public static final String MULTIPLEREFERENCE_HiringTeams = "HiringTeams";
public static final String BACKREF_HiringTeams = "";
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All"; public static final String SEARCH_All = "All";
...@@ -101,6 +107,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -101,6 +107,8 @@ public abstract class BaseCompany extends BaseBusinessClass
private static final DefaultAttributeHelper<Company> HELPER_CardID = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Company> HELPER_CardID = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_PlanRenewedOn = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Company> HELPER_PlanRenewedOn = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_UsedCredits = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Company> HELPER_UsedCredits = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_HiringTeamName = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_ManageOwnBilling = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_UserEmail = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Company> HELPER_UserEmail = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_FirstName = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Company> HELPER_FirstName = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_LastName = DefaultAttributeHelper.INSTANCE; private static final DefaultAttributeHelper<Company> HELPER_LastName = DefaultAttributeHelper.INSTANCE;
...@@ -131,6 +139,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -131,6 +139,8 @@ public abstract class BaseCompany extends BaseBusinessClass
private String _CardID; private String _CardID;
private Date _PlanRenewedOn; private Date _PlanRenewedOn;
private Integer _UsedCredits; private Integer _UsedCredits;
private String _HiringTeamName;
private Boolean _ManageOwnBilling;
private String _UserEmail; private String _UserEmail;
private String _FirstName; private String _FirstName;
private String _LastName; private String _LastName;
...@@ -143,6 +153,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -143,6 +153,8 @@ public abstract class BaseCompany extends BaseBusinessClass
// Private attributes corresponding to single references // Private attributes corresponding to single references
private SingleAssociation<Company, CompanyUser> _Owner;
private SingleAssociation<Company, HiringTeam> _BillingTeam;
private SingleAssociation<Company, CompanyUser> _AddedByUser; private SingleAssociation<Company, CompanyUser> _AddedByUser;
private SingleAssociation<Company, PaymentPlan> _PaymentPlan; private SingleAssociation<Company, PaymentPlan> _PaymentPlan;
...@@ -150,12 +162,15 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -150,12 +162,15 @@ public abstract class BaseCompany extends BaseBusinessClass
// Private attributes corresponding to multiple references // Private attributes corresponding to multiple references
private MultipleAssociation<Company, CompanyUser> _Users; private MultipleAssociation<Company, CompanyUser> _Users;
private MultipleAssociation<Company, Client> _Clients; private MultipleAssociation<Company, Client> _Clients;
private MultipleAssociation<Company, HiringTeam> _HiringTeams;
// Map of maps of metadata // Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_Company = new HashMap (); private static final Map ATTRIBUTES_METADATA_Company = new HashMap ();
// Arrays of validators for each attribute // Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_HiringTeamName_Validators;
private static final AttributeValidator[] FIELD_ManageOwnBilling_Validators;
private static final AttributeValidator[] FIELD_UserEmail_Validators; private static final AttributeValidator[] FIELD_UserEmail_Validators;
private static final AttributeValidator[] FIELD_FirstName_Validators; private static final AttributeValidator[] FIELD_FirstName_Validators;
private static final AttributeValidator[] FIELD_LastName_Validators; private static final AttributeValidator[] FIELD_LastName_Validators;
...@@ -195,13 +210,19 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -195,13 +210,19 @@ public abstract class BaseCompany extends BaseBusinessClass
String tmp_Users = CompanyUser.BACKREF_Company; String tmp_Users = CompanyUser.BACKREF_Company;
String tmp_Clients = Client.BACKREF_Company; String tmp_Clients = Client.BACKREF_Company;
String tmp_HiringTeams = HiringTeam.BACKREF_Company;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_Users(); setupAssocMetaData_Users();
setupAssocMetaData_Clients(); setupAssocMetaData_Clients();
setupAssocMetaData_HiringTeams();
setupAssocMetaData_Owner();
setupAssocMetaData_BillingTeam();
setupAssocMetaData_AddedByUser(); setupAssocMetaData_AddedByUser();
setupAssocMetaData_PaymentPlan(); setupAssocMetaData_PaymentPlan();
FIELD_HiringTeamName_Validators = (AttributeValidator[])setupAttribMetaData_HiringTeamName(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ManageOwnBilling_Validators = (AttributeValidator[])setupAttribMetaData_ManageOwnBilling(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_UserEmail_Validators = (AttributeValidator[])setupAttribMetaData_UserEmail(validatorMapping).toArray (new AttributeValidator[0]); FIELD_UserEmail_Validators = (AttributeValidator[])setupAttribMetaData_UserEmail(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_FirstName_Validators = (AttributeValidator[])setupAttribMetaData_FirstName(validatorMapping).toArray (new AttributeValidator[0]); FIELD_FirstName_Validators = (AttributeValidator[])setupAttribMetaData_FirstName(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LastName_Validators = (AttributeValidator[])setupAttribMetaData_LastName(validatorMapping).toArray (new AttributeValidator[0]); FIELD_LastName_Validators = (AttributeValidator[])setupAttribMetaData_LastName(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -272,6 +293,46 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -272,6 +293,46 @@ public abstract class BaseCompany extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_HiringTeams()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "Company");
metaInfo.put ("name", "HiringTeams");
metaInfo.put ("type", "HiringTeam");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Company.HiringTeams:", metaInfo);
ATTRIBUTES_METADATA_Company.put (MULTIPLEREFERENCE_HiringTeams, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Owner()
{
Map metaInfo = new HashMap ();
metaInfo.put ("name", "Owner");
metaInfo.put ("type", "CompanyUser");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Company.Owner:", metaInfo);
ATTRIBUTES_METADATA_Company.put (SINGLEREFERENCE_Owner, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_BillingTeam()
{
Map metaInfo = new HashMap ();
metaInfo.put ("name", "BillingTeam");
metaInfo.put ("type", "HiringTeam");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Company.BillingTeam:", metaInfo);
ATTRIBUTES_METADATA_Company.put (SINGLEREFERENCE_BillingTeam, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_AddedByUser() private static void setupAssocMetaData_AddedByUser()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -302,6 +363,41 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -302,6 +363,41 @@ public abstract class BaseCompany extends BaseBusinessClass
// Meta Info setup // Meta Info setup
private static List setupAttribMetaData_HiringTeamName(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("name", "HiringTeamName");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Company.HiringTeamName:", metaInfo);
ATTRIBUTES_METADATA_Company.put (FIELD_HiringTeamName, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Company.class, "HiringTeamName", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Company.HiringTeamName:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_ManageOwnBilling(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("name", "ManageOwnBilling");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Company.ManageOwnBilling:", metaInfo);
ATTRIBUTES_METADATA_Company.put (FIELD_ManageOwnBilling, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Company.class, "ManageOwnBilling", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Company.ManageOwnBilling:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_UserEmail(Map validatorMapping) private static List setupAttribMetaData_UserEmail(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -858,6 +954,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -858,6 +954,8 @@ public abstract class BaseCompany extends BaseBusinessClass
_CardID = (String)(HELPER_CardID.initialise (_CardID)); _CardID = (String)(HELPER_CardID.initialise (_CardID));
_PlanRenewedOn = (Date)(HELPER_PlanRenewedOn.initialise (_PlanRenewedOn)); _PlanRenewedOn = (Date)(HELPER_PlanRenewedOn.initialise (_PlanRenewedOn));
_UsedCredits = (Integer)(HELPER_UsedCredits.initialise (_UsedCredits)); _UsedCredits = (Integer)(HELPER_UsedCredits.initialise (_UsedCredits));
_HiringTeamName = (String)(HELPER_HiringTeamName.initialise (_HiringTeamName));
_ManageOwnBilling = (Boolean)(Boolean.FALSE);
_UserEmail = (String)(HELPER_UserEmail.initialise (_UserEmail)); _UserEmail = (String)(HELPER_UserEmail.initialise (_UserEmail));
_FirstName = (String)(HELPER_FirstName.initialise (_FirstName)); _FirstName = (String)(HELPER_FirstName.initialise (_FirstName));
_LastName = (String)(HELPER_LastName.initialise (_LastName)); _LastName = (String)(HELPER_LastName.initialise (_LastName));
...@@ -875,10 +973,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -875,10 +973,13 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
super._initialiseAssociations (); super._initialiseAssociations ();
_Owner = new SingleAssociation<Company, CompanyUser> (this, SINGLEREFERENCE_Owner, null, CompanyUser.REFERENCE_CompanyUser, "");
_BillingTeam = new SingleAssociation<Company, HiringTeam> (this, SINGLEREFERENCE_BillingTeam, null, HiringTeam.REFERENCE_HiringTeam, "");
_AddedByUser = new SingleAssociation<Company, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_company"); _AddedByUser = new SingleAssociation<Company, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_company");
_PaymentPlan = new SingleAssociation<Company, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_company"); _PaymentPlan = new SingleAssociation<Company, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_company");
_Users = new MultipleAssociation<Company, CompanyUser> (this, MULTIPLEREFERENCE_Users, CompanyUser.SINGLEREFERENCE_Company, CompanyUser.REFERENCE_CompanyUser); _Users = new MultipleAssociation<Company, CompanyUser> (this, MULTIPLEREFERENCE_Users, CompanyUser.SINGLEREFERENCE_Company, CompanyUser.REFERENCE_CompanyUser);
_Clients = new MultipleAssociation<Company, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_Company, Client.REFERENCE_Client); _Clients = new MultipleAssociation<Company, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_Company, Client.REFERENCE_Client);
_HiringTeams = new MultipleAssociation<Company, HiringTeam> (this, MULTIPLEREFERENCE_HiringTeams, HiringTeam.SINGLEREFERENCE_Company, HiringTeam.REFERENCE_HiringTeam);
} }
...@@ -888,10 +989,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -888,10 +989,13 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
super.initialiseReference (); super.initialiseReference ();
_Owner = new SingleAssociation<Company, CompanyUser> (this, SINGLEREFERENCE_Owner, null, CompanyUser.REFERENCE_CompanyUser, "");
_BillingTeam = new SingleAssociation<Company, HiringTeam> (this, SINGLEREFERENCE_BillingTeam, null, HiringTeam.REFERENCE_HiringTeam, "");
_AddedByUser = new SingleAssociation<Company, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_company"); _AddedByUser = new SingleAssociation<Company, CompanyUser> (this, SINGLEREFERENCE_AddedByUser, null, CompanyUser.REFERENCE_CompanyUser, "tl_company");
_PaymentPlan = new SingleAssociation<Company, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_company"); _PaymentPlan = new SingleAssociation<Company, PaymentPlan> (this, SINGLEREFERENCE_PaymentPlan, null, PaymentPlan.REFERENCE_PaymentPlan, "tl_company");
_Users = new MultipleAssociation<Company, CompanyUser> (this, MULTIPLEREFERENCE_Users, CompanyUser.SINGLEREFERENCE_Company, CompanyUser.REFERENCE_CompanyUser); _Users = new MultipleAssociation<Company, CompanyUser> (this, MULTIPLEREFERENCE_Users, CompanyUser.SINGLEREFERENCE_Company, CompanyUser.REFERENCE_CompanyUser);
_Clients = new MultipleAssociation<Company, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_Company, Client.REFERENCE_Client); _Clients = new MultipleAssociation<Company, Client> (this, MULTIPLEREFERENCE_Clients, Client.SINGLEREFERENCE_Company, Client.REFERENCE_Client);
_HiringTeams = new MultipleAssociation<Company, HiringTeam> (this, MULTIPLEREFERENCE_HiringTeams, HiringTeam.SINGLEREFERENCE_Company, HiringTeam.REFERENCE_HiringTeam);
return this; return this;
...@@ -2665,6 +2769,202 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -2665,6 +2769,202 @@ public abstract class BaseCompany extends BaseBusinessClass
} }
/** /**
* Get the attribute HiringTeamName
*/
public String getHiringTeamName ()
{
assertValid();
String valToReturn = _HiringTeamName;
for (CompanyBehaviourDecorator bhd : Company_BehaviourDecorators)
{
valToReturn = bhd.getHiringTeamName ((Company)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 preHiringTeamNameChange (String newHiringTeamName) 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 postHiringTeamNameChange () throws FieldException
{
}
public FieldWriteability getWriteability_HiringTeamName ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute HiringTeamName. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setHiringTeamName (String newHiringTeamName) throws FieldException
{
boolean oldAndNewIdentical = HELPER_HiringTeamName.compare (_HiringTeamName, newHiringTeamName);
try
{
for (CompanyBehaviourDecorator bhd : Company_BehaviourDecorators)
{
newHiringTeamName = bhd.setHiringTeamName ((Company)this, newHiringTeamName);
oldAndNewIdentical = HELPER_HiringTeamName.compare (_HiringTeamName, newHiringTeamName);
}
if (FIELD_HiringTeamName_Validators.length > 0)
{
Object newHiringTeamNameObj = HELPER_HiringTeamName.toObject (newHiringTeamName);
if (newHiringTeamNameObj != null)
{
int loopMax = FIELD_HiringTeamName_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Company.get (FIELD_HiringTeamName);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_HiringTeamName_Validators[v].checkAttribute (this, FIELD_HiringTeamName, metadata, newHiringTeamNameObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_HiringTeamName () != FieldWriteability.FALSE, "Field HiringTeamName is not writeable");
preHiringTeamNameChange (newHiringTeamName);
markFieldChange (FIELD_HiringTeamName);
_HiringTeamName = newHiringTeamName;
postFieldChange (FIELD_HiringTeamName);
postHiringTeamNameChange ();
}
}
/**
* Get the attribute ManageOwnBilling
*/
public Boolean getManageOwnBilling ()
{
assertValid();
Boolean valToReturn = _ManageOwnBilling;
for (CompanyBehaviourDecorator bhd : Company_BehaviourDecorators)
{
valToReturn = bhd.getManageOwnBilling ((Company)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 preManageOwnBillingChange (Boolean newManageOwnBilling) 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 postManageOwnBillingChange () throws FieldException
{
}
public FieldWriteability getWriteability_ManageOwnBilling ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ManageOwnBilling. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setManageOwnBilling (Boolean newManageOwnBilling) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ManageOwnBilling.compare (_ManageOwnBilling, newManageOwnBilling);
try
{
for (CompanyBehaviourDecorator bhd : Company_BehaviourDecorators)
{
newManageOwnBilling = bhd.setManageOwnBilling ((Company)this, newManageOwnBilling);
oldAndNewIdentical = HELPER_ManageOwnBilling.compare (_ManageOwnBilling, newManageOwnBilling);
}
if (FIELD_ManageOwnBilling_Validators.length > 0)
{
Object newManageOwnBillingObj = HELPER_ManageOwnBilling.toObject (newManageOwnBilling);
if (newManageOwnBillingObj != null)
{
int loopMax = FIELD_ManageOwnBilling_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Company.get (FIELD_ManageOwnBilling);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ManageOwnBilling_Validators[v].checkAttribute (this, FIELD_ManageOwnBilling, metadata, newManageOwnBillingObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ManageOwnBilling () != FieldWriteability.FALSE, "Field ManageOwnBilling is not writeable");
preManageOwnBillingChange (newManageOwnBilling);
markFieldChange (FIELD_ManageOwnBilling);
_ManageOwnBilling = newManageOwnBilling;
postFieldChange (FIELD_ManageOwnBilling);
postManageOwnBillingChange ();
}
}
/**
* Get the attribute UserEmail * Get the attribute UserEmail
*/ */
public String getUserEmail () public String getUserEmail ()
...@@ -3556,6 +3856,10 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3556,6 +3856,10 @@ public abstract class BaseCompany extends BaseBusinessClass
List result = super.getSingleAssocs (); List result = super.getSingleAssocs ();
result.add("Owner");
result.add("BillingTeam");
result.add("AddedByUser"); result.add("AddedByUser");
result.add("PaymentPlan"); result.add("PaymentPlan");
...@@ -3571,7 +3875,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3571,7 +3875,13 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_AddedByUser)) else if (assocName.equals (SINGLEREFERENCE_Owner))
{
return _Owner.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_BillingTeam))
{
return _BillingTeam.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{ {
return _AddedByUser.getReferencedType (); return _AddedByUser.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan)) }else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
...@@ -3611,7 +3921,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3611,7 +3921,13 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_AddedByUser)) else if (assocName.equals (SINGLEREFERENCE_Owner))
{
return getOwner ();
}else if (assocName.equals (SINGLEREFERENCE_BillingTeam))
{
return getBillingTeam ();
}else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{ {
return getAddedByUser (); return getAddedByUser ();
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan)) }else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
...@@ -3631,7 +3947,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3631,7 +3947,13 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_AddedByUser)) else if (assocName.equals (SINGLEREFERENCE_Owner))
{
return getOwner (getType);
}else if (assocName.equals (SINGLEREFERENCE_BillingTeam))
{
return getBillingTeam (getType);
}else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{ {
return getAddedByUser (getType); return getAddedByUser (getType);
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan)) }else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
...@@ -3651,7 +3973,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3651,7 +3973,13 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_AddedByUser)) else if (assocName.equals (SINGLEREFERENCE_Owner))
{
return getOwnerID ();
}else if (assocName.equals (SINGLEREFERENCE_BillingTeam))
{
return getBillingTeamID ();
}else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{ {
return getAddedByUserID (); return getAddedByUserID ();
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan)) }else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
...@@ -3671,7 +3999,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3671,7 +3999,13 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
throw new RuntimeException ("Game over == null!"); throw new RuntimeException ("Game over == null!");
} }
else if (assocName.equals (SINGLEREFERENCE_AddedByUser)) else if (assocName.equals (SINGLEREFERENCE_Owner))
{
setOwner ((CompanyUser)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_BillingTeam))
{
setBillingTeam ((HiringTeam)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_AddedByUser))
{ {
setAddedByUser ((CompanyUser)(newValue)); setAddedByUser ((CompanyUser)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_PaymentPlan)) }else if (assocName.equals (SINGLEREFERENCE_PaymentPlan))
...@@ -3687,20 +4021,20 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3687,20 +4021,20 @@ public abstract class BaseCompany extends BaseBusinessClass
/** /**
* Get the reference AddedByUser * Get the reference Owner
*/ */
public CompanyUser getAddedByUser () throws StorageException public CompanyUser getOwner () throws StorageException
{ {
assertValid(); assertValid();
try try
{ {
return (CompanyUser)(_AddedByUser.get ()); return (CompanyUser)(_Owner.get ());
} }
catch (ClassCastException e) catch (ClassCastException e)
{ {
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Company:", this.getObjectID (), ", was trying to get CompanyUser:", getAddedByUserID ()); LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Company:", this.getObjectID (), ", was trying to get CompanyUser:", getOwnerID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _AddedByUser.get ().getClass ()); LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _Owner.get ().getClass ());
throw e; throw e;
} }
} }
...@@ -3709,27 +4043,27 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3709,27 +4043,27 @@ public abstract class BaseCompany extends BaseBusinessClass
/** /**
* Get the object id for the referenced object. Does not force a DB access. * Get the object id for the referenced object. Does not force a DB access.
*/ */
public CompanyUser getAddedByUser (Get getType) throws StorageException public CompanyUser getOwner (Get getType) throws StorageException
{ {
assertValid(); assertValid();
return _AddedByUser.get(getType); return _Owner.get(getType);
} }
/** /**
* Get the object id for the referenced object. Does not force a DB access. * Get the object id for the referenced object. Does not force a DB access.
*/ */
public Long getAddedByUserID () public Long getOwnerID ()
{ {
assertValid(); assertValid();
if (_AddedByUser == null) if (_Owner == null)
{ {
return null; return null;
} }
else else
{ {
return _AddedByUser.getID (); return _Owner.getID ();
} }
} }
...@@ -3737,7 +4071,7 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3737,7 +4071,7 @@ public abstract class BaseCompany extends BaseBusinessClass
* Called prior to the assoc changing. Subclasses need not call super. If a field exception * 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. * is thrown, the attribute change will fail. The new value is different to the old value.
*/ */
protected void preAddedByUserChange (CompanyUser newAddedByUser) throws FieldException protected void preOwnerChange (CompanyUser newOwner) throws FieldException
{ {
} }
...@@ -3747,55 +4081,54 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3747,55 +4081,54 @@ public abstract class BaseCompany extends BaseBusinessClass
* If a field exception is thrown, the value is still changed, however it * If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back * may lead to the TX being rolled back
*/ */
protected void postAddedByUserChange () throws FieldException protected void postOwnerChange () throws FieldException
{ {
} }
public FieldWriteability getWriteability_AddedByUser () public FieldWriteability getWriteability_Owner ()
{ {
return getFieldWritabilityUtil (FieldWriteability.TRUE); return getFieldWritabilityUtil (FieldWriteability.TRUE);
} }
/** /**
* Set the reference AddedByUser. Checks to ensure a new value * Set the reference Owner. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it. * has been supplied. If so, marks the reference as altered and sets it.
*/ */
public void setAddedByUser (CompanyUser newAddedByUser) throws StorageException, FieldException public void setOwner (CompanyUser newOwner) throws StorageException, FieldException
{ {
BusinessObjectParser.assertFieldCondition (newAddedByUser != null, this, SINGLEREFERENCE_AddedByUser, "mandatory");
if (_AddedByUser.wouldReferencedChange (newAddedByUser)) if (_Owner.wouldReferencedChange (newOwner))
{ {
assertValid(); assertValid();
Debug.assertion (getWriteability_AddedByUser () != FieldWriteability.FALSE, "Assoc AddedByUser is not writeable"); Debug.assertion (getWriteability_Owner () != FieldWriteability.FALSE, "Assoc Owner is not writeable");
preAddedByUserChange (newAddedByUser); preOwnerChange (newOwner);
_AddedByUser.set (newAddedByUser); _Owner.set (newOwner);
postAddedByUserChange (); postOwnerChange ();
} }
} }
/** /**
* Get the reference PaymentPlan * Get the reference BillingTeam
*/ */
public PaymentPlan getPaymentPlan () throws StorageException public HiringTeam getBillingTeam () throws StorageException
{ {
assertValid(); assertValid();
try try
{ {
return (PaymentPlan)(_PaymentPlan.get ()); return (HiringTeam)(_BillingTeam.get ());
} }
catch (ClassCastException e) catch (ClassCastException e)
{ {
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Company:", this.getObjectID (), ", was trying to get PaymentPlan:", getPaymentPlanID ()); LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Company:", this.getObjectID (), ", was trying to get HiringTeam:", getBillingTeamID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _PaymentPlan.get ().getClass ()); LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _BillingTeam.get ().getClass ());
throw e; throw e;
} }
} }
...@@ -3804,27 +4137,27 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3804,27 +4137,27 @@ public abstract class BaseCompany extends BaseBusinessClass
/** /**
* Get the object id for the referenced object. Does not force a DB access. * Get the object id for the referenced object. Does not force a DB access.
*/ */
public PaymentPlan getPaymentPlan (Get getType) throws StorageException public HiringTeam getBillingTeam (Get getType) throws StorageException
{ {
assertValid(); assertValid();
return _PaymentPlan.get(getType); return _BillingTeam.get(getType);
} }
/** /**
* Get the object id for the referenced object. Does not force a DB access. * Get the object id for the referenced object. Does not force a DB access.
*/ */
public Long getPaymentPlanID () public Long getBillingTeamID ()
{ {
assertValid(); assertValid();
if (_PaymentPlan == null) if (_BillingTeam == null)
{ {
return null; return null;
} }
else else
{ {
return _PaymentPlan.getID (); return _BillingTeam.getID ();
} }
} }
...@@ -3832,7 +4165,7 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3832,7 +4165,7 @@ public abstract class BaseCompany extends BaseBusinessClass
* Called prior to the assoc changing. Subclasses need not call super. If a field exception * 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. * is thrown, the attribute change will fail. The new value is different to the old value.
*/ */
protected void prePaymentPlanChange (PaymentPlan newPaymentPlan) throws FieldException protected void preBillingTeamChange (HiringTeam newBillingTeam) throws FieldException
{ {
} }
...@@ -3842,41 +4175,230 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3842,41 +4175,230 @@ public abstract class BaseCompany extends BaseBusinessClass
* If a field exception is thrown, the value is still changed, however it * If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back * may lead to the TX being rolled back
*/ */
protected void postPaymentPlanChange () throws FieldException protected void postBillingTeamChange () throws FieldException
{ {
} }
public FieldWriteability getWriteability_PaymentPlan () public FieldWriteability getWriteability_BillingTeam ()
{ {
return getFieldWritabilityUtil (FieldWriteability.TRUE); return getFieldWritabilityUtil (FieldWriteability.TRUE);
} }
/** /**
* Set the reference PaymentPlan. Checks to ensure a new value * Set the reference BillingTeam. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it. * has been supplied. If so, marks the reference as altered and sets it.
*/ */
public void setPaymentPlan (PaymentPlan newPaymentPlan) throws StorageException, FieldException public void setBillingTeam (HiringTeam newBillingTeam) throws StorageException, FieldException
{ {
if (_PaymentPlan.wouldReferencedChange (newPaymentPlan)) if (_BillingTeam.wouldReferencedChange (newBillingTeam))
{ {
assertValid(); assertValid();
Debug.assertion (getWriteability_PaymentPlan () != FieldWriteability.FALSE, "Assoc PaymentPlan is not writeable"); Debug.assertion (getWriteability_BillingTeam () != FieldWriteability.FALSE, "Assoc BillingTeam is not writeable");
prePaymentPlanChange (newPaymentPlan); preBillingTeamChange (newBillingTeam);
_PaymentPlan.set (newPaymentPlan); _BillingTeam.set (newBillingTeam);
postPaymentPlanChange (); postBillingTeamChange ();
} }
} }
/** /**
* A list of multi assoc names e.g. list of strings. * Get the reference AddedByUser
*/
public CompanyUser getAddedByUser () throws StorageException
{
assertValid();
try
{
return (CompanyUser)(_AddedByUser.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Company:", this.getObjectID (), ", was trying to get CompanyUser:", getAddedByUserID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _AddedByUser.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public CompanyUser getAddedByUser (Get getType) throws StorageException
{
assertValid();
return _AddedByUser.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getAddedByUserID ()
{
assertValid();
if (_AddedByUser == null)
{
return null;
}
else
{
return _AddedByUser.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 preAddedByUserChange (CompanyUser newAddedByUser) 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 postAddedByUserChange () throws FieldException
{
}
public FieldWriteability getWriteability_AddedByUser ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference AddedByUser. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setAddedByUser (CompanyUser newAddedByUser) throws StorageException, FieldException
{
BusinessObjectParser.assertFieldCondition (newAddedByUser != null, this, SINGLEREFERENCE_AddedByUser, "mandatory");
if (_AddedByUser.wouldReferencedChange (newAddedByUser))
{
assertValid();
Debug.assertion (getWriteability_AddedByUser () != FieldWriteability.FALSE, "Assoc AddedByUser is not writeable");
preAddedByUserChange (newAddedByUser);
_AddedByUser.set (newAddedByUser);
postAddedByUserChange ();
}
}
/**
* Get the reference PaymentPlan
*/
public PaymentPlan getPaymentPlan () throws StorageException
{
assertValid();
try
{
return (PaymentPlan)(_PaymentPlan.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in Company:", this.getObjectID (), ", was trying to get PaymentPlan:", getPaymentPlanID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _PaymentPlan.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public PaymentPlan getPaymentPlan (Get getType) throws StorageException
{
assertValid();
return _PaymentPlan.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getPaymentPlanID ()
{
assertValid();
if (_PaymentPlan == null)
{
return null;
}
else
{
return _PaymentPlan.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 prePaymentPlanChange (PaymentPlan newPaymentPlan) 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 postPaymentPlanChange () throws FieldException
{
}
public FieldWriteability getWriteability_PaymentPlan ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference PaymentPlan. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setPaymentPlan (PaymentPlan newPaymentPlan) throws StorageException, FieldException
{
if (_PaymentPlan.wouldReferencedChange (newPaymentPlan))
{
assertValid();
Debug.assertion (getWriteability_PaymentPlan () != FieldWriteability.FALSE, "Assoc PaymentPlan is not writeable");
prePaymentPlanChange (newPaymentPlan);
_PaymentPlan.set (newPaymentPlan);
postPaymentPlanChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/ */
public List<String> getMultiAssocs() public List<String> getMultiAssocs()
{ {
...@@ -3887,6 +4409,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3887,6 +4409,8 @@ public abstract class BaseCompany extends BaseBusinessClass
result.add("Clients"); result.add("Clients");
result.add("HiringTeams");
return result; return result;
} }
...@@ -3908,6 +4432,11 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3908,6 +4432,11 @@ public abstract class BaseCompany extends BaseBusinessClass
return Client.REFERENCE_Client ; return Client.REFERENCE_Client ;
} }
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
return HiringTeam.REFERENCE_HiringTeam ;
}
return super.getMultiAssocReferenceInstance(attribName); return super.getMultiAssocReferenceInstance(attribName);
} }
...@@ -3926,6 +4455,11 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3926,6 +4455,11 @@ public abstract class BaseCompany extends BaseBusinessClass
return Client.SINGLEREFERENCE_Company ; return Client.SINGLEREFERENCE_Company ;
} }
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
return HiringTeam.SINGLEREFERENCE_Company ;
}
return super.getMultiAssocBackReference(attribName); return super.getMultiAssocBackReference(attribName);
} }
...@@ -3947,6 +4481,11 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3947,6 +4481,11 @@ public abstract class BaseCompany extends BaseBusinessClass
return this.getClientsCount(); return this.getClientsCount();
} }
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
return this.getHiringTeamsCount();
}
return super.getMultiAssocCount(attribName); return super.getMultiAssocCount(attribName);
} }
...@@ -3968,6 +4507,11 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3968,6 +4507,11 @@ public abstract class BaseCompany extends BaseBusinessClass
return this.getClientsAt(index); return this.getClientsAt(index);
} }
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
return this.getHiringTeamsAt(index);
}
return super.getMultiAssocAt(attribName, index); return super.getMultiAssocAt(attribName, index);
} }
...@@ -3993,6 +4537,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -3993,6 +4537,13 @@ public abstract class BaseCompany extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
addToHiringTeams((HiringTeam)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement); super.addToMultiAssoc(attribName, newElement);
} }
...@@ -4017,6 +4568,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4017,6 +4568,13 @@ public abstract class BaseCompany extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
removeFromHiringTeams((HiringTeam)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement); super.removeFromMultiAssoc(attribName, oldElement);
} }
...@@ -4037,6 +4595,12 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4037,6 +4595,12 @@ public abstract class BaseCompany extends BaseBusinessClass
return; return;
} }
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
_HiringTeams.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements); super.__loadMultiAssoc(attribName, elements);
} }
...@@ -4055,6 +4619,11 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4055,6 +4619,11 @@ public abstract class BaseCompany extends BaseBusinessClass
return _Clients.isLoaded (); return _Clients.isLoaded ();
} }
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
return _HiringTeams.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName); return super.__isMultiAssocLoaded(attribName);
} }
...@@ -4199,6 +4768,75 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4199,6 +4768,75 @@ public abstract class BaseCompany extends BaseBusinessClass
return _Clients.getSet (); return _Clients.getSet ();
} }
public FieldWriteability getWriteability_HiringTeams ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getHiringTeamsCount () throws StorageException
{
assertValid();
return _HiringTeams.getReferencedObjectsCount ();
}
public void addToHiringTeams (HiringTeam newElement) throws StorageException
{
if (_HiringTeams.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_HiringTeams () != FieldWriteability.FALSE, "MultiAssoc HiringTeams is not writeable (add)");
_HiringTeams.appendElement (newElement);
try
{
if (newElement.getCompany () != this)
{
newElement.setCompany ((Company)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromHiringTeams (HiringTeam elementToRemove) throws StorageException
{
if (_HiringTeams.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_HiringTeams () != FieldWriteability.FALSE, "MultiAssoc HiringTeams is not writeable (remove)");
_HiringTeams.removeElement (elementToRemove);
try
{
if (elementToRemove.getCompany () != null)
{
elementToRemove.setCompany (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public HiringTeam getHiringTeamsAt (int index) throws StorageException
{
return (HiringTeam)(_HiringTeams.getElementAt (index));
}
public SortedSet<HiringTeam> getHiringTeamsSet () throws StorageException
{
return _HiringTeams.getSet ();
}
public void onDelete () public void onDelete ()
...@@ -4217,6 +4855,12 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4217,6 +4855,12 @@ public abstract class BaseCompany extends BaseBusinessClass
referenced.setCompany(null); referenced.setCompany(null);
} }
for(HiringTeam referenced : CollectionUtils.reverse(getHiringTeamsSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Company from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setCompany(null);
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -4541,6 +5185,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4541,6 +5185,8 @@ public abstract class BaseCompany extends BaseBusinessClass
_CardID = sourceCompany._CardID; _CardID = sourceCompany._CardID;
_PlanRenewedOn = sourceCompany._PlanRenewedOn; _PlanRenewedOn = sourceCompany._PlanRenewedOn;
_UsedCredits = sourceCompany._UsedCredits; _UsedCredits = sourceCompany._UsedCredits;
_HiringTeamName = sourceCompany._HiringTeamName;
_ManageOwnBilling = sourceCompany._ManageOwnBilling;
_UserEmail = sourceCompany._UserEmail; _UserEmail = sourceCompany._UserEmail;
_FirstName = sourceCompany._FirstName; _FirstName = sourceCompany._FirstName;
_LastName = sourceCompany._LastName; _LastName = sourceCompany._LastName;
...@@ -4566,6 +5212,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4566,6 +5212,8 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
BaseCompany sourceCompany = (BaseCompany)(source); BaseCompany sourceCompany = (BaseCompany)(source);
_Owner.copyFrom (sourceCompany._Owner, linkToGhosts);
_BillingTeam.copyFrom (sourceCompany._BillingTeam, linkToGhosts);
_AddedByUser.copyFrom (sourceCompany._AddedByUser, linkToGhosts); _AddedByUser.copyFrom (sourceCompany._AddedByUser, linkToGhosts);
_PaymentPlan.copyFrom (sourceCompany._PaymentPlan, linkToGhosts); _PaymentPlan.copyFrom (sourceCompany._PaymentPlan, linkToGhosts);
...@@ -4586,6 +5234,7 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4586,6 +5234,7 @@ public abstract class BaseCompany extends BaseBusinessClass
_Users.copyFrom (sourceCompany._Users, linkToGhosts); _Users.copyFrom (sourceCompany._Users, linkToGhosts);
_Clients.copyFrom (sourceCompany._Clients, linkToGhosts); _Clients.copyFrom (sourceCompany._Clients, linkToGhosts);
_HiringTeams.copyFrom (sourceCompany._HiringTeams, linkToGhosts);
} }
} }
...@@ -4626,6 +5275,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4626,6 +5275,8 @@ public abstract class BaseCompany extends BaseBusinessClass
_CardID = (String)(HELPER_CardID.readExternal (_CardID, vals.get(FIELD_CardID))); // _CardID = (String)(HELPER_CardID.readExternal (_CardID, vals.get(FIELD_CardID))); //
_PlanRenewedOn = (Date)(HELPER_PlanRenewedOn.readExternal (_PlanRenewedOn, vals.get(FIELD_PlanRenewedOn))); // _PlanRenewedOn = (Date)(HELPER_PlanRenewedOn.readExternal (_PlanRenewedOn, vals.get(FIELD_PlanRenewedOn))); //
_UsedCredits = (Integer)(HELPER_UsedCredits.readExternal (_UsedCredits, vals.get(FIELD_UsedCredits))); // _UsedCredits = (Integer)(HELPER_UsedCredits.readExternal (_UsedCredits, vals.get(FIELD_UsedCredits))); //
_HiringTeamName = (String)(HELPER_HiringTeamName.readExternal (_HiringTeamName, vals.get(FIELD_HiringTeamName))); //
_ManageOwnBilling = (Boolean)(HELPER_ManageOwnBilling.readExternal (_ManageOwnBilling, vals.get(FIELD_ManageOwnBilling))); //
_UserEmail = (String)(HELPER_UserEmail.readExternal (_UserEmail, vals.get(FIELD_UserEmail))); // _UserEmail = (String)(HELPER_UserEmail.readExternal (_UserEmail, vals.get(FIELD_UserEmail))); //
_FirstName = (String)(HELPER_FirstName.readExternal (_FirstName, vals.get(FIELD_FirstName))); // _FirstName = (String)(HELPER_FirstName.readExternal (_FirstName, vals.get(FIELD_FirstName))); //
_LastName = (String)(HELPER_LastName.readExternal (_LastName, vals.get(FIELD_LastName))); // _LastName = (String)(HELPER_LastName.readExternal (_LastName, vals.get(FIELD_LastName))); //
...@@ -4635,10 +5286,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4635,10 +5286,13 @@ public abstract class BaseCompany extends BaseBusinessClass
_PaymentJobCount = (Integer)(HELPER_PaymentJobCount.readExternal (_PaymentJobCount, vals.get(FIELD_PaymentJobCount))); // _PaymentJobCount = (Integer)(HELPER_PaymentJobCount.readExternal (_PaymentJobCount, vals.get(FIELD_PaymentJobCount))); //
_StripeLast4 = (String)(HELPER_StripeLast4.readExternal (_StripeLast4, vals.get(FIELD_StripeLast4))); // _StripeLast4 = (String)(HELPER_StripeLast4.readExternal (_StripeLast4, vals.get(FIELD_StripeLast4))); //
_StripeBrand = (String)(HELPER_StripeBrand.readExternal (_StripeBrand, vals.get(FIELD_StripeBrand))); // _StripeBrand = (String)(HELPER_StripeBrand.readExternal (_StripeBrand, vals.get(FIELD_StripeBrand))); //
_Owner.readExternalData(vals.get(SINGLEREFERENCE_Owner));
_BillingTeam.readExternalData(vals.get(SINGLEREFERENCE_BillingTeam));
_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)); _Clients.readExternalData(vals.get(MULTIPLEREFERENCE_Clients));
_HiringTeams.readExternalData(vals.get(MULTIPLEREFERENCE_HiringTeams));
} }
...@@ -4668,6 +5322,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4668,6 +5322,8 @@ public abstract class BaseCompany extends BaseBusinessClass
vals.put (FIELD_CardID, HELPER_CardID.writeExternal (_CardID)); vals.put (FIELD_CardID, HELPER_CardID.writeExternal (_CardID));
vals.put (FIELD_PlanRenewedOn, HELPER_PlanRenewedOn.writeExternal (_PlanRenewedOn)); vals.put (FIELD_PlanRenewedOn, HELPER_PlanRenewedOn.writeExternal (_PlanRenewedOn));
vals.put (FIELD_UsedCredits, HELPER_UsedCredits.writeExternal (_UsedCredits)); vals.put (FIELD_UsedCredits, HELPER_UsedCredits.writeExternal (_UsedCredits));
vals.put (FIELD_HiringTeamName, HELPER_HiringTeamName.writeExternal (_HiringTeamName));
vals.put (FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.writeExternal (_ManageOwnBilling));
vals.put (FIELD_UserEmail, HELPER_UserEmail.writeExternal (_UserEmail)); vals.put (FIELD_UserEmail, HELPER_UserEmail.writeExternal (_UserEmail));
vals.put (FIELD_FirstName, HELPER_FirstName.writeExternal (_FirstName)); vals.put (FIELD_FirstName, HELPER_FirstName.writeExternal (_FirstName));
vals.put (FIELD_LastName, HELPER_LastName.writeExternal (_LastName)); vals.put (FIELD_LastName, HELPER_LastName.writeExternal (_LastName));
...@@ -4677,10 +5333,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4677,10 +5333,13 @@ public abstract class BaseCompany extends BaseBusinessClass
vals.put (FIELD_PaymentJobCount, HELPER_PaymentJobCount.writeExternal (_PaymentJobCount)); vals.put (FIELD_PaymentJobCount, HELPER_PaymentJobCount.writeExternal (_PaymentJobCount));
vals.put (FIELD_StripeLast4, HELPER_StripeLast4.writeExternal (_StripeLast4)); vals.put (FIELD_StripeLast4, HELPER_StripeLast4.writeExternal (_StripeLast4));
vals.put (FIELD_StripeBrand, HELPER_StripeBrand.writeExternal (_StripeBrand)); vals.put (FIELD_StripeBrand, HELPER_StripeBrand.writeExternal (_StripeBrand));
vals.put (SINGLEREFERENCE_Owner, _Owner.writeExternalData());
vals.put (SINGLEREFERENCE_BillingTeam, _BillingTeam.writeExternalData());
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()); vals.put (MULTIPLEREFERENCE_Clients, _Clients.writeExternalData());
vals.put (MULTIPLEREFERENCE_HiringTeams, _HiringTeams.writeExternalData());
} }
...@@ -4768,6 +5427,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4768,6 +5427,8 @@ public abstract class BaseCompany extends BaseBusinessClass
} }
// Compare single assocs // Compare single assocs
_Owner.compare (otherCompany._Owner, listener);
_BillingTeam.compare (otherCompany._BillingTeam, listener);
_AddedByUser.compare (otherCompany._AddedByUser, listener); _AddedByUser.compare (otherCompany._AddedByUser, listener);
_PaymentPlan.compare (otherCompany._PaymentPlan, listener); _PaymentPlan.compare (otherCompany._PaymentPlan, listener);
...@@ -4775,6 +5436,7 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4775,6 +5436,7 @@ public abstract class BaseCompany extends BaseBusinessClass
// Compare multiple assocs // Compare multiple assocs
_Users.compare (otherCompany._Users, listener); _Users.compare (otherCompany._Users, listener);
_Clients.compare (otherCompany._Clients, listener); _Clients.compare (otherCompany._Clients, listener);
_HiringTeams.compare (otherCompany._HiringTeams, listener);
} }
} }
...@@ -4784,6 +5446,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4784,6 +5446,8 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
super.visitAttributes (visitor); super.visitAttributes (visitor);
visitor.visitField(this, FIELD_HiringTeamName, HELPER_HiringTeamName.toObject(getHiringTeamName()));
visitor.visitField(this, FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.toObject(getManageOwnBilling()));
visitor.visitField(this, FIELD_UserEmail, HELPER_UserEmail.toObject(getUserEmail())); visitor.visitField(this, FIELD_UserEmail, HELPER_UserEmail.toObject(getUserEmail()));
visitor.visitField(this, FIELD_FirstName, HELPER_FirstName.toObject(getFirstName())); visitor.visitField(this, FIELD_FirstName, HELPER_FirstName.toObject(getFirstName()));
visitor.visitField(this, FIELD_LastName, HELPER_LastName.toObject(getLastName())); visitor.visitField(this, FIELD_LastName, HELPER_LastName.toObject(getLastName()));
...@@ -4819,10 +5483,13 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4819,10 +5483,13 @@ public abstract class BaseCompany extends BaseBusinessClass
visitor.visitField(this, FIELD_CardID, HELPER_CardID.toObject(getCardID())); visitor.visitField(this, FIELD_CardID, HELPER_CardID.toObject(getCardID()));
visitor.visitField(this, FIELD_PlanRenewedOn, HELPER_PlanRenewedOn.toObject(getPlanRenewedOn())); visitor.visitField(this, FIELD_PlanRenewedOn, HELPER_PlanRenewedOn.toObject(getPlanRenewedOn()));
visitor.visitField(this, FIELD_UsedCredits, HELPER_UsedCredits.toObject(getUsedCredits())); visitor.visitField(this, FIELD_UsedCredits, HELPER_UsedCredits.toObject(getUsedCredits()));
visitor.visitAssociation (_Owner);
visitor.visitAssociation (_BillingTeam);
visitor.visitAssociation (_AddedByUser); visitor.visitAssociation (_AddedByUser);
visitor.visitAssociation (_PaymentPlan); visitor.visitAssociation (_PaymentPlan);
visitor.visitAssociation (_Users); visitor.visitAssociation (_Users);
visitor.visitAssociation (_Clients); visitor.visitAssociation (_Clients);
visitor.visitAssociation (_HiringTeams);
} }
...@@ -4831,6 +5498,14 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4831,6 +5498,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
super.visitAssociations (visitor, scope); super.visitAssociations (visitor, scope);
if (scope.includes (_Owner))
{
visitor.visit (_Owner);
}
if (scope.includes (_BillingTeam))
{
visitor.visit (_BillingTeam);
}
if (scope.includes (_AddedByUser)) if (scope.includes (_AddedByUser))
{ {
visitor.visit (_AddedByUser); visitor.visit (_AddedByUser);
...@@ -4847,6 +5522,10 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -4847,6 +5522,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
visitor.visit (_Clients); visitor.visit (_Clients);
} }
if (scope.includes (_HiringTeams))
{
visitor.visit (_HiringTeams);
}
} }
...@@ -5210,6 +5889,14 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -5210,6 +5889,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
return HELPER_UsedCredits.toObject (getUsedCredits ()); return HELPER_UsedCredits.toObject (getUsedCredits ());
} }
else if (attribName.equals (FIELD_HiringTeamName))
{
return HELPER_HiringTeamName.toObject (getHiringTeamName ());
}
else if (attribName.equals (FIELD_ManageOwnBilling))
{
return HELPER_ManageOwnBilling.toObject (getManageOwnBilling ());
}
else if (attribName.equals (FIELD_UserEmail)) else if (attribName.equals (FIELD_UserEmail))
{ {
return HELPER_UserEmail.toObject (getUserEmail ()); return HELPER_UserEmail.toObject (getUserEmail ());
...@@ -5331,6 +6018,14 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -5331,6 +6018,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
return HELPER_UsedCredits; return HELPER_UsedCredits;
} }
else if (attribName.equals (FIELD_HiringTeamName))
{
return HELPER_HiringTeamName;
}
else if (attribName.equals (FIELD_ManageOwnBilling))
{
return HELPER_ManageOwnBilling;
}
else if (attribName.equals (FIELD_UserEmail)) else if (attribName.equals (FIELD_UserEmail))
{ {
return HELPER_UserEmail; return HELPER_UserEmail;
...@@ -5452,6 +6147,14 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -5452,6 +6147,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
setUsedCredits ((Integer)(HELPER_UsedCredits.fromObject (_UsedCredits, attribValue))); setUsedCredits ((Integer)(HELPER_UsedCredits.fromObject (_UsedCredits, attribValue)));
} }
else if (attribName.equals (FIELD_HiringTeamName))
{
setHiringTeamName ((String)(HELPER_HiringTeamName.fromObject (_HiringTeamName, attribValue)));
}
else if (attribName.equals (FIELD_ManageOwnBilling))
{
setManageOwnBilling ((Boolean)(HELPER_ManageOwnBilling.fromObject (_ManageOwnBilling, attribValue)));
}
else if (attribName.equals (FIELD_UserEmail)) else if (attribName.equals (FIELD_UserEmail))
{ {
setUserEmail ((String)(HELPER_UserEmail.fromObject (_UserEmail, attribValue))); setUserEmail ((String)(HELPER_UserEmail.fromObject (_UserEmail, attribValue)));
...@@ -5588,6 +6291,10 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -5588,6 +6291,10 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
return getWriteability_Clients (); return getWriteability_Clients ();
} }
else if (fieldName.equals (MULTIPLEREFERENCE_HiringTeams))
{
return getWriteability_HiringTeams ();
}
else if (fieldName.equals (SINGLEREFERENCE_AddedByUser)) else if (fieldName.equals (SINGLEREFERENCE_AddedByUser))
{ {
return getWriteability_AddedByUser (); return getWriteability_AddedByUser ();
...@@ -5596,6 +6303,14 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -5596,6 +6303,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
return getWriteability_PaymentPlan (); return getWriteability_PaymentPlan ();
} }
else if (fieldName.equals (FIELD_HiringTeamName))
{
return getWriteability_HiringTeamName ();
}
else if (fieldName.equals (FIELD_ManageOwnBilling))
{
return getWriteability_ManageOwnBilling ();
}
else if (fieldName.equals (FIELD_UserEmail)) else if (fieldName.equals (FIELD_UserEmail))
{ {
return getWriteability_UserEmail (); return getWriteability_UserEmail ();
...@@ -5632,6 +6347,14 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -5632,6 +6347,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
return getWriteability_StripeBrand (); return getWriteability_StripeBrand ();
} }
else if (fieldName.equals (SINGLEREFERENCE_Owner))
{
return getWriteability_Owner ();
}
else if (fieldName.equals (SINGLEREFERENCE_BillingTeam))
{
return getWriteability_BillingTeam ();
}
else else
{ {
return super.getWriteable (fieldName); return super.getWriteable (fieldName);
...@@ -5732,6 +6455,16 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -5732,6 +6455,16 @@ public abstract class BaseCompany extends BaseBusinessClass
fields.add (FIELD_UsedCredits); fields.add (FIELD_UsedCredits);
} }
if (getWriteability_HiringTeamName () != FieldWriteability.TRUE)
{
fields.add (FIELD_HiringTeamName);
}
if (getWriteability_ManageOwnBilling () != FieldWriteability.TRUE)
{
fields.add (FIELD_ManageOwnBilling);
}
if (getWriteability_UserEmail () != FieldWriteability.TRUE) if (getWriteability_UserEmail () != FieldWriteability.TRUE)
{ {
fields.add (FIELD_UserEmail); fields.add (FIELD_UserEmail);
...@@ -5804,6 +6537,8 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -5804,6 +6537,8 @@ public abstract class BaseCompany extends BaseBusinessClass
result.add(HELPER_CardID.getAttribObject (getClass (), _CardID, false, FIELD_CardID)); result.add(HELPER_CardID.getAttribObject (getClass (), _CardID, false, FIELD_CardID));
result.add(HELPER_PlanRenewedOn.getAttribObject (getClass (), _PlanRenewedOn, false, FIELD_PlanRenewedOn)); result.add(HELPER_PlanRenewedOn.getAttribObject (getClass (), _PlanRenewedOn, false, FIELD_PlanRenewedOn));
result.add(HELPER_UsedCredits.getAttribObject (getClass (), _UsedCredits, false, FIELD_UsedCredits)); result.add(HELPER_UsedCredits.getAttribObject (getClass (), _UsedCredits, false, FIELD_UsedCredits));
result.add(HELPER_HiringTeamName.getAttribObject (getClass (), _HiringTeamName, false, FIELD_HiringTeamName));
result.add(HELPER_ManageOwnBilling.getAttribObject (getClass (), _ManageOwnBilling, false, FIELD_ManageOwnBilling));
result.add(HELPER_UserEmail.getAttribObject (getClass (), _UserEmail, false, FIELD_UserEmail)); result.add(HELPER_UserEmail.getAttribObject (getClass (), _UserEmail, false, FIELD_UserEmail));
result.add(HELPER_FirstName.getAttribObject (getClass (), _FirstName, false, FIELD_FirstName)); result.add(HELPER_FirstName.getAttribObject (getClass (), _FirstName, false, FIELD_FirstName));
result.add(HELPER_LastName.getAttribObject (getClass (), _LastName, false, FIELD_LastName)); result.add(HELPER_LastName.getAttribObject (getClass (), _LastName, false, FIELD_LastName));
...@@ -6206,6 +6941,42 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -6206,6 +6941,42 @@ public abstract class BaseCompany extends BaseBusinessClass
} }
/** /**
* Get the attribute HiringTeamName
*/
public String getHiringTeamName (Company obj, String original)
{
return original;
}
/**
* Change the value set for attribute HiringTeamName.
* May modify the field beforehand
* Occurs before validation.
*/
public String setHiringTeamName (Company obj, String newHiringTeamName) throws FieldException
{
return newHiringTeamName;
}
/**
* Get the attribute ManageOwnBilling
*/
public Boolean getManageOwnBilling (Company obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute ManageOwnBilling.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setManageOwnBilling (Company obj, Boolean newManageOwnBilling) throws FieldException
{
return newManageOwnBilling;
}
/**
* Get the attribute UserEmail * Get the attribute UserEmail
*/ */
public String getUserEmail (Company obj, String original) public String getUserEmail (Company obj, String original)
...@@ -6427,6 +7198,18 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -6427,6 +7198,18 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
return toClients (); return toClients ();
} }
if (name.equals ("HiringTeams"))
{
return toHiringTeams ();
}
if (name.equals ("HiringTeamName"))
{
return toHiringTeamName ();
}
if (name.equals ("ManageOwnBilling"))
{
return toManageOwnBilling ();
}
if (name.equals ("UserEmail")) if (name.equals ("UserEmail"))
{ {
return toUserEmail (); return toUserEmail ();
...@@ -6463,6 +7246,14 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -6463,6 +7246,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
return toStripeBrand (); return toStripeBrand ();
} }
if (name.equals ("Owner"))
{
return toOwner ();
}
if (name.equals ("BillingTeam"))
{
return toBillingTeam ();
}
if (name.equals ("CompanyName")) if (name.equals ("CompanyName"))
{ {
return toCompanyName (); return toCompanyName ();
...@@ -6549,6 +7340,10 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -6549,6 +7340,10 @@ public abstract class BaseCompany extends BaseBusinessClass
} }
public PipeLine<From, String> toHiringTeamName () { return pipe(new ORMAttributePipe<Me, String>(FIELD_HiringTeamName)); }
public PipeLine<From, Boolean> toManageOwnBilling () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_ManageOwnBilling)); }
public PipeLine<From, String> toUserEmail () { return pipe(new ORMAttributePipe<Me, String>(FIELD_UserEmail)); } public PipeLine<From, String> toUserEmail () { return pipe(new ORMAttributePipe<Me, String>(FIELD_UserEmail)); }
public PipeLine<From, String> toFirstName () { return pipe(new ORMAttributePipe<Me, String>(FIELD_FirstName)); } public PipeLine<From, String> toFirstName () { return pipe(new ORMAttributePipe<Me, String>(FIELD_FirstName)); }
...@@ -6602,6 +7397,18 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -6602,6 +7397,18 @@ public abstract class BaseCompany extends BaseBusinessClass
public PipeLine<From, Date> toPlanRenewedOn () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_PlanRenewedOn)); } public PipeLine<From, Date> toPlanRenewedOn () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_PlanRenewedOn)); }
public PipeLine<From, Integer> toUsedCredits () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_UsedCredits)); } public PipeLine<From, Integer> toUsedCredits () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_UsedCredits)); }
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toOwner () { return toOwner (Filter.ALL); }
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toOwner (Filter<CompanyUser> filter)
{
return CompanyUser.REFERENCE_CompanyUser.new CompanyUserPipeLineFactory<From, CompanyUser> (this, new ORMSingleAssocPipe<Me, CompanyUser>(SINGLEREFERENCE_Owner, filter));
}
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toBillingTeam () { return toBillingTeam (Filter.ALL); }
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toBillingTeam (Filter<HiringTeam> filter)
{
return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMSingleAssocPipe<Me, HiringTeam>(SINGLEREFERENCE_BillingTeam, filter));
}
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toAddedByUser () { return toAddedByUser (Filter.ALL); } public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toAddedByUser () { return toAddedByUser (Filter.ALL); }
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toAddedByUser (Filter<CompanyUser> filter) public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toAddedByUser (Filter<CompanyUser> filter)
...@@ -6626,12 +7433,28 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -6626,12 +7433,28 @@ public abstract class BaseCompany extends BaseBusinessClass
{ {
return Client.REFERENCE_Client.new ClientPipeLineFactory<From, Client> (this, new ORMMultiAssocPipe<Me, Client>(MULTIPLEREFERENCE_Clients, filter)); return Client.REFERENCE_Client.new ClientPipeLineFactory<From, Client> (this, new ORMMultiAssocPipe<Me, Client>(MULTIPLEREFERENCE_Clients, filter));
} }
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toHiringTeams () { return toHiringTeams(Filter.ALL); }
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toHiringTeams (Filter<HiringTeam> filter)
{
return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMMultiAssocPipe<Me, HiringTeam>(MULTIPLEREFERENCE_HiringTeams, filter));
}
} }
public boolean isTransientAttrib(String attribName) public boolean isTransientAttrib(String attribName)
{ {
if(CollectionUtils.equals(attribName, "HiringTeamName"))
{
return true;
}
if(CollectionUtils.equals(attribName, "ManageOwnBilling"))
{
return true;
}
if(CollectionUtils.equals(attribName, "UserEmail")) if(CollectionUtils.equals(attribName, "UserEmail"))
{ {
return true; return true;
...@@ -6684,6 +7507,16 @@ public abstract class BaseCompany extends BaseBusinessClass ...@@ -6684,6 +7507,16 @@ public abstract class BaseCompany extends BaseBusinessClass
public boolean isTransientSingleReference(String assocName) public boolean isTransientSingleReference(String assocName)
{ {
if(CollectionUtils.equals(assocName, "Owner"))
{
return true;
}
if(CollectionUtils.equals(assocName, "BillingTeam"))
{
return true;
}
return super.isTransientSingleReference(assocName); return super.isTransientSingleReference(assocName);
} }
...@@ -6702,6 +7535,34 @@ class DummyCompany extends Company ...@@ -6702,6 +7535,34 @@ class DummyCompany extends Company
} }
public CompanyUser getOwner () throws StorageException
{
return (CompanyUser)(CompanyUser.DUMMY_CompanyUser);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getOwnerID ()
{
return CompanyUser.DUMMY_CompanyUser.getObjectID();
}
public HiringTeam getBillingTeam () throws StorageException
{
return (HiringTeam)(HiringTeam.DUMMY_HiringTeam);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getBillingTeamID ()
{
return HiringTeam.DUMMY_HiringTeam.getObjectID();
}
public CompanyUser getAddedByUser () throws StorageException public CompanyUser getAddedByUser () throws StorageException
{ {
return (CompanyUser)(CompanyUser.DUMMY_CompanyUser); return (CompanyUser)(CompanyUser.DUMMY_CompanyUser);
...@@ -6764,6 +7625,23 @@ class DummyCompany extends Company ...@@ -6764,6 +7625,23 @@ class DummyCompany extends Company
return new TreeSet(); return new TreeSet();
} }
public int getHiringTeamsCount () throws StorageException
{
return 0;
}
public HiringTeam getHiringTeamsAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association HiringTeams");
}
public SortedSet getHiringTeamsSet () throws StorageException
{
return new TreeSet();
}
} }
...@@ -56,6 +56,9 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -56,6 +56,9 @@ public abstract class BaseCompanyUser extends SecUserExtension
public static final String FIELD_ConfirmPassword = "ConfirmPassword"; public static final String FIELD_ConfirmPassword = "ConfirmPassword";
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 SINGLEREFERENCE_DefaultHiringTeam = "DefaultHiringTeam";
public static final String MULTIPLEREFERENCE_HiringTeams = "HiringTeams";
public static final String BACKREF_HiringTeams = "";
// Static constants corresponding to searches // Static constants corresponding to searches
public static final String SEARCH_All = "All"; public static final String SEARCH_All = "All";
...@@ -95,9 +98,11 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -95,9 +98,11 @@ public abstract class BaseCompanyUser extends SecUserExtension
// Private attributes corresponding to single references // Private attributes corresponding to single references
private SingleAssociation<CompanyUser, Company> _Company; private SingleAssociation<CompanyUser, Company> _Company;
private SingleAssociation<CompanyUser, HiringTeam> _DefaultHiringTeam;
// Private attributes corresponding to multiple references // Private attributes corresponding to multiple references
private MultipleAssociation<CompanyUser, CompanyUserHiringTeamLink> _HiringTeams;
// Map of maps of metadata // Map of maps of metadata
...@@ -126,11 +131,14 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -126,11 +131,14 @@ public abstract class BaseCompanyUser extends SecUserExtension
try try
{ {
String tmp_HiringTeams = CompanyUserHiringTeamLink.BACKREF_CompanyUser;
String tmp_Company = Company.BACKREF_Users; String tmp_Company = Company.BACKREF_Users;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping")); Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_HiringTeams();
setupAssocMetaData_Company(); setupAssocMetaData_Company();
setupAssocMetaData_DefaultHiringTeam();
FIELD_Email_Validators = (AttributeValidator[])setupAttribMetaData_Email(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Email_Validators = (AttributeValidator[])setupAttribMetaData_Email(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_Password_Validators = (AttributeValidator[])setupAttribMetaData_Password(validatorMapping).toArray (new AttributeValidator[0]); FIELD_Password_Validators = (AttributeValidator[])setupAttribMetaData_Password(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ConfirmPassword_Validators = (AttributeValidator[])setupAttribMetaData_ConfirmPassword(validatorMapping).toArray (new AttributeValidator[0]); FIELD_ConfirmPassword_Validators = (AttributeValidator[])setupAttribMetaData_ConfirmPassword(validatorMapping).toArray (new AttributeValidator[0]);
...@@ -158,6 +166,20 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -158,6 +166,20 @@ public abstract class BaseCompanyUser extends SecUserExtension
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_HiringTeams()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "CompanyUser");
metaInfo.put ("name", "HiringTeams");
metaInfo.put ("type", "CompanyUserHiringTeamLink");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.HiringTeams:", metaInfo);
ATTRIBUTES_METADATA_CompanyUser.put (MULTIPLEREFERENCE_HiringTeams, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_Company() private static void setupAssocMetaData_Company()
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -173,6 +195,20 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -173,6 +195,20 @@ public abstract class BaseCompanyUser extends SecUserExtension
// Meta Info setup // Meta Info setup
private static void setupAssocMetaData_DefaultHiringTeam()
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "default_hiring_team_id");
metaInfo.put ("name", "DefaultHiringTeam");
metaInfo.put ("type", "HiringTeam");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.DefaultHiringTeam:", metaInfo);
ATTRIBUTES_METADATA_CompanyUser.put (SINGLEREFERENCE_DefaultHiringTeam, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static List setupAttribMetaData_Email(Map validatorMapping) private static List setupAttribMetaData_Email(Map validatorMapping)
{ {
Map metaInfo = new HashMap (); Map metaInfo = new HashMap ();
...@@ -445,6 +481,8 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -445,6 +481,8 @@ public abstract class BaseCompanyUser extends SecUserExtension
super._initialiseAssociations (); super._initialiseAssociations ();
_Company = new SingleAssociation<CompanyUser, Company> (this, SINGLEREFERENCE_Company, Company.MULTIPLEREFERENCE_Users, Company.REFERENCE_Company, "oneit_sec_user_extension"); _Company = new SingleAssociation<CompanyUser, Company> (this, SINGLEREFERENCE_Company, Company.MULTIPLEREFERENCE_Users, Company.REFERENCE_Company, "oneit_sec_user_extension");
_DefaultHiringTeam = new SingleAssociation<CompanyUser, HiringTeam> (this, SINGLEREFERENCE_DefaultHiringTeam, null, HiringTeam.REFERENCE_HiringTeam, "oneit_sec_user_extension");
_HiringTeams = new MultipleAssociation<CompanyUser, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_HiringTeams, CompanyUserHiringTeamLink.SINGLEREFERENCE_CompanyUser, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);
} }
...@@ -455,6 +493,8 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -455,6 +493,8 @@ public abstract class BaseCompanyUser extends SecUserExtension
super.initialiseReference (); super.initialiseReference ();
_Company = new SingleAssociation<CompanyUser, Company> (this, SINGLEREFERENCE_Company, Company.MULTIPLEREFERENCE_Users, Company.REFERENCE_Company, "oneit_sec_user_extension"); _Company = new SingleAssociation<CompanyUser, Company> (this, SINGLEREFERENCE_Company, Company.MULTIPLEREFERENCE_Users, Company.REFERENCE_Company, "oneit_sec_user_extension");
_DefaultHiringTeam = new SingleAssociation<CompanyUser, HiringTeam> (this, SINGLEREFERENCE_DefaultHiringTeam, null, HiringTeam.REFERENCE_HiringTeam, "oneit_sec_user_extension");
_HiringTeams = new MultipleAssociation<CompanyUser, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_HiringTeams, CompanyUserHiringTeamLink.SINGLEREFERENCE_CompanyUser, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);
return this; return this;
...@@ -1650,6 +1690,8 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1650,6 +1690,8 @@ public abstract class BaseCompanyUser extends SecUserExtension
result.add("Company"); result.add("Company");
result.add("DefaultHiringTeam");
return result; return result;
} }
...@@ -1664,6 +1706,9 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1664,6 +1706,9 @@ public abstract class BaseCompanyUser extends SecUserExtension
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
return _Company.getReferencedType (); return _Company.getReferencedType ();
}else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
{
return _DefaultHiringTeam.getReferencedType ();
} }
else else
{ {
...@@ -1681,6 +1726,9 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1681,6 +1726,9 @@ public abstract class BaseCompanyUser extends SecUserExtension
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
return Company.MULTIPLEREFERENCE_Users ; return Company.MULTIPLEREFERENCE_Users ;
}else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
{
return null ;
} }
else else
{ {
...@@ -1698,6 +1746,9 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1698,6 +1746,9 @@ public abstract class BaseCompanyUser extends SecUserExtension
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
return getCompany (); return getCompany ();
}else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
{
return getDefaultHiringTeam ();
} }
else else
{ {
...@@ -1715,6 +1766,9 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1715,6 +1766,9 @@ public abstract class BaseCompanyUser extends SecUserExtension
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
return getCompany (getType); return getCompany (getType);
}else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
{
return getDefaultHiringTeam (getType);
} }
else else
{ {
...@@ -1732,6 +1786,9 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1732,6 +1786,9 @@ public abstract class BaseCompanyUser extends SecUserExtension
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
return getCompanyID (); return getCompanyID ();
}else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
{
return getDefaultHiringTeamID ();
} }
else else
{ {
...@@ -1749,6 +1806,9 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1749,6 +1806,9 @@ public abstract class BaseCompanyUser extends SecUserExtension
else if (assocName.equals (SINGLEREFERENCE_Company)) else if (assocName.equals (SINGLEREFERENCE_Company))
{ {
setCompany ((Company)(newValue)); setCompany ((Company)(newValue));
}else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
{
setDefaultHiringTeam ((HiringTeam)(newValue));
} }
else else
{ {
...@@ -1866,6 +1926,100 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1866,6 +1926,100 @@ public abstract class BaseCompanyUser extends SecUserExtension
} }
/** /**
* Get the reference DefaultHiringTeam
*/
public HiringTeam getDefaultHiringTeam () throws StorageException
{
assertValid();
try
{
return (HiringTeam)(_DefaultHiringTeam.get ());
}
catch (ClassCastException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CompanyUser:", this.getObjectID (), ", was trying to get HiringTeam:", getDefaultHiringTeamID ());
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _DefaultHiringTeam.get ().getClass ());
throw e;
}
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public HiringTeam getDefaultHiringTeam (Get getType) throws StorageException
{
assertValid();
return _DefaultHiringTeam.get(getType);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getDefaultHiringTeamID ()
{
assertValid();
if (_DefaultHiringTeam == null)
{
return null;
}
else
{
return _DefaultHiringTeam.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 preDefaultHiringTeamChange (HiringTeam newDefaultHiringTeam) 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 postDefaultHiringTeamChange () throws FieldException
{
}
public FieldWriteability getWriteability_DefaultHiringTeam ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the reference DefaultHiringTeam. Checks to ensure a new value
* has been supplied. If so, marks the reference as altered and sets it.
*/
public void setDefaultHiringTeam (HiringTeam newDefaultHiringTeam) throws StorageException, FieldException
{
if (_DefaultHiringTeam.wouldReferencedChange (newDefaultHiringTeam))
{
assertValid();
Debug.assertion (getWriteability_DefaultHiringTeam () != FieldWriteability.FALSE, "Assoc DefaultHiringTeam is not writeable");
preDefaultHiringTeamChange (newDefaultHiringTeam);
_DefaultHiringTeam.set (newDefaultHiringTeam);
postDefaultHiringTeamChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings. * A list of multi assoc names e.g. list of strings.
*/ */
public List<String> getMultiAssocs() public List<String> getMultiAssocs()
...@@ -1873,6 +2027,8 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1873,6 +2027,8 @@ public abstract class BaseCompanyUser extends SecUserExtension
List result = super.getMultiAssocs (); List result = super.getMultiAssocs ();
result.add("HiringTeams");
return result; return result;
} }
...@@ -1884,6 +2040,11 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1884,6 +2040,11 @@ public abstract class BaseCompanyUser extends SecUserExtension
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName) public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{ {
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
return CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink ;
}
return super.getMultiAssocReferenceInstance(attribName); return super.getMultiAssocReferenceInstance(attribName);
} }
...@@ -1892,6 +2053,11 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1892,6 +2053,11 @@ public abstract class BaseCompanyUser extends SecUserExtension
public String getMultiAssocBackReference(String attribName) public String getMultiAssocBackReference(String attribName)
{ {
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
return CompanyUserHiringTeamLink.SINGLEREFERENCE_CompanyUser ;
}
return super.getMultiAssocBackReference(attribName); return super.getMultiAssocBackReference(attribName);
} }
...@@ -1903,6 +2069,11 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1903,6 +2069,11 @@ public abstract class BaseCompanyUser extends SecUserExtension
public int getMultiAssocCount(String attribName) throws StorageException public int getMultiAssocCount(String attribName) throws StorageException
{ {
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
return this.getHiringTeamsCount();
}
return super.getMultiAssocCount(attribName); return super.getMultiAssocCount(attribName);
} }
...@@ -1914,6 +2085,11 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1914,6 +2085,11 @@ public abstract class BaseCompanyUser extends SecUserExtension
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{ {
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
return this.getHiringTeamsAt(index);
}
return super.getMultiAssocAt(attribName, index); return super.getMultiAssocAt(attribName, index);
} }
...@@ -1925,6 +2101,13 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1925,6 +2101,13 @@ public abstract class BaseCompanyUser extends SecUserExtension
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{ {
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
addToHiringTeams((CompanyUserHiringTeamLink)newElement);
return;
}
super.addToMultiAssoc(attribName, newElement); super.addToMultiAssoc(attribName, newElement);
} }
...@@ -1935,6 +2118,13 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1935,6 +2118,13 @@ public abstract class BaseCompanyUser extends SecUserExtension
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{ {
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
removeFromHiringTeams((CompanyUserHiringTeamLink)oldElement);
return;
}
super.removeFromMultiAssoc(attribName, oldElement); super.removeFromMultiAssoc(attribName, oldElement);
} }
...@@ -1943,6 +2133,12 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1943,6 +2133,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements) protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{ {
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
_HiringTeams.__loadAssociation (elements);
return;
}
super.__loadMultiAssoc(attribName, elements); super.__loadMultiAssoc(attribName, elements);
} }
...@@ -1951,12 +2147,86 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1951,12 +2147,86 @@ public abstract class BaseCompanyUser extends SecUserExtension
protected boolean __isMultiAssocLoaded (String attribName) protected boolean __isMultiAssocLoaded (String attribName)
{ {
if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
{
return _HiringTeams.isLoaded ();
}
return super.__isMultiAssocLoaded(attribName); return super.__isMultiAssocLoaded(attribName);
} }
public FieldWriteability getWriteability_HiringTeams ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
public int getHiringTeamsCount () throws StorageException
{
assertValid();
return _HiringTeams.getReferencedObjectsCount ();
}
public void addToHiringTeams (CompanyUserHiringTeamLink newElement) throws StorageException
{
if (_HiringTeams.wouldAddChange (newElement))
{
assertValid();
Debug.assertion (getWriteability_HiringTeams () != FieldWriteability.FALSE, "MultiAssoc HiringTeams is not writeable (add)");
_HiringTeams.appendElement (newElement);
try
{
if (newElement.getCompanyUser () != this)
{
newElement.setCompanyUser ((CompanyUser)(this));
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public void removeFromHiringTeams (CompanyUserHiringTeamLink elementToRemove) throws StorageException
{
if (_HiringTeams.wouldRemoveChange (elementToRemove))
{
assertValid();
Debug.assertion (getWriteability_HiringTeams () != FieldWriteability.FALSE, "MultiAssoc HiringTeams is not writeable (remove)");
_HiringTeams.removeElement (elementToRemove);
try
{
if (elementToRemove.getCompanyUser () != null)
{
elementToRemove.setCompanyUser (null);
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
}
}
public CompanyUserHiringTeamLink getHiringTeamsAt (int index) throws StorageException
{
return (CompanyUserHiringTeamLink)(_HiringTeams.getElementAt (index));
}
public SortedSet<CompanyUserHiringTeamLink> getHiringTeamsSet () throws StorageException
{
return _HiringTeams.getSet ();
}
public void onDelete () public void onDelete ()
...@@ -1977,6 +2247,12 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -1977,6 +2247,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
} }
} }
for(CompanyUserHiringTeamLink referenced : CollectionUtils.reverse(getHiringTeamsSet()))
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null CompanyUser from ", getObjectID (), " to ", referenced.getObjectID ());
referenced.setCompanyUser(null);
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -2047,6 +2323,7 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2047,6 +2323,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
oneit_sec_user_extensionPSet.setAttrib (FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject (_IsAccountVerified)); // oneit_sec_user_extensionPSet.setAttrib (FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject (_IsAccountVerified)); //
oneit_sec_user_extensionPSet.setAttrib (FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject (_IsEmailChanged)); // oneit_sec_user_extensionPSet.setAttrib (FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject (_IsEmailChanged)); //
_Company.getPersistentSets (allSets); _Company.getPersistentSets (allSets);
_DefaultHiringTeam.getPersistentSets (allSets);
} }
...@@ -2071,6 +2348,7 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2071,6 +2348,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_IsAccountVerified = (Boolean)(HELPER_IsAccountVerified.fromObject (_IsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsAccountVerified))); // _IsAccountVerified = (Boolean)(HELPER_IsAccountVerified.fromObject (_IsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsAccountVerified))); //
_IsEmailChanged = (Boolean)(HELPER_IsEmailChanged.fromObject (_IsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsEmailChanged))); // _IsEmailChanged = (Boolean)(HELPER_IsEmailChanged.fromObject (_IsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsEmailChanged))); //
_Company.setFromPersistentSets (objectID, allSets); _Company.setFromPersistentSets (objectID, allSets);
_DefaultHiringTeam.setFromPersistentSets (objectID, allSets);
} }
...@@ -2211,6 +2489,7 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2211,6 +2489,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
BaseCompanyUser sourceCompanyUser = (BaseCompanyUser)(source); BaseCompanyUser sourceCompanyUser = (BaseCompanyUser)(source);
_Company.copyFrom (sourceCompanyUser._Company, linkToGhosts); _Company.copyFrom (sourceCompanyUser._Company, linkToGhosts);
_DefaultHiringTeam.copyFrom (sourceCompanyUser._DefaultHiringTeam, linkToGhosts);
} }
} }
...@@ -2227,6 +2506,7 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2227,6 +2506,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
{ {
BaseCompanyUser sourceCompanyUser = (BaseCompanyUser)(source); BaseCompanyUser sourceCompanyUser = (BaseCompanyUser)(source);
_HiringTeams.copyFrom (sourceCompanyUser._HiringTeams, linkToGhosts);
} }
} }
...@@ -2260,6 +2540,8 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2260,6 +2540,8 @@ public abstract class BaseCompanyUser extends SecUserExtension
_Password = (String)(HELPER_Password.readExternal (_Password, vals.get(FIELD_Password))); // _Password = (String)(HELPER_Password.readExternal (_Password, vals.get(FIELD_Password))); //
_ConfirmPassword = (String)(HELPER_ConfirmPassword.readExternal (_ConfirmPassword, vals.get(FIELD_ConfirmPassword))); // _ConfirmPassword = (String)(HELPER_ConfirmPassword.readExternal (_ConfirmPassword, vals.get(FIELD_ConfirmPassword))); //
_Company.readExternalData(vals.get(SINGLEREFERENCE_Company)); _Company.readExternalData(vals.get(SINGLEREFERENCE_Company));
_DefaultHiringTeam.readExternalData(vals.get(SINGLEREFERENCE_DefaultHiringTeam));
_HiringTeams.readExternalData(vals.get(MULTIPLEREFERENCE_HiringTeams));
} }
...@@ -2284,6 +2566,8 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2284,6 +2566,8 @@ public abstract class BaseCompanyUser extends SecUserExtension
vals.put (FIELD_Password, HELPER_Password.writeExternal (_Password)); vals.put (FIELD_Password, HELPER_Password.writeExternal (_Password));
vals.put (FIELD_ConfirmPassword, HELPER_ConfirmPassword.writeExternal (_ConfirmPassword)); vals.put (FIELD_ConfirmPassword, HELPER_ConfirmPassword.writeExternal (_ConfirmPassword));
vals.put (SINGLEREFERENCE_Company, _Company.writeExternalData()); vals.put (SINGLEREFERENCE_Company, _Company.writeExternalData());
vals.put (SINGLEREFERENCE_DefaultHiringTeam, _DefaultHiringTeam.writeExternalData());
vals.put (MULTIPLEREFERENCE_HiringTeams, _HiringTeams.writeExternalData());
} }
...@@ -2336,9 +2620,11 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2336,9 +2620,11 @@ public abstract class BaseCompanyUser extends SecUserExtension
// Compare single assocs // Compare single assocs
_Company.compare (otherCompanyUser._Company, listener); _Company.compare (otherCompanyUser._Company, listener);
_DefaultHiringTeam.compare (otherCompanyUser._DefaultHiringTeam, listener);
// Compare multiple assocs // Compare multiple assocs
_HiringTeams.compare (otherCompanyUser._HiringTeams, listener);
} }
} }
...@@ -2369,6 +2655,8 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2369,6 +2655,8 @@ public abstract class BaseCompanyUser extends SecUserExtension
visitor.visitField(this, FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject(getIsAccountVerified())); visitor.visitField(this, FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject(getIsAccountVerified()));
visitor.visitField(this, FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject(getIsEmailChanged())); visitor.visitField(this, FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject(getIsEmailChanged()));
visitor.visitAssociation (_Company); visitor.visitAssociation (_Company);
visitor.visitAssociation (_DefaultHiringTeam);
visitor.visitAssociation (_HiringTeams);
} }
...@@ -2381,6 +2669,14 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2381,6 +2669,14 @@ public abstract class BaseCompanyUser extends SecUserExtension
{ {
visitor.visit (_Company); visitor.visit (_Company);
} }
if (scope.includes (_DefaultHiringTeam))
{
visitor.visit (_DefaultHiringTeam);
}
if (scope.includes (_HiringTeams))
{
visitor.visit (_HiringTeams);
}
} }
...@@ -2446,6 +2742,10 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2446,6 +2742,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{ {
return filter.matches (getCompany ()); return filter.matches (getCompany ());
} }
else if (attribName.equals (SINGLEREFERENCE_DefaultHiringTeam))
{
return filter.matches (getDefaultHiringTeam ());
}
else else
{ {
return super.testFilter (attribName, filter); return super.testFilter (attribName, filter);
...@@ -2543,6 +2843,12 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2543,6 +2843,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
return this; return this;
} }
public SearchAll andDefaultHiringTeam (QueryFilter<HiringTeam> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.default_hiring_team_id", "DefaultHiringTeam");
return this;
}
public CompanyUser[] public CompanyUser[]
search (ObjectTransaction transaction) throws StorageException search (ObjectTransaction transaction) throws StorageException
{ {
...@@ -2666,6 +2972,12 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2666,6 +2972,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
return this; return this;
} }
public SearchAllCompanyUsers andDefaultHiringTeam (QueryFilter<HiringTeam> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.default_hiring_team_id", "DefaultHiringTeam");
return this;
}
public CompanyUser[] public CompanyUser[]
search (ObjectTransaction transaction) throws StorageException search (ObjectTransaction transaction) throws StorageException
{ {
...@@ -2796,6 +3108,12 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -2796,6 +3108,12 @@ public abstract class BaseCompanyUser extends SecUserExtension
return this; return this;
} }
public SearchIdPin andDefaultHiringTeam (QueryFilter<HiringTeam> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.default_hiring_team_id", "DefaultHiringTeam");
return this;
}
public CompanyUser search (ObjectTransaction transaction) throws StorageException public CompanyUser search (ObjectTransaction transaction) throws StorageException
{ {
...@@ -3057,10 +3375,18 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -3057,10 +3375,18 @@ public abstract class BaseCompanyUser extends SecUserExtension
{ {
return getWriteability_IsEmailChanged (); return getWriteability_IsEmailChanged ();
} }
else if (fieldName.equals (MULTIPLEREFERENCE_HiringTeams))
{
return getWriteability_HiringTeams ();
}
else if (fieldName.equals (SINGLEREFERENCE_Company)) else if (fieldName.equals (SINGLEREFERENCE_Company))
{ {
return getWriteability_Company (); return getWriteability_Company ();
} }
else if (fieldName.equals (SINGLEREFERENCE_DefaultHiringTeam))
{
return getWriteability_DefaultHiringTeam ();
}
else if (fieldName.equals (FIELD_Email)) else if (fieldName.equals (FIELD_Email))
{ {
return getWriteability_Email (); return getWriteability_Email ();
...@@ -3482,6 +3808,10 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -3482,6 +3808,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
public PipeLine<From, ? extends Object> to(String name) public PipeLine<From, ? extends Object> to(String name)
{ {
if (name.equals ("HiringTeams"))
{
return toHiringTeams ();
}
if (name.equals ("Email")) if (name.equals ("Email"))
{ {
return toEmail (); return toEmail ();
...@@ -3534,6 +3864,10 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -3534,6 +3864,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{ {
return toCompany (); return toCompany ();
} }
if (name.equals ("DefaultHiringTeam"))
{
return toDefaultHiringTeam ();
}
return super.to(name); return super.to(name);
...@@ -3569,6 +3903,18 @@ public abstract class BaseCompanyUser extends SecUserExtension ...@@ -3569,6 +3903,18 @@ public abstract class BaseCompanyUser extends SecUserExtension
{ {
return Company.REFERENCE_Company.new CompanyPipeLineFactory<From, Company> (this, new ORMSingleAssocPipe<Me, Company>(SINGLEREFERENCE_Company, filter)); return Company.REFERENCE_Company.new CompanyPipeLineFactory<From, Company> (this, new ORMSingleAssocPipe<Me, Company>(SINGLEREFERENCE_Company, filter));
} }
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toDefaultHiringTeam () { return toDefaultHiringTeam (Filter.ALL); }
public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toDefaultHiringTeam (Filter<HiringTeam> filter)
{
return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMSingleAssocPipe<Me, HiringTeam>(SINGLEREFERENCE_DefaultHiringTeam, filter));
}
public CompanyUserHiringTeamLink.CompanyUserHiringTeamLinkPipeLineFactory<From, CompanyUserHiringTeamLink> toHiringTeams () { return toHiringTeams(Filter.ALL); }
public CompanyUserHiringTeamLink.CompanyUserHiringTeamLinkPipeLineFactory<From, CompanyUserHiringTeamLink> toHiringTeams (Filter<CompanyUserHiringTeamLink> filter)
{
return CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink.new CompanyUserHiringTeamLinkPipeLineFactory<From, CompanyUserHiringTeamLink> (this, new ORMMultiAssocPipe<Me, CompanyUserHiringTeamLink>(MULTIPLEREFERENCE_HiringTeams, filter));
}
} }
...@@ -3629,6 +3975,37 @@ class DummyCompanyUser extends CompanyUser ...@@ -3629,6 +3975,37 @@ class DummyCompanyUser extends CompanyUser
return Company.DUMMY_Company.getObjectID(); return Company.DUMMY_Company.getObjectID();
} }
public HiringTeam getDefaultHiringTeam () throws StorageException
{
return (HiringTeam)(HiringTeam.DUMMY_HiringTeam);
}
/**
* Get the object id for the referenced object. Does not force a DB access.
*/
public Long getDefaultHiringTeamID ()
{
return HiringTeam.DUMMY_HiringTeam.getObjectID();
}
public int getHiringTeamsCount () throws StorageException
{
return 0;
}
public CompanyUserHiringTeamLink getHiringTeamsAt (int index) throws StorageException
{
throw new RuntimeException ("No elements in a dummy object in association HiringTeams");
}
public SortedSet getHiringTeamsSet () throws StorageException
{
return new TreeSet();
}
} }
/*
* 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.orm;
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;
public abstract class BaseCompanyUserHiringTeamLink extends BaseBusinessClass
{
// Reference instance for the object
public static final CompanyUserHiringTeamLink REFERENCE_CompanyUserHiringTeamLink = new CompanyUserHiringTeamLink ();
// Reference instance for the object
public static final CompanyUserHiringTeamLink DUMMY_CompanyUserHiringTeamLink = new DummyCompanyUserHiringTeamLink ();
// Static constants corresponding to field names
public static final String SINGLEREFERENCE_HiringTeam = "HiringTeam";
public static final String BACKREF_HiringTeam = "";
public static final String SINGLEREFERENCE_CompanyUser = "CompanyUser";
public static final String BACKREF_CompanyUser = "";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
// Static constants corresponding to attribute helpers
// Private attributes corresponding to business object data
// Private attributes corresponding to single references
private SingleAssociation<CompanyUserHiringTeamLink, HiringTeam> _HiringTeam;
private SingleAssociation<CompanyUserHiringTeamLink, CompanyUser> _CompanyUser;
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_CompanyUserHiringTeamLink = new HashMap ();
// Arrays of validators for each attribute
// Arrays of behaviour decorators
private static final CompanyUserHiringTeamLinkBehaviourDecorator[] CompanyUserHiringTeamLink_BehaviourDecorators;
static
{
try
{
String tmp_HiringTeam = HiringTeam.BACKREF_Users;
String tmp_CompanyUser = CompanyUser.BACKREF_HiringTeams;
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
setupAssocMetaData_HiringTeam();
setupAssocMetaData_CompanyUser();
REFERENCE_CompanyUserHiringTeamLink.initialiseReference ();
DUMMY_CompanyUserHiringTeamLink.initialiseReference ();
CompanyUserHiringTeamLink_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(CompanyUserHiringTeamLink.class).toArray(new CompanyUserHiringTeamLinkBehaviourDecorator[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 ("backreferenceName", "Users");
metaInfo.put ("dbcol", "hiring_team_id");
metaInfo.put ("name", "HiringTeam");
metaInfo.put ("type", "HiringTeam");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUserHiringTeamLink.HiringTeam:", metaInfo);
ATTRIBUTES_METADATA_CompanyUserHiringTeamLink.put (SINGLEREFERENCE_HiringTeam, Collections.unmodifiableMap (metaInfo));
}
// Meta Info setup
private static void setupAssocMetaData_CompanyUser()
{
Map metaInfo = new HashMap ();
metaInfo.put ("backreferenceName", "HiringTeams");
metaInfo.put ("dbcol", "company_user_id");
metaInfo.put ("name", "CompanyUser");
metaInfo.put ("type", "CompanyUser");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUserHiringTeamLink.CompanyUser:", metaInfo);
ATTRIBUTES_METADATA_CompanyUserHiringTeamLink.put (SINGLEREFERENCE_CompanyUser, Collections.unmodifiableMap (metaInfo));
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseCompanyUserHiringTeamLink ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return CompanyUserHiringTeamLink_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
_HiringTeam = new SingleAssociation<CompanyUserHiringTeamLink, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, HiringTeam.MULTIPLEREFERENCE_Users, HiringTeam.REFERENCE_HiringTeam, "tl_company_user_hiring_team_link");
_CompanyUser = new SingleAssociation<CompanyUserHiringTeamLink, CompanyUser> (this, SINGLEREFERENCE_CompanyUser, CompanyUser.MULTIPLEREFERENCE_HiringTeams, CompanyUser.REFERENCE_CompanyUser, "tl_company_user_hiring_team_link");
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
_HiringTeam = new SingleAssociation<CompanyUserHiringTeamLink, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, HiringTeam.MULTIPLEREFERENCE_Users, HiringTeam.REFERENCE_HiringTeam, "tl_company_user_hiring_team_link");
_CompanyUser = new SingleAssociation<CompanyUserHiringTeamLink, CompanyUser> (this, SINGLEREFERENCE_CompanyUser, CompanyUser.MULTIPLEREFERENCE_HiringTeams, CompanyUser.REFERENCE_CompanyUser, "tl_company_user_hiring_team_link");
return this;
}
/**
* 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 HiringTeam.MULTIPLEREFERENCE_Users ;
}else if (assocName.equals (SINGLEREFERENCE_CompanyUser))
{
return CompanyUser.MULTIPLEREFERENCE_HiringTeams ;
}
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 CompanyUserHiringTeamLink:", 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 oldHiringTeam = getHiringTeam ();
if (oldHiringTeam != null)
{
// This is to stop validation from triggering when we are removed
_HiringTeam.set (null);
oldHiringTeam.removeFromUsers ((CompanyUserHiringTeamLink)(this));
}
_HiringTeam.set (newHiringTeam);
if (newHiringTeam != null)
{
newHiringTeam.addToUsers ((CompanyUserHiringTeamLink)(this));
}
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 CompanyUserHiringTeamLink:", 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 oldCompanyUser = getCompanyUser ();
if (oldCompanyUser != null)
{
// This is to stop validation from triggering when we are removed
_CompanyUser.set (null);
oldCompanyUser.removeFromHiringTeams ((CompanyUserHiringTeamLink)(this));
}
_CompanyUser.set (newCompanyUser);
if (newCompanyUser != null)
{
newCompanyUser.addToHiringTeams ((CompanyUserHiringTeamLink)(this));
}
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
{
// 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 Users from ", getObjectID (), " to ", referenced.getObjectID ());
_HiringTeam.set (null);
referenced.removeFromUsers ((CompanyUserHiringTeamLink)this);
}
}
// Ensure we are removed from any loaded multi-associations that aren't mandatory
if (_CompanyUser.isLoaded () || getTransaction ().isObjectLoaded (_CompanyUser.getReferencedType (), getCompanyUserID ()))
{
CompanyUser referenced = getCompanyUser ();
if (referenced != null)
{
// Stop the callback
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null HiringTeams from ", getObjectID (), " to ", referenced.getObjectID ());
_CompanyUser.set (null);
referenced.removeFromHiringTeams ((CompanyUserHiringTeamLink)this);
}
}
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public CompanyUserHiringTeamLink newInstance ()
{
return new CompanyUserHiringTeamLink ();
}
public CompanyUserHiringTeamLink referenceInstance ()
{
return REFERENCE_CompanyUserHiringTeamLink;
}
public CompanyUserHiringTeamLink getInTransaction (ObjectTransaction t) throws StorageException
{
return getCompanyUserHiringTeamLinkByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_CompanyUserHiringTeamLink;
}
public String getBaseSetName ()
{
return "tl_company_user_hiring_team_link";
}
/**
* 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 tl_company_user_hiring_team_linkPSet = allSets.getPersistentSet (myID, "tl_company_user_hiring_team_link", myPSetStatus);
tl_company_user_hiring_team_linkPSet.setAttrib (FIELD_ObjectID, myID);
_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 tl_company_user_hiring_team_linkPSet = allSets.getPersistentSet (objectID, "tl_company_user_hiring_team_link");
_HiringTeam.setFromPersistentSets (objectID, allSets);
_CompanyUser.setFromPersistentSets (objectID, allSets);
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof CompanyUserHiringTeamLink)
{
CompanyUserHiringTeamLink otherCompanyUserHiringTeamLink = (CompanyUserHiringTeamLink)other;
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseCompanyUserHiringTeamLink)
{
BaseCompanyUserHiringTeamLink sourceCompanyUserHiringTeamLink = (BaseCompanyUserHiringTeamLink)(source);
}
}
/**
* 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 BaseCompanyUserHiringTeamLink)
{
BaseCompanyUserHiringTeamLink sourceCompanyUserHiringTeamLink = (BaseCompanyUserHiringTeamLink)(source);
_HiringTeam.copyFrom (sourceCompanyUserHiringTeamLink._HiringTeam, linkToGhosts);
_CompanyUser.copyFrom (sourceCompanyUserHiringTeamLink._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 BaseCompanyUserHiringTeamLink)
{
BaseCompanyUserHiringTeamLink sourceCompanyUserHiringTeamLink = (BaseCompanyUserHiringTeamLink)(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);
_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 (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 BaseCompanyUserHiringTeamLink)
{
BaseCompanyUserHiringTeamLink otherCompanyUserHiringTeamLink = (BaseCompanyUserHiringTeamLink)(other);
// Compare single assocs
_HiringTeam.compare (otherCompanyUserHiringTeamLink._HiringTeam, listener);
_CompanyUser.compare (otherCompanyUserHiringTeamLink._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.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 CompanyUserHiringTeamLink createCompanyUserHiringTeamLink (ObjectTransaction transaction) throws StorageException
{
CompanyUserHiringTeamLink result = new CompanyUserHiringTeamLink ();
result.initialiseNewObject (transaction);
return result;
}
public static CompanyUserHiringTeamLink getCompanyUserHiringTeamLinkByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (CompanyUserHiringTeamLink)(transaction.getObjectByID (REFERENCE_CompanyUserHiringTeamLink, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
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 static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<CompanyUserHiringTeamLink>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "tl_company_user_hiring_team_link.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_company_user_hiring_team_link.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "tl_company_user_hiring_team_link.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andHiringTeam (QueryFilter<HiringTeam> filter)
{
filter.addFilter (context, "tl_company_user_hiring_team_link.hiring_team_id", "HiringTeam");
return this;
}
public SearchAll andCompanyUser (QueryFilter<CompanyUser> filter)
{
filter.addFilter (context, "tl_company_user_hiring_team_link.company_user_id", "CompanyUser");
return this;
}
public CompanyUserHiringTeamLink[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_CompanyUserHiringTeamLink, SEARCH_All, criteria);
Set<CompanyUserHiringTeamLink> typedResults = new LinkedHashSet <CompanyUserHiringTeamLink> ();
for (BaseBusinessClass bbcResult : results)
{
CompanyUserHiringTeamLink aResult = (CompanyUserHiringTeamLink)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new CompanyUserHiringTeamLink[0]);
}
}
public static CompanyUserHiringTeamLink[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
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 (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)
{
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_CompanyUserHiringTeamLink.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_CompanyUserHiringTeamLink.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_CompanyUserHiringTeamLink.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_CompanyUserHiringTeamLink.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 CompanyUserHiringTeamLinkBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<CompanyUserHiringTeamLink>
{
}
public ORMPipeLine pipes()
{
return new CompanyUserHiringTeamLinkPipeLineFactory<CompanyUserHiringTeamLink, CompanyUserHiringTeamLink> ((CompanyUserHiringTeamLink)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public CompanyUserHiringTeamLinkPipeLineFactory<CompanyUserHiringTeamLink, CompanyUserHiringTeamLink> pipelineCompanyUserHiringTeamLink()
{
return (CompanyUserHiringTeamLinkPipeLineFactory<CompanyUserHiringTeamLink, CompanyUserHiringTeamLink>) pipes();
}
public static CompanyUserHiringTeamLinkPipeLineFactory<CompanyUserHiringTeamLink, CompanyUserHiringTeamLink> pipesCompanyUserHiringTeamLink(Collection<CompanyUserHiringTeamLink> items)
{
return REFERENCE_CompanyUserHiringTeamLink.new CompanyUserHiringTeamLinkPipeLineFactory<CompanyUserHiringTeamLink, CompanyUserHiringTeamLink> (items);
}
public static CompanyUserHiringTeamLinkPipeLineFactory<CompanyUserHiringTeamLink, CompanyUserHiringTeamLink> pipesCompanyUserHiringTeamLink(CompanyUserHiringTeamLink[] _items)
{
return pipesCompanyUserHiringTeamLink(Arrays.asList (_items));
}
public static CompanyUserHiringTeamLinkPipeLineFactory<CompanyUserHiringTeamLink, CompanyUserHiringTeamLink> pipesCompanyUserHiringTeamLink()
{
return pipesCompanyUserHiringTeamLink((Collection)null);
}
public class CompanyUserHiringTeamLinkPipeLineFactory<From extends BaseBusinessClass, Me extends CompanyUserHiringTeamLink> extends BaseBusinessClass.ORMPipeLine<From, Me>
{
public <Prev> CompanyUserHiringTeamLinkPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public CompanyUserHiringTeamLinkPipeLineFactory (From seed)
{
super(seed);
}
public CompanyUserHiringTeamLinkPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("HiringTeam"))
{
return toHiringTeam ();
}
if (name.equals ("CompanyUser"))
{
return toCompanyUser ();
}
return super.to(name);
}
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 DummyCompanyUserHiringTeamLink extends CompanyUserHiringTeamLink
{
// Default constructor primarily to support Externalisable
public DummyCompanyUserHiringTeamLink()
{
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();
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,6 +6,7 @@ import oneit.objstore.ObjectStatus; ...@@ -6,6 +6,7 @@ import oneit.objstore.ObjectStatus;
import oneit.objstore.ValidationContext; import oneit.objstore.ValidationContext;
import oneit.objstore.rdbms.filters.EqualsFilter; import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.security.SecUser; import oneit.security.SecUser;
import oneit.utils.BusinessException;
import oneit.utils.CollectionUtils; import oneit.utils.CollectionUtils;
import oneit.utils.StringUtils; import oneit.utils.StringUtils;
import oneit.utils.math.NullArith; import oneit.utils.math.NullArith;
...@@ -26,6 +27,14 @@ public class Company extends BaseCompany ...@@ -26,6 +27,14 @@ public class Company extends BaseCompany
{ {
// Do not add any code to this, always put it in initialiseNewObject // Do not add any code to this, always put it in initialiseNewObject
} }
@Override
protected void postInitNewObj() throws BusinessException
{
addToHiringTeams(HiringTeam.createHiringTeam(getTransaction()));
super.postInitNewObj();
}
public boolean showHasClientSupport() public boolean showHasClientSupport()
...@@ -33,6 +42,11 @@ public class Company extends BaseCompany ...@@ -33,6 +42,11 @@ public class Company extends BaseCompany
return isTrue(getHasClientSupport()); return isTrue(getHasClientSupport());
} }
public boolean showTeamManagesOwnBilling()
{
return isTrue(getManageOwnBilling());
}
//This logic moved from invite_users.jsp //This logic moved from invite_users.jsp
public boolean createDefaultUser() throws FieldException public boolean createDefaultUser() throws FieldException
{ {
...@@ -56,18 +70,6 @@ public class Company extends BaseCompany ...@@ -56,18 +70,6 @@ public class Company extends BaseCompany
} }
@Override
public void validate(ValidationContext context)
{
if(getStatus() != ObjectStatus.NEW)
{
context.check(getHiringTeamType() != null , this, FIELD_HiringTeamType, "mandatory");
}
super.validate(context);
}
public Boolean isEmailCorrect() public Boolean isEmailCorrect()
{ {
return StringUtils.isEmailAddress(StringUtils.subBlanks(getUserEmail())); return StringUtils.isEmailAddress(StringUtils.subBlanks(getUserEmail()));
...@@ -226,4 +228,9 @@ public class Company extends BaseCompany ...@@ -226,4 +228,9 @@ public class Company extends BaseCompany
return Boolean.FALSE; return Boolean.FALSE;
} }
public HiringTeam getDefaultHiringTeam()
{
return getHiringTeamsCount() > 0 ? getHiringTeamsAt(0) : null;
}
} }
\ No newline at end of file
...@@ -8,18 +8,25 @@ ...@@ -8,18 +8,25 @@
<IMPORT value="performa.orm.types.TimeZone"/> <IMPORT value="performa.orm.types.TimeZone"/>
<IMPORT value="oneit.business.shopping.orm.*"/> <IMPORT value="oneit.business.shopping.orm.*"/>
<MULTIPLEREFERENCE name="Users" type="CompanyUser" backreferenceName="Company"/> <MULTIPLEREFERENCE name="Users" type="CompanyUser" backreferenceName="Company" />
<MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="Company"/> <MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="Company" />
<MULTIPLEREFERENCE name="HiringTeams" type="HiringTeam" backreferenceName="Company" />
<TRANSIENT name="UserEmail" type="String"/>
<TRANSIENT name="FirstName" type="String"/> <TRANSIENT name="HiringTeamName" type="String" />
<TRANSIENT name="LastName" type="String"/> <TRANSIENT name="ManageOwnBilling" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="UserEmail" type="String" />
<TRANSIENT name="FirstName" type="String" />
<TRANSIENT name="LastName" type="String" />
<TRANSIENT name="RoleType" type="RoleType" defaultValue="RoleType.STANDARD" attribHelper="EnumeratedAttributeHelper"/> <TRANSIENT name="RoleType" type="RoleType" defaultValue="RoleType.STANDARD" attribHelper="EnumeratedAttributeHelper"/>
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/> <TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="CompletedProfile" type="Boolean" defaultValue="Boolean.FALSE"/> <TRANSIENT name="CompletedProfile" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="PaymentJobCount" type="Integer"/> <TRANSIENT name="PaymentJobCount" type="Integer" />
<TRANSIENT name="StripeLast4" type="String" /> <TRANSIENT name="StripeLast4" type="String" />
<TRANSIENT name="StripeBrand" type="String" /> <TRANSIENT name="StripeBrand" type="String" />
<TRANSIENTSINGLE name="Owner" type="CompanyUser" />
<TRANSIENTSINGLE name="BillingTeam" type="HiringTeam" />
<TABLE name="tl_company" tablePrefix="object"> <TABLE name="tl_company" tablePrefix="object">
...@@ -42,8 +49,8 @@ ...@@ -42,8 +49,8 @@
<ATTRIB name="PlanRenewedOn" type="Date" dbcol="plan_renewed_on" mandatory="false" /> <ATTRIB name="PlanRenewedOn" type="Date" dbcol="plan_renewed_on" mandatory="false" />
<ATTRIB name="UsedCredits" type="Integer" dbcol="used_credits" /> <ATTRIB name="UsedCredits" type="Integer" dbcol="used_credits" />
<SINGLEREFERENCE name="AddedByUser" type="CompanyUser" dbcol="added_by_user_id" mandatory="true" /> <SINGLEREFERENCE name="AddedByUser" type="CompanyUser" dbcol="added_by_user_id" mandatory="true" />
<SINGLEREFERENCE name="PaymentPlan" type="PaymentPlan" dbcol="payment_plan_id" mandatory="false" /> <SINGLEREFERENCE name="PaymentPlan" type="PaymentPlan" dbcol="payment_plan_id" mandatory="false" />
</TABLE> </TABLE>
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
<IMPORT value="oneit.security.*" /> <IMPORT value="oneit.security.*" />
<IMPORT value="performa.orm.types.*"/> <IMPORT value="performa.orm.types.*"/>
<MULTIPLEREFERENCE name="HiringTeams" type="CompanyUserHiringTeamLink" backreferenceName="CompanyUser" />
<TRANSIENT name="Email" type="String" validators="Email" /> <TRANSIENT name="Email" type="String" validators="Email" />
<TRANSIENT name="Password" type="String"/> <TRANSIENT name="Password" type="String"/>
<TRANSIENT name="ConfirmPassword" type="String"/> <TRANSIENT name="ConfirmPassword" type="String"/>
...@@ -23,9 +25,10 @@ ...@@ -23,9 +25,10 @@
<ATTRIB name="IsAccountVerified" type="Boolean" dbcol="is_account_verified" defaultValue="Boolean.FALSE"/> <ATTRIB name="IsAccountVerified" type="Boolean" dbcol="is_account_verified" defaultValue="Boolean.FALSE"/>
<ATTRIB name="IsEmailChanged" type="Boolean" dbcol="is_email_changed" defaultValue="Boolean.FALSE"/> <ATTRIB name="IsEmailChanged" type="Boolean" dbcol="is_email_changed" defaultValue="Boolean.FALSE"/>
<SINGLEREFERENCE name="User" type="SecUser" dbcol="user_id" backreferenceName="Extensions" inSuper='TRUE'/> <SINGLEREFERENCE name="User" type="SecUser" dbcol="user_id" backreferenceName="Extensions" inSuper='TRUE'/>
<SINGLEREFERENCE name="Company" type="Company" dbcol="company_id" backreferenceName="Users"/> <SINGLEREFERENCE name="Company" type="Company" dbcol="company_id" backreferenceName="Users"/>
<SINGLEREFERENCE name="DefaultHiringTeam" type="HiringTeam" dbcol="default_hiring_team_id" />
</TABLE> </TABLE>
<SEARCH type="All" paramFilter="oneit_sec_user_extension.object_id is not null" > <SEARCH type="All" paramFilter="oneit_sec_user_extension.object_id is not null" >
......
package performa.orm;
public class CompanyUserHiringTeamLink extends BaseCompanyUserHiringTeamLink
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public CompanyUserHiringTeamLink ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
\ 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="CompanyUserHiringTeamLink" package="performa.orm">
<TABLE name="tl_company_user_hiring_team_link" tablePrefix="object">
<SINGLEREFERENCE name="HiringTeam" type="HiringTeam" dbcol="hiring_team_id" backreferenceName="Users" />
<SINGLEREFERENCE name="CompanyUser" type="CompanyUser" dbcol="company_user_id" backreferenceName="HiringTeams" />
</TABLE>
<SEARCH type="All" paramFilter="tl_company_user_hiring_team_link.object_id is not null" >
</SEARCH>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
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.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class CompanyUserHiringTeamLinkPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea CompanyUserHiringTeamLinkPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "CompanyUserHiringTeamLink");
// Private attributes corresponding to business object data
// Static constants corresponding to attribute helpers
public CompanyUserHiringTeamLinkPersistenceMgr ()
{
}
private String SELECT_COLUMNS = "{PREFIX}tl_company_user_hiring_team_link.object_id as id, {PREFIX}tl_company_user_hiring_team_link.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_company_user_hiring_team_link.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_company_user_hiring_team_link.hiring_team_id, {PREFIX}tl_company_user_hiring_team_link.company_user_id, 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, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);
if (objectToReturn instanceof CompanyUserHiringTeamLink)
{
LogMgr.log (CompanyUserHiringTeamLinkPersistence, 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 CompanyUserHiringTeamLink");
}
}
PersistentSet tl_company_user_hiring_team_linkPSet = allPSets.getPersistentSet(id, "tl_company_user_hiring_team_link", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_company_user_hiring_team_linkPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_company_user_hiring_team_linkPSet.containsAttrib(CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam)||
!tl_company_user_hiring_team_linkPSet.containsAttrib(CompanyUserHiringTeamLink.SINGLEREFERENCE_CompanyUser))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (CompanyUserHiringTeamLinkPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
CompanyUserHiringTeamLink result = new CompanyUserHiringTeamLink ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_company_user_hiring_team_link " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_company_user_hiring_team_link.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 if (refName.equals (CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_company_user_hiring_team_link " +
"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 (CompanyUserHiringTeamLink.SINGLEREFERENCE_CompanyUser))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_company_user_hiring_team_link " +
"WHERE " + SELECT_JOINS + "company_user_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
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 tl_company_user_hiring_team_linkPSet = allPSets.getPersistentSet(objectID, "tl_company_user_hiring_team_link");
if (tl_company_user_hiring_team_linkPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_company_user_hiring_team_linkPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_company_user_hiring_team_link " +
"SET hiring_team_id = ? , company_user_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_company_user_hiring_team_link.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (SQLManager.CheckNull((Long)(tl_company_user_hiring_team_linkPSet.getAttrib (CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_company_user_hiring_team_linkPSet.getAttrib (CompanyUserHiringTeamLink.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}tl_company_user_hiring_team_link 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[] { "tl_company_user_hiring_team_link", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (CompanyUserHiringTeamLinkPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_company_user_hiring_team_link");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_company_user_hiring_team_link for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (CompanyUserHiringTeamLinkPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_company_user_hiring_team_linkPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (CompanyUserHiringTeamLinkPersistence, 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 tl_company_user_hiring_team_linkPSet = allPSets.getPersistentSet(objectID, "tl_company_user_hiring_team_link");
LogMgr.log (CompanyUserHiringTeamLinkPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_company_user_hiring_team_linkPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_company_user_hiring_team_linkPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_company_user_hiring_team_link " +
"WHERE tl_company_user_hiring_team_link.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}tl_company_user_hiring_team_link WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_company_user_hiring_team_link");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_company_user_hiring_team_link for row:" + objectID;
LogMgr.log (CompanyUserHiringTeamLinkPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_company_user_hiring_team_linkPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, CompanyUserHiringTeamLink> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink.getObjectIDSpace (), r.getLong ("id"));
CompanyUserHiringTeamLink 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, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);
if (cachedElement instanceof CompanyUserHiringTeamLink)
{
LogMgr.log (CompanyUserHiringTeamLinkPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (CompanyUserHiringTeamLink)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a CompanyUserHiringTeamLink");
}
}
else
{
PersistentSet tl_company_user_hiring_team_linkPSet = allPSets.getPersistentSet(objectID, "tl_company_user_hiring_team_link", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new CompanyUserHiringTeamLink ();
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 (CompanyUserHiringTeamLinkPersistence, 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}tl_company_user_hiring_team_link " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (CompanyUserHiringTeamLink.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_company_user_hiring_team_link.object_id is not null
String preFilter = "(tl_company_user_hiring_team_link.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_company_user_hiring_team_link " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_company_user_hiring_team_linkPSet = allPSets.getPersistentSet(objectID, "tl_company_user_hiring_team_link", PersistentSetStatus.FETCHED);
// Object Modified
tl_company_user_hiring_team_linkPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_company_user_hiring_team_linkPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_company_user_hiring_team_linkPSet.setAttrib(CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam, r.getObject ("hiring_team_id"));
tl_company_user_hiring_team_linkPSet.setAttrib(CompanyUserHiringTeamLink.SINGLEREFERENCE_CompanyUser, r.getObject ("company_user_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_company_user_hiring_team_linkPSet = allPSets.getPersistentSet(objectID, "tl_company_user_hiring_team_link");
if (tl_company_user_hiring_team_linkPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_company_user_hiring_team_linkPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_company_user_hiring_team_link " +
" ( hiring_team_id, company_user_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" ( ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils .listEntry (SQLManager.CheckNull((Long)(tl_company_user_hiring_team_linkPSet.getAttrib (CompanyUserHiringTeamLink.SINGLEREFERENCE_HiringTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_company_user_hiring_team_linkPSet.getAttrib (CompanyUserHiringTeamLink.SINGLEREFERENCE_CompanyUser)))) .listEntry (objectID.longID ()).toList().toArray());
tl_company_user_hiring_team_linkPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
...@@ -67,7 +67,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr ...@@ -67,7 +67,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
} }
private String SELECT_COLUMNS = "{PREFIX}oneit_sec_user_extension.object_id as id, {PREFIX}oneit_sec_user_extension.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}oneit_sec_user_extension.object_CREATED_DATE as CREATED_DATE, {PREFIX}oneit_sec_user_extension.object_TYPE as OBJECT_TYPE, {PREFIX}oneit_sec_user_extension.forgot_password_mail_send_date, {PREFIX}oneit_sec_user_extension.forgot_password_key, {PREFIX}oneit_sec_user_extension.role_type, {PREFIX}oneit_sec_user_extension.roles, {PREFIX}oneit_sec_user_extension.phone, {PREFIX}oneit_sec_user_extension.verification_mail_send_date, {PREFIX}oneit_sec_user_extension.verification_key, {PREFIX}oneit_sec_user_extension.is_account_verified, {PREFIX}oneit_sec_user_extension.is_email_changed, {PREFIX}oneit_sec_user_extension.user_id, {PREFIX}oneit_sec_user_extension.company_id, 1 AS commasafe "; private String SELECT_COLUMNS = "{PREFIX}oneit_sec_user_extension.object_id as id, {PREFIX}oneit_sec_user_extension.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}oneit_sec_user_extension.object_CREATED_DATE as CREATED_DATE, {PREFIX}oneit_sec_user_extension.object_TYPE as OBJECT_TYPE, {PREFIX}oneit_sec_user_extension.forgot_password_mail_send_date, {PREFIX}oneit_sec_user_extension.forgot_password_key, {PREFIX}oneit_sec_user_extension.role_type, {PREFIX}oneit_sec_user_extension.roles, {PREFIX}oneit_sec_user_extension.phone, {PREFIX}oneit_sec_user_extension.verification_mail_send_date, {PREFIX}oneit_sec_user_extension.verification_key, {PREFIX}oneit_sec_user_extension.is_account_verified, {PREFIX}oneit_sec_user_extension.is_email_changed, {PREFIX}oneit_sec_user_extension.user_id, {PREFIX}oneit_sec_user_extension.company_id, {PREFIX}oneit_sec_user_extension.default_hiring_team_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
...@@ -129,7 +129,8 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr ...@@ -129,7 +129,8 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_IsAccountVerified)|| !oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_IsAccountVerified)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_IsEmailChanged)|| !oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_IsEmailChanged)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.SINGLEREFERENCE_User)|| !oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.SINGLEREFERENCE_User)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.SINGLEREFERENCE_Company)) !oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.SINGLEREFERENCE_Company)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.SINGLEREFERENCE_DefaultHiringTeam))
{ {
// We will need to retrieve it // We will need to retrieve it
idsToFetch.add (id.longValue()); idsToFetch.add (id.longValue());
...@@ -228,10 +229,10 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr ...@@ -228,10 +229,10 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
{ {
int rowsUpdated = executeStatement (sqlMgr, int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}oneit_sec_user_extension " + "UPDATE {PREFIX}oneit_sec_user_extension " +
"SET forgot_password_mail_send_date = ?, forgot_password_key = ?, role_type = ?, roles = ?, phone = ?, verification_mail_send_date = ?, verification_key = ?, is_account_verified = ?, is_email_changed = ?, user_id = ? , company_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " + "SET forgot_password_mail_send_date = ?, forgot_password_key = ?, role_type = ?, roles = ?, phone = ?, verification_mail_send_date = ?, verification_key = ?, is_account_verified = ?, is_email_changed = ?, user_id = ? , company_id = ? , default_hiring_team_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE oneit_sec_user_extension.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ", "WHERE oneit_sec_user_extension.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_ForgotPasswordMailSendDate.getForSQL(dummyForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordMailSendDate))).listEntry (HELPER_ForgotPasswordKey.getForSQL(dummyForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordKey))).listEntry (HELPER_Role.getForSQL(dummyRole, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Role))).listEntry (HELPER_Roles.getForSQL(dummyRoles, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Roles))).listEntry (HELPER_Phone.getForSQL(dummyPhone, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Phone))).listEntry (HELPER_VerificationMailSendDate.getForSQL(dummyVerificationMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationMailSendDate))).listEntry (HELPER_VerificationKey.getForSQL(dummyVerificationKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationKey))).listEntry (HELPER_IsAccountVerified.getForSQL(dummyIsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsAccountVerified))).listEntry (HELPER_IsEmailChanged.getForSQL(dummyIsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsEmailChanged))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_User)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_Company)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray()); CollectionUtils.listEntry (HELPER_ForgotPasswordMailSendDate.getForSQL(dummyForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordMailSendDate))).listEntry (HELPER_ForgotPasswordKey.getForSQL(dummyForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordKey))).listEntry (HELPER_Role.getForSQL(dummyRole, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Role))).listEntry (HELPER_Roles.getForSQL(dummyRoles, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Roles))).listEntry (HELPER_Phone.getForSQL(dummyPhone, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Phone))).listEntry (HELPER_VerificationMailSendDate.getForSQL(dummyVerificationMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationMailSendDate))).listEntry (HELPER_VerificationKey.getForSQL(dummyVerificationKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationKey))).listEntry (HELPER_IsAccountVerified.getForSQL(dummyIsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsAccountVerified))).listEntry (HELPER_IsEmailChanged.getForSQL(dummyIsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsEmailChanged))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_User)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_DefaultHiringTeam)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1) if (rowsUpdated != 1)
{ {
...@@ -660,6 +661,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr ...@@ -660,6 +661,7 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.SINGLEREFERENCE_User, r.getObject ("user_id")); oneit_sec_user_extensionPSet.setAttrib(CompanyUser.SINGLEREFERENCE_User, r.getObject ("user_id"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.SINGLEREFERENCE_Company, r.getObject ("company_id")); oneit_sec_user_extensionPSet.setAttrib(CompanyUser.SINGLEREFERENCE_Company, r.getObject ("company_id"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.SINGLEREFERENCE_DefaultHiringTeam, r.getObject ("default_hiring_team_id"));
} }
...@@ -676,10 +678,10 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr ...@@ -676,10 +678,10 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
{ {
executeStatement (sqlMgr, executeStatement (sqlMgr,
"INSERT INTO {PREFIX}oneit_sec_user_extension " + "INSERT INTO {PREFIX}oneit_sec_user_extension " +
" (forgot_password_mail_send_date, forgot_password_key, role_type, roles, phone, verification_mail_send_date, verification_key, is_account_verified, is_email_changed, user_id, company_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE, object_TYPE) " + " (forgot_password_mail_send_date, forgot_password_key, role_type, roles, phone, verification_mail_send_date, verification_key, is_account_verified, is_email_changed, user_id, company_id, default_hiring_team_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE, object_TYPE) " +
"VALUES " + "VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", ?)", " (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", ?)",
CollectionUtils.listEntry (HELPER_ForgotPasswordMailSendDate.getForSQL(dummyForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordMailSendDate))).listEntry (HELPER_ForgotPasswordKey.getForSQL(dummyForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordKey))).listEntry (HELPER_Role.getForSQL(dummyRole, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Role))).listEntry (HELPER_Roles.getForSQL(dummyRoles, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Roles))).listEntry (HELPER_Phone.getForSQL(dummyPhone, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Phone))).listEntry (HELPER_VerificationMailSendDate.getForSQL(dummyVerificationMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationMailSendDate))).listEntry (HELPER_VerificationKey.getForSQL(dummyVerificationKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationKey))).listEntry (HELPER_IsAccountVerified.getForSQL(dummyIsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsAccountVerified))).listEntry (HELPER_IsEmailChanged.getForSQL(dummyIsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsEmailChanged))) .listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_User)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_Company)))) .listEntry (objectID.longID ()).listEntry (context.getTag (obj)).toList().toArray()); CollectionUtils.listEntry (HELPER_ForgotPasswordMailSendDate.getForSQL(dummyForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordMailSendDate))).listEntry (HELPER_ForgotPasswordKey.getForSQL(dummyForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_ForgotPasswordKey))).listEntry (HELPER_Role.getForSQL(dummyRole, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Role))).listEntry (HELPER_Roles.getForSQL(dummyRoles, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Roles))).listEntry (HELPER_Phone.getForSQL(dummyPhone, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_Phone))).listEntry (HELPER_VerificationMailSendDate.getForSQL(dummyVerificationMailSendDate, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationMailSendDate))).listEntry (HELPER_VerificationKey.getForSQL(dummyVerificationKey, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_VerificationKey))).listEntry (HELPER_IsAccountVerified.getForSQL(dummyIsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsAccountVerified))).listEntry (HELPER_IsEmailChanged.getForSQL(dummyIsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_IsEmailChanged))) .listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_User)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (CompanyUser.SINGLEREFERENCE_DefaultHiringTeam)))) .listEntry (objectID.longID ()).listEntry (context.getTag (obj)).toList().toArray());
oneit_sec_user_extensionPSet.setStatus (PersistentSetStatus.PROCESSED); oneit_sec_user_extensionPSet.setStatus (PersistentSetStatus.PROCESSED);
} }
......
package performa.orm;
import oneit.objstore.ObjectStatus;
import oneit.objstore.ValidationContext;
import oneit.utils.StringUtils;
public class HiringTeam extends BaseHiringTeam
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public HiringTeam ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
@Override
public void validate(ValidationContext context)
{
if(getStatus() != ObjectStatus.NEW)
{
context.check(getHiringTeamType() != null , this, FIELD_HiringTeamType, "mandatory");
}
super.validate(context);
}
@Override
public String getToString()
{
return StringUtils.subNulls(getHiringTeamName(), super.getToString());
}
}
\ 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="HiringTeam" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<IMPORT value="performa.orm.types.TimeZone"/>
<IMPORT value="oneit.business.shopping.orm.*"/>
<MULTIPLEREFERENCE name="Users" type="CompanyUserHiringTeamLink" backreferenceName="HiringTeam" />
<!-- <MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="HiringTeam" />-->
<TABLE name="tl_hiring_team" tablePrefix="object">
<ATTRIB name="HiringTeamName" type="String" dbcol="hiring_team_name" mandatory="true" length="100" />
<ATTRIB name="HiringTeamLogo" type="BinaryContent" dbcol="hiring_team_logo" mandatory="false" binaryHandler="loggedin" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE" />
<ATTRIB name="HiringTeamType" type="HiringTeamType" dbcol="hiring_team_type" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="Industry" type="Industry" dbcol="industry" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="TimeZone" type="TimeZone" dbcol="time_zone" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="State" type="State" dbcol="state" mandatory="false" defaultValue="State.WA" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="Country" type="Countries" dbcol="country" mandatory="false" defaultValue="Countries.AU" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="PostCode" type="String" dbcol="post_code" mandatory="false" length="10"/>
<ATTRIB name="City" type="String" dbcol="city" mandatory="false" length="100"/>
<ATTRIB name="HasClientSupport" type="Boolean" dbcol="has_client_support" mandatory="false" defaultValue="Boolean.FALSE"/>
<ATTRIB name="ManageOwnBilling" type="Boolean" dbcol="manage_own_billing" mandatory="false" defaultValue="Boolean.TRUE"/>
<ATTRIB name="StripeReference" type="String" dbcol="stripe_reference" length="100" />
<ATTRIB name="StripeSubscription" type="String" dbcol="stripe_subscription" length="100" />
<ATTRIB name="NameOnCard" type="String" dbcol="name_on_card" length="100" />
<ATTRIB name="CardPostCode" type="String" dbcol="card_post_code" length="10" />
<ATTRIB name="CardID" type="String" dbcol="card_id" length="100" />
<ATTRIB name="PlanRenewedOn" type="Date" dbcol="plan_renewed_on" mandatory="false" />
<ATTRIB name="UsedCredits" type="Integer" dbcol="used_credits" />
<SINGLEREFERENCE name="Company" type="Company" dbcol="company_id" mandatory="true" backreferenceName="HiringTeams" />
<SINGLEREFERENCE name="BillingTeam" type="HiringTeam" dbcol="billing_team_id" mandatory="false" />
<SINGLEREFERENCE name="AddedByUser" type="CompanyUser" dbcol="added_by_user_id" mandatory="true" />
<SINGLEREFERENCE name="PaymentPlan" type="PaymentPlan" dbcol="payment_plan_id" mandatory="false" />
</TABLE>
<SEARCH type="All" paramFilter="tl_hiring_team.object_id is not null" >
</SEARCH>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
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 performa.orm.types.*;
import performa.orm.types.TimeZone;
import oneit.business.shopping.orm.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
{
private static final LoggingArea HiringTeamPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "HiringTeam");
// Private attributes corresponding to business object data
private String dummyHiringTeamName;
private BinaryContent dummyHiringTeamLogo;
private HiringTeamType dummyHiringTeamType;
private Industry dummyIndustry;
private TimeZone dummyTimeZone;
private State dummyState;
private Countries dummyCountry;
private String dummyPostCode;
private String dummyCity;
private Boolean dummyHasClientSupport;
private Boolean dummyManageOwnBilling;
private String dummyStripeReference;
private String dummyStripeSubscription;
private String dummyNameOnCard;
private String dummyCardPostCode;
private String dummyCardID;
private Date dummyPlanRenewedOn;
private Integer dummyUsedCredits;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_HiringTeamName = DefaultAttributeHelper.INSTANCE;
private static final BLOBAttributeHelper HELPER_HiringTeamLogo = BLOBAttributeHelper.INSTANCE;
private static final EnumeratedAttributeHelper HELPER_HiringTeamType = new EnumeratedAttributeHelper (HiringTeamType.FACTORY_HiringTeamType);
private static final EnumeratedAttributeHelper HELPER_Industry = new EnumeratedAttributeHelper (Industry.FACTORY_Industry);
private static final EnumeratedAttributeHelper HELPER_TimeZone = new EnumeratedAttributeHelper (TimeZone.FACTORY_TimeZone);
private static final EnumeratedAttributeHelper HELPER_State = new EnumeratedAttributeHelper (State.FACTORY_State);
private static final EnumeratedAttributeHelper HELPER_Country = new EnumeratedAttributeHelper (Countries.FACTORY_Countries);
private static final DefaultAttributeHelper HELPER_PostCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_City = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_HasClientSupport = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ManageOwnBilling = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_StripeReference = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_StripeSubscription = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_NameOnCard = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_CardPostCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_CardID = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_PlanRenewedOn = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_UsedCredits = DefaultAttributeHelper.INSTANCE;
public HiringTeamPersistenceMgr ()
{
dummyHiringTeamName = (String)(HELPER_HiringTeamName.initialise (dummyHiringTeamName));
dummyHiringTeamLogo = (BinaryContent)(HELPER_HiringTeamLogo.initialise (dummyHiringTeamLogo));
dummyHiringTeamType = (HiringTeamType)(HELPER_HiringTeamType.initialise (dummyHiringTeamType));
dummyIndustry = (Industry)(HELPER_Industry.initialise (dummyIndustry));
dummyTimeZone = (TimeZone)(HELPER_TimeZone.initialise (dummyTimeZone));
dummyState = (State)(HELPER_State.initialise (dummyState));
dummyCountry = (Countries)(HELPER_Country.initialise (dummyCountry));
dummyPostCode = (String)(HELPER_PostCode.initialise (dummyPostCode));
dummyCity = (String)(HELPER_City.initialise (dummyCity));
dummyHasClientSupport = (Boolean)(HELPER_HasClientSupport.initialise (dummyHasClientSupport));
dummyManageOwnBilling = (Boolean)(HELPER_ManageOwnBilling.initialise (dummyManageOwnBilling));
dummyStripeReference = (String)(HELPER_StripeReference.initialise (dummyStripeReference));
dummyStripeSubscription = (String)(HELPER_StripeSubscription.initialise (dummyStripeSubscription));
dummyNameOnCard = (String)(HELPER_NameOnCard.initialise (dummyNameOnCard));
dummyCardPostCode = (String)(HELPER_CardPostCode.initialise (dummyCardPostCode));
dummyCardID = (String)(HELPER_CardID.initialise (dummyCardID));
dummyPlanRenewedOn = (Date)(HELPER_PlanRenewedOn.initialise (dummyPlanRenewedOn));
dummyUsedCredits = (Integer)(HELPER_UsedCredits.initialise (dummyUsedCredits));
}
private String SELECT_COLUMNS = "{PREFIX}tl_hiring_team.object_id as id, {PREFIX}tl_hiring_team.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_hiring_team.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_hiring_team.hiring_team_name, {PREFIX}tl_hiring_team.hiring_team_logo, {PREFIX}tl_hiring_team.hiring_team_type, {PREFIX}tl_hiring_team.industry, {PREFIX}tl_hiring_team.time_zone, {PREFIX}tl_hiring_team.state, {PREFIX}tl_hiring_team.country, {PREFIX}tl_hiring_team.post_code, {PREFIX}tl_hiring_team.city, {PREFIX}tl_hiring_team.has_client_support, {PREFIX}tl_hiring_team.manage_own_billing, {PREFIX}tl_hiring_team.stripe_reference, {PREFIX}tl_hiring_team.stripe_subscription, {PREFIX}tl_hiring_team.name_on_card, {PREFIX}tl_hiring_team.card_post_code, {PREFIX}tl_hiring_team.card_id, {PREFIX}tl_hiring_team.plan_renewed_on, {PREFIX}tl_hiring_team.used_credits, {PREFIX}tl_hiring_team.company_id, {PREFIX}tl_hiring_team.billing_team_id, {PREFIX}tl_hiring_team.added_by_user_id, {PREFIX}tl_hiring_team.payment_plan_id, 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, HiringTeam.REFERENCE_HiringTeam);
if (objectToReturn instanceof HiringTeam)
{
LogMgr.log (HiringTeamPersistence, 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 HiringTeam");
}
}
PersistentSet tl_hiring_teamPSet = allPSets.getPersistentSet(id, "tl_hiring_team", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !tl_hiring_teamPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_HiringTeamName)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_HiringTeamLogo)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_HiringTeamType)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_Industry)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_TimeZone)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_State)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_Country)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_PostCode)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_City)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_HasClientSupport)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_ManageOwnBilling)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_StripeReference)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_StripeSubscription)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_NameOnCard)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_CardPostCode)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_CardID)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_PlanRenewedOn)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_UsedCredits)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.SINGLEREFERENCE_Company)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.SINGLEREFERENCE_BillingTeam)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.SINGLEREFERENCE_AddedByUser)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.SINGLEREFERENCE_PaymentPlan))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (HiringTeamPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
HiringTeam result = new HiringTeam ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_hiring_team " +
"WHERE " + SELECT_JOINS + "{PREFIX}tl_hiring_team.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 if (refName.equals (HiringTeam.SINGLEREFERENCE_Company))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_hiring_team " +
"WHERE " + SELECT_JOINS + "company_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
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 tl_hiring_teamPSet = allPSets.getPersistentSet(objectID, "tl_hiring_team");
if (tl_hiring_teamPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_hiring_teamPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_hiring_team " +
"SET hiring_team_name = ?, hiring_team_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, manage_own_billing = ?, stripe_reference = ?, stripe_subscription = ?, name_on_card = ?, card_post_code = ?, card_id = ?, plan_renewed_on = ?, used_credits = ?, company_id = ? , billing_team_id = ? , added_by_user_id = ? , payment_plan_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_hiring_team.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_HiringTeamName.getForSQL(dummyHiringTeamName, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamName))).listEntry (HELPER_HiringTeamLogo.getForSQL(dummyHiringTeamLogo, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TimeZone))).listEntry (HELPER_State.getForSQL(dummyState, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasClientSupport))).listEntry (HELPER_ManageOwnBilling.getForSQL(dummyManageOwnBilling, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_ManageOwnBilling))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeSubscription))).listEntry (HELPER_NameOnCard.getForSQL(dummyNameOnCard, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_NameOnCard))).listEntry (HELPER_CardPostCode.getForSQL(dummyCardPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardPostCode))).listEntry (HELPER_CardID.getForSQL(dummyCardID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardID))).listEntry (HELPER_PlanRenewedOn.getForSQL(dummyPlanRenewedOn, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanRenewedOn))).listEntry (HELPER_UsedCredits.getForSQL(dummyUsedCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_UsedCredits))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_BillingTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_PaymentPlan)))).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}tl_hiring_team 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[] { "tl_hiring_team", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (HiringTeamPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "tl_hiring_team");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:tl_hiring_team for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (HiringTeamPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_hiring_teamPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (HiringTeamPersistence, 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 tl_hiring_teamPSet = allPSets.getPersistentSet(objectID, "tl_hiring_team");
LogMgr.log (HiringTeamPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (tl_hiring_teamPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_hiring_teamPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}tl_hiring_team " +
"WHERE tl_hiring_team.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}tl_hiring_team WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "tl_hiring_team");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:tl_hiring_team for row:" + objectID;
LogMgr.log (HiringTeamPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
tl_hiring_teamPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, HiringTeam> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (HiringTeam.REFERENCE_HiringTeam.getObjectIDSpace (), r.getLong ("id"));
HiringTeam 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, HiringTeam.REFERENCE_HiringTeam);
if (cachedElement instanceof HiringTeam)
{
LogMgr.log (HiringTeamPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (HiringTeam)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a HiringTeam");
}
}
else
{
PersistentSet tl_hiring_teamPSet = allPSets.getPersistentSet(objectID, "tl_hiring_team", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new HiringTeam ();
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 (HiringTeamPersistence, 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}tl_hiring_team " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (HiringTeam.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_hiring_team.object_id is not null
String preFilter = "(tl_hiring_team.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_hiring_team " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal search type:" + searchType);
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet tl_hiring_teamPSet = allPSets.getPersistentSet(objectID, "tl_hiring_team", PersistentSetStatus.FETCHED);
// Object Modified
tl_hiring_teamPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
tl_hiring_teamPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_HiringTeamName, HELPER_HiringTeamName.getFromRS(dummyHiringTeamName, r, "hiring_team_name"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_HiringTeamLogo, HELPER_HiringTeamLogo.getFromRS(dummyHiringTeamLogo, r, "hiring_team_logo"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_HiringTeamType, HELPER_HiringTeamType.getFromRS(dummyHiringTeamType, r, "hiring_team_type"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_Industry, HELPER_Industry.getFromRS(dummyIndustry, r, "industry"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_TimeZone, HELPER_TimeZone.getFromRS(dummyTimeZone, r, "time_zone"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_State, HELPER_State.getFromRS(dummyState, r, "state"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_Country, HELPER_Country.getFromRS(dummyCountry, r, "country"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_PostCode, HELPER_PostCode.getFromRS(dummyPostCode, r, "post_code"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_City, HELPER_City.getFromRS(dummyCity, r, "city"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_HasClientSupport, HELPER_HasClientSupport.getFromRS(dummyHasClientSupport, r, "has_client_support"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_ManageOwnBilling, HELPER_ManageOwnBilling.getFromRS(dummyManageOwnBilling, r, "manage_own_billing"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_StripeReference, HELPER_StripeReference.getFromRS(dummyStripeReference, r, "stripe_reference"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_StripeSubscription, HELPER_StripeSubscription.getFromRS(dummyStripeSubscription, r, "stripe_subscription"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_NameOnCard, HELPER_NameOnCard.getFromRS(dummyNameOnCard, r, "name_on_card"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_CardPostCode, HELPER_CardPostCode.getFromRS(dummyCardPostCode, r, "card_post_code"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_CardID, HELPER_CardID.getFromRS(dummyCardID, r, "card_id"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_PlanRenewedOn, HELPER_PlanRenewedOn.getFromRS(dummyPlanRenewedOn, r, "plan_renewed_on"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_UsedCredits, HELPER_UsedCredits.getFromRS(dummyUsedCredits, r, "used_credits"));
tl_hiring_teamPSet.setAttrib(HiringTeam.SINGLEREFERENCE_Company, r.getObject ("company_id"));
tl_hiring_teamPSet.setAttrib(HiringTeam.SINGLEREFERENCE_BillingTeam, r.getObject ("billing_team_id"));
tl_hiring_teamPSet.setAttrib(HiringTeam.SINGLEREFERENCE_AddedByUser, r.getObject ("added_by_user_id"));
tl_hiring_teamPSet.setAttrib(HiringTeam.SINGLEREFERENCE_PaymentPlan, r.getObject ("payment_plan_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet tl_hiring_teamPSet = allPSets.getPersistentSet(objectID, "tl_hiring_team");
if (tl_hiring_teamPSet.getStatus () != PersistentSetStatus.PROCESSED &&
tl_hiring_teamPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_hiring_team " +
" (hiring_team_name, hiring_team_logo, hiring_team_type, industry, time_zone, state, country, post_code, city, has_client_support, manage_own_billing, stripe_reference, stripe_subscription, name_on_card, card_post_code, card_id, plan_renewed_on, used_credits, company_id, billing_team_id, added_by_user_id, payment_plan_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_HiringTeamName.getForSQL(dummyHiringTeamName, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamName))).listEntry (HELPER_HiringTeamLogo.getForSQL(dummyHiringTeamLogo, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TimeZone))).listEntry (HELPER_State.getForSQL(dummyState, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasClientSupport))).listEntry (HELPER_ManageOwnBilling.getForSQL(dummyManageOwnBilling, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_ManageOwnBilling))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeSubscription))).listEntry (HELPER_NameOnCard.getForSQL(dummyNameOnCard, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_NameOnCard))).listEntry (HELPER_CardPostCode.getForSQL(dummyCardPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardPostCode))).listEntry (HELPER_CardID.getForSQL(dummyCardID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardID))).listEntry (HELPER_PlanRenewedOn.getForSQL(dummyPlanRenewedOn, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanRenewedOn))).listEntry (HELPER_UsedCredits.getForSQL(dummyUsedCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_UsedCredits))) .listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_BillingTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_PaymentPlan)))) .listEntry (objectID.longID ()).toList().toArray());
tl_hiring_teamPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
...@@ -533,4 +533,10 @@ public class Utils ...@@ -533,4 +533,10 @@ public class Utils
{ {
return PaymentPlan.SearchByMax().search(objTran); return PaymentPlan.SearchByMax().search(objTran);
} }
public static HiringTeam[] getHiringTeamsByUser(CompanyUser companyUser)
{
return companyUser.pipelineCompanyUser().toHiringTeams().toHiringTeam().uniqueVals().toArray(new HiringTeam[0]);
}
} }
\ No newline at end of file
...@@ -76,7 +76,8 @@ ...@@ -76,7 +76,8 @@
<NODE name="Config" factory="Participant" class="oneit.business.content.ArticleConfiguration"> <NODE name="Config" factory="Participant" class="oneit.business.content.ArticleConfiguration">
<INHERITS nodename="StandardJSP"/> <INHERITS nodename="StandardJSP"/>
<RenderMode name="Page" preIncludeJSP="extensions/adminportal/my_company.jsp"/> <RenderMode name="Page" preIncludeJSP="extensions/adminportal/hiring_teams.jsp"/>
<RenderMode name="HiringTeam" preIncludeJSP="extensions/adminportal/my_company.jsp"/>
<RenderMode name="ManagePlan" preIncludeJSP="extensions/adminportal/manage_plan.jsp"/> <RenderMode name="ManagePlan" preIncludeJSP="extensions/adminportal/manage_plan.jsp"/>
<RenderMode name="Billing" preIncludeJSP="extensions/adminportal/billing.jsp"/> <RenderMode name="Billing" preIncludeJSP="extensions/adminportal/billing.jsp"/>
<RenderMode name="ReplaceCard" preIncludeJSP="extensions/adminportal/replace_card.jsp"/> <RenderMode name="ReplaceCard" preIncludeJSP="extensions/adminportal/replace_card.jsp"/>
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
Debug.assertion(company != null, "Invalid company user in admin portal"); Debug.assertion(company != null, "Invalid company user in admin portal");
HiringTeam hiringTeam = company.getDefaultHiringTeam();
Debug.assertion(hiringTeam != null, "No Hiring Team added in admin portal");
CompanyUser companyUser = company.getAddedByUser(); CompanyUser companyUser = company.getAddedByUser();
SecUser secUser = companyUser.getUser(); SecUser secUser = companyUser.getUser();
Integer pageNumber = 1; Integer pageNumber = 1;
...@@ -41,13 +45,13 @@ ...@@ -41,13 +45,13 @@
<% <%
FormTag jobForm = FormTag.getActiveFormTag(request); FormTag jobForm = FormTag.getActiveFormTag(request);
FormBuilder formBuilder = jobForm.getFormBuilder(); FormBuilder formBuilder = jobForm.getFormBuilder();
String optionKey = WebUtils.getInputKey(request, company, Company.FIELD_HiringTeamType); String optionKey = WebUtils.getInputKey(request, hiringTeam, HiringTeam.FIELD_HiringTeamType);
String formValue = formBuilder.fieldValue (optionKey, company.getHiringTeamType() == null ? "" : company.getHiringTeamType().getName()); String formValue = formBuilder.fieldValue (optionKey, hiringTeam.getHiringTeamType() == null ? "" : hiringTeam.getHiringTeamType().getName());
for(HiringTeamType hiringTeamType : HiringTeamType.getHiringTeamTypeArray()) for(HiringTeamType hiringTeamType : HiringTeamType.getHiringTeamTypeArray())
{ {
boolean isSelected = CollectionUtils.equals(formValue, hiringTeamType.getName()); boolean isSelected = CollectionUtils.equals(formValue, hiringTeamType.getName());
String hiringTeamTypeId = String.valueOf(company.getID().longID()) + "_hiringteamtype_" + hiringTeamType.getName(); String hiringTeamTypeId = String.valueOf(hiringTeam.getID().longID()) + "_hiringteamtype_" + hiringTeamType.getName();
String selected = isSelected ? "checked" : ""; String selected = isSelected ? "checked" : "";
String activeClass = isSelected ? "active" : ""; String activeClass = isSelected ? "active" : "";
%> %>
...@@ -64,12 +68,12 @@ ...@@ -64,12 +68,12 @@
<div class="form-group"> <div class="form-group">
<label><oneit:label GUIName="Industry" /></label> <label><oneit:label GUIName="Industry" /></label>
<oneit:ormEnum obj="<%= company %>" attributeName="Industry" cssClass="form-control"/> <oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Industry" cssClass="form-control"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label><oneit:label GUIName="Time zone" /></label> <label><oneit:label GUIName="Time zone" /></label>
<oneit:ormEnum obj="<%= company %>" attributeName="TimeZone" cssClass="form-control"/> <oneit:ormEnum obj="<%= hiringTeam %>" attributeName="TimeZone" cssClass="form-control"/>
</div> </div>
</div> </div>
......
<%@ page extends="oneit.servlets.jsp.JSPInclude" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%@ page import="oneit.utils.filter.CollectionFilter"%>
<oneit:dynIncluded>
<%
String currentPage = WebUtils.getArticleByShortCut(process.getTransaction(), WebUtils.MY_COMPANY).getLink(request);
String hiringTeamPage = WebUtils.getSamePageInRenderMode(request, "Page");
ObjectTransaction objTran = process.getTransaction ();
SecUser secUser = SecUser.getTXUser(objTran);
Company company = (Company) process.getAttribute("Company");
CompanyUser comUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
UserSortOption userSortOpt = (UserSortOption) process.getAttribute("UserSortOption");
Collection<CompanyUser> companyUsers = (Collection<CompanyUser>) process.getAttribute("CompanyUsers");
Collection pendingUsers = (Collection<CompanyUser>) process.getAttribute("PendingUsers");
if(company==null)
{
company = comUser.getCompany();
process.setAttribute("Company", company);
}
if(companyUsers == null || pendingUsers == null)
{
companyUsers = CollectionFilter.filter(company.getUsersSet(), CompanyUser.SearchByAll().andIsAccountVerified(new EqualsFilter<>(Boolean.TRUE)));
pendingUsers = CollectionFilter.filter(company.getUsersSet(), CompanyUser.SearchByAll().andIsAccountVerified(new NotEqualsFilter<>(Boolean.TRUE)));
process.setAttribute("CompanyUsers", companyUsers);
process.setAttribute("PendingUsers", pendingUsers);
}
if( request.getParameter("UserSortOption") != null)
{
userSortOpt = UserSortOption.forName((String) request.getParameter("UserSortOption"));
}
if(userSortOpt == null)
{
userSortOpt = UserSortOption.ALPHA_A_Z;
}
process.setAttribute("UserSortOption", userSortOpt);
Collection<CompanyUser> sortedCompanyUsers = Utils.getUsersSorted(companyUsers, userSortOpt);
Collection<CompanyUser> sortedPendingUsers = Utils.getUsersSorted(pendingUsers, userSortOpt);
company.setRoleType(RoleType.STANDARD);
%>
<oneit:form name="listHiringTeams" method="post" enctype="multipart/form-data">
<div class="dashboard-content-area second-part">
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="eq-justify-content">
<div class="manage-user-left">
<div class="jobs-list-shorting">
<div class="d-job-title all-jobs-title">Hiring Teams</div>
<div class="shorting-dropdown">
<span class="order-label">order by</span>
<select class="form-control" onChange="location=this.value">
<%
for (UserSortOption sortOption : UserSortOption.getUserSortOptionArray())
{
String optionLink = hiringTeamPage + "&UserSortOption=" + sortOption.getName() ;
%>
<option <%= (userSortOpt != null && userSortOpt == sortOption ? "selected" : "" )%> value="<%= optionLink %>">
<oneit:toString value="<%= sortOption.getDescription() %>" mode="EscapeHTML"/>
</option>
<%
}
%>
</select>
</div>
</div>
<div class="main-manage-userlist">
<%
for(HiringTeam hiringTeam : company.getHiringTeamsSet())
{
%>
<div class="user-list-row">
<div class="m-user-left">
<!--TODO: add hiring team icon-->
<div class="m-user-icon"><img src="images/user-list-icon.png"></div>
<div class="m-user-info">
<div class="m-user-name">
<oneit:toString value="<%= hiringTeam.getHiringTeamName() %>" mode="EscapeHTML" />
</div>
<div class="m-user-email">
Owner: <oneit:toString value="<%= hiringTeam.getAddedByUser() %>" mode="EscapeHTML" />
</div>
</div>
</div>
</div>
<%
}
%>
</div>
</div>
<div class="manage-user-right">
<div class="sidebar-title">
Add Hiring Team
</div>
<div class="form-group">
<label><oneit:label GUIName="Hiring Team Name" /></label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="HiringTeamName" cssClass="form-control" style="text-transform: lowercase"/>
</div>
<div class="form-group">
<label><oneit:label GUIName="Team Owner/Admin" /></label>
<div class="wider-select">
<tagfile:ormsingleasso_select obj="<%= company %>" assocName="Owner" options="<%= companyUsers.toArray(new CompanyUser[0]) %>"/>
</div>
</div>
<div class="form-group">
<label><oneit:label GUIName="Billing" /></label>
<div class="styled_checkboxes">
<div class="checkbox checkbox-primary">
<oneit:ormInput obj="<%= company %>" id="manage-own-billing" attributeName="ManageOwnBilling" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="company.showTeamManagesOwnBilling() ? 'checked': 'unchecked'" company="<%= company %>">
<label for="manage-own-billing">
<oneit:ormlabel obj="<%= company %>" field="ManageOwnBilling" />
</label>
</oneit:recalcClass>
</div>
</div>
</div>
<div class="form-group">
<label><oneit:label GUIName="Select Billing Team" /></label>
<div class="wider-select">
<tagfile:ormsingleasso_select obj="<%= company %>" assocName="BillingTeam" options="<%= company.getHiringTeamsSet().toArray(new HiringTeam[0]) %>"/>
</div>
</div>
<oneit:button value="Add Team" name="sendUserInvites" cssClass="btn btn-invite"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", currentPage)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry(NotificationUtils.NOTIFICATION_MSG_PARAM, "invitationSent")
.toMap() %>" />
</div>
</div>
</div>
</oneit:form>
</oneit:dynIncluded>
...@@ -37,3 +37,4 @@ Company.CompanyLogo = Logo ...@@ -37,3 +37,4 @@ Company.CompanyLogo = Logo
Company.HiringTeamType = Hiring Team Company.HiringTeamType = Hiring Team
Company.CompanyName = Hiring Team Name Company.CompanyName = Hiring Team Name
Company.PaymentPlan = Payment Plan Company.PaymentPlan = Payment Plan
Company.ManageOwnBilling = Team manages its own billing
...@@ -98,6 +98,13 @@ ...@@ -98,6 +98,13 @@
<label><oneit:label GUIName="Phone" /></label> <label><oneit:label GUIName="Phone" /></label>
<oneit:ormInput obj="<%= companyUser %>" type="text" attributeName="Phone" cssClass="form-control" /> <oneit:ormInput obj="<%= companyUser %>" type="text" attributeName="Phone" cssClass="form-control" />
</div> </div>
<div class="form-group">
<label><oneit:label GUIName="Default Hiring Team"/></label>
<div class="wider-select">
<tagfile:ormsingleasso_select obj="<%= companyUser %>" assocName="DefaultHiringTeam" options="<%= Utils.getHiringTeamsByUser(companyUser) %>"/>
</div>
</div>
<div class="text-center form-group"> <div class="text-center form-group">
<oneit:button value="Save Updates" name="saveUserDetails" cssClass="btn btn-primary largeBtn" <oneit:button value="Save Updates" name="saveUserDetails" cssClass="btn btn-primary largeBtn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
......
...@@ -17,13 +17,21 @@ ...@@ -17,13 +17,21 @@
SecUser secUser = null; SecUser secUser = null;
CompanyUser companyUser = company.getAddedByUser(); CompanyUser companyUser = company.getAddedByUser();
if(companyUser==null) if(companyUser == null)
{ {
secUser = SecUser.createSecUser(objTran); secUser = SecUser.createSecUser(objTran);
companyUser = secUser.getExtensionOrCreate(CompanyUser.REFERENCE_CompanyUser); companyUser = secUser.getExtensionOrCreate(CompanyUser.REFERENCE_CompanyUser);
company.setAddedByUser(companyUser); company.setAddedByUser(companyUser);
companyUser.setCompany(company); companyUser.setCompany(company);
HiringTeam hiringTeam = company.getHiringTeamsAt(0);
hiringTeam.setAddedByUser(companyUser);
companyUser.setDefaultHiringTeam(hiringTeam);
CompanyUserHiringTeamLink link = CompanyUserHiringTeamLink.createCompanyUserHiringTeamLink(objTran);
link.setCompanyUser(companyUser);
link.setHiringTeam(hiringTeam);
} }
secUser = companyUser.getUser(); secUser = companyUser.getUser();
......
...@@ -24,6 +24,14 @@ ...@@ -24,6 +24,14 @@
company.setAddedByUser(companyUser); company.setAddedByUser(companyUser);
companyUser.setCompany(company); companyUser.setCompany(company);
HiringTeam hiringTeam = company.getHiringTeamsAt(0);
hiringTeam.setAddedByUser(companyUser);
companyUser.setDefaultHiringTeam(hiringTeam);
CompanyUserHiringTeamLink link = CompanyUserHiringTeamLink.createCompanyUserHiringTeamLink(objTran);
link.setCompanyUser(companyUser);
link.setHiringTeam(hiringTeam);
} }
secUser = companyUser.getUser(); secUser = companyUser.getUser();
......
<?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">oneit_sec_user_extension</tableName>
<column name="default_hiring_team_id" type="Long" length="11" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?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">tl_company_user_hiring_team_link</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="hiring_team_id" type="Long" length="11" nullable="true"/>
<column name="company_user_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_company_user_hiring_team_link" indexName="idx_tl_company_user_hiring_team_link_hiring_team_id" isUnique="false">
<column name="hiring_team_id"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_company_user_hiring_team_link" indexName="idx_tl_company_user_hiring_team_link_company_user_id" isUnique="false">
<column name="company_user_id"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?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">tl_hiring_team</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="hiring_team_name" type="String" nullable="false" length="100"/>
<column name="hiring_team_logo" type="BLOB" nullable="true"/>
<column name="hiring_team_type" type="String" nullable="true" length="200"/>
<column name="industry" type="String" nullable="true" length="200"/>
<column name="time_zone" type="String" nullable="true" length="200"/>
<column name="state" type="String" nullable="true" length="200"/>
<column name="country" type="String" nullable="true" length="200"/>
<column name="post_code" type="String" nullable="true" length="10"/>
<column name="city" type="String" nullable="true" length="100"/>
<column name="has_client_support" type="Boolean" nullable="true"/>
<column name="manage_own_billing" type="Boolean" nullable="true"/>
<column name="stripe_reference" type="String" nullable="true" length="100"/>
<column name="stripe_subscription" type="String" nullable="true" length="100"/>
<column name="name_on_card" type="String" nullable="true" length="100"/>
<column name="card_post_code" type="String" nullable="true" length="10"/>
<column name="card_id" type="String" nullable="true" length="100"/>
<column name="plan_renewed_on" type="Date" nullable="true"/>
<column name="used_credits" type="Long" nullable="true"/>
<column name="company_id" type="Long" length="11" nullable="false"/>
<column name="billing_team_id" type="Long" length="11" nullable="true"/>
<column name="added_by_user_id" type="Long" length="11" nullable="false"/>
<column name="payment_plan_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_hiring_team" indexName="idx_tl_hiring_team_company_id" isUnique="false">
<column name="company_id"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
String verifyKey = request.getParameter("key"); String verifyKey = request.getParameter("key");
Boolean invalid = Boolean.TRUE; Boolean invalid = Boolean.TRUE;
if(id!=null && verifyKey !=null) if(id != null && verifyKey != null)
{ {
companyUser = CompanyUser.searchIdPin(transaction, Long.parseLong(id), verifyKey); companyUser = CompanyUser.searchIdPin(transaction, Long.parseLong(id), verifyKey);
if(companyUser!=null && companyUser.getIsAccountVerified()!=Boolean.TRUE) if(companyUser != null && companyUser.getIsAccountVerified() != Boolean.TRUE)
{ {
secUser = companyUser.getUser(); secUser = companyUser.getUser();
process.setAttribute("CompanyUser", companyUser); process.setAttribute("CompanyUser", companyUser);
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
SecUser logedInUser = SecUser.getTXUser(transaction); SecUser logedInUser = SecUser.getTXUser(transaction);
companyUser = logedInUser != null ? logedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser) : null; companyUser = logedInUser != null ? logedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser) : null;
if(logedInUser!=null if(logedInUser != null
&& logedInUser.hasRole(Utils.ROLE_CLIENT) && logedInUser.hasRole(Utils.ROLE_CLIENT)
&& companyUser!=null && companyUser != null
&& companyUser.getIsAccountVerified()!=Boolean.TRUE) && companyUser.getIsAccountVerified() != Boolean.TRUE)
{ {
socialLogin = Boolean.TRUE; socialLogin = Boolean.TRUE;
invalid = Boolean.FALSE; invalid = Boolean.FALSE;
...@@ -51,10 +51,16 @@ ...@@ -51,10 +51,16 @@
response.sendRedirect(WebUtils.getArticleByShortCut(process.getTransaction(), WebUtils.ADMIN_HOME).getLink(request)); response.sendRedirect(WebUtils.getArticleByShortCut(process.getTransaction(), WebUtils.ADMIN_HOME).getLink(request));
} }
} }
Debug.assertion(companyUser != null, "Invalid CompanyUser in admin portal"); Debug.assertion(companyUser != null, "Invalid CompanyUser in admin portal");
process.setAttribute("Company", companyUser.getCompany()); Company company = companyUser.getCompany();
if(!invalid && CollectionUtils.equals(company.getAddedByUser(), companyUser))
{
}
process.setAttribute("Company", company);
%> %>
<oneit:script> <oneit:script>
<oneit:script src="/scripts/password_strength_lightweight.js"/> <oneit:script src="/scripts/password_strength_lightweight.js"/>
......
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