Commit d070edcb by chenith Committed by Harsh Shah

Implement client and company related business objects.

Replaced AdminUser ext by CompanyUser.
parent 159dfb4a
<?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_industry</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="NAME" type="String" nullable="false" length="200"/>
<column name="VALUE" type="String" nullable="false" length="200"/>
<column name="DESCRIPTION" type="String" nullable="true" length="200"/>
<column name="SORT_ORDER" type="Long" nullable="false"/>
<column name="DISABLED" type="Boolean" nullable="false"/>
</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_client</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="object_type" type="String" nullable="false" length="30"/>
<column name="company_name" type="String" nullable="false" length="100"/>
<column name="company_logo" type="BLOB" nullable="true"/>
<column name="email" type="String" nullable="true" length="100"/>
<column name="contact_name" type="String" nullable="true" length="100"/>
<column name="contact_surname" type="String" nullable="true" length="100"/>
<column name="phone" type="String" nullable="true" length="30"/>
<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="company_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_client" indexName="idx_tl_client_company_id" isUnique="false"><column name="company_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_company</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="object_type" type="String" nullable="false" length="30"/>
<column name="company_name" type="String" nullable="false" length="100"/>
<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="added_by_user_id" type="Long" length="11" nullable="false"/>
</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">oneit_sec_user_extension</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="object_type" type="String" nullable="false" length="30"/>
<column name="forgot_password_mail_send_date" type="Date" nullable="true"/>
<column name="forgot_password_key" type="String" nullable="true" length="10"/>
<column name="role_type" type="String" nullable="true" length="200"/>
<column name="phone" type="String" nullable="true" length="30"/>
<column name="user_id" type="Long" length="11" nullable="true"/>
<column name="company_id" type="Long" length="11" nullable="true"/>
</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_company_id" isUnique="false"><column name="company_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
......@@ -24,7 +24,8 @@
<column name="state" type="String" nullable="true" length="200"/>
<column name="country" type="String" nullable="true" length="200"/>
<column name="level_id" type="Long" length="11" nullable="false"/>
<column name="secuser_id" type="Long" length="11" nullable="true"/>
<column name="client_id" type="Long" length="11" nullable="true"/>
<column name="company_user_id" type="Long" length="11" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE tl_industry;
CREATE TABLE tl_industry (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
NAME varchar(200) NOT NULL,
VALUE varchar(200) NOT NULL,
DESCRIPTION varchar(200) NULL,
SORT_ORDER numeric(12) NOT NULL ,
DISABLED char(1) NOT NULL
);
ALTER TABLE tl_industry ADD
CONSTRAINT PK_tl_industry PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE tl_client;
CREATE TABLE tl_client (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
, object_type varchar(30) NOT NULL ,
company_name varchar(100) NOT NULL,
company_logo image NULL,
email varchar(100) NULL,
contact_name varchar(100) NULL,
contact_surname varchar(100) NULL,
phone varchar(30) NULL,
state varchar(200) NULL,
country varchar(200) NULL,
post_code varchar(10) NULL,
company_id numeric(12) NULL
);
ALTER TABLE tl_client ADD
CONSTRAINT PK_tl_client PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_client_company_id
ON tl_client (company_id);
-- DROP TABLE tl_Company;
CREATE TABLE tl_Company (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
, object_type varchar(30) NOT NULL ,
company_name varchar(100) NOT NULL,
hiring_team_type varchar(200) NULL,
industry varchar(200) NULL,
time_zone varchar(200) NULL,
added_by_user_id numeric(12) NOT NULL
);
ALTER TABLE tl_Company ADD
CONSTRAINT PK_tl_Company PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE oneit_sec_user_extension;
CREATE TABLE oneit_sec_user_extension (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
, object_type varchar(30) NOT NULL ,
forgot_password_mail_send_date datetime NULL,
forgot_password_key varchar(10) NULL,
role_type varchar(200) NULL,
phone varchar(30) NULL,
user_id numeric(12) NULL,
company_id numeric(12) NULL
);
ALTER TABLE oneit_sec_user_extension ADD
CONSTRAINT PK_oneit_sec_user_extension PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_oneit_sec_user_extension_user_id
ON oneit_sec_user_extension (user_id);
CREATE INDEX idx_oneit_sec_user_extension_company_id
ON oneit_sec_user_extension (company_id);
......@@ -24,7 +24,8 @@ CREATE TABLE tl_job (
state varchar(200) NULL,
country varchar(200) NULL,
level_id numeric(12) NOT NULL,
secuser_id numeric(12) NULL
client_id numeric(12) NULL,
company_user_id numeric(12) NULL
);
......
-- DROP TABLE tl_industry;
CREATE TABLE tl_industry (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
NAME varchar2(200) NOT NULL,
VALUE varchar2(200) NOT NULL,
DESCRIPTION varchar2(200) NULL,
SORT_ORDER number(12) NOT NULL ,
DISABLED char(1) NOT NULL
);
ALTER TABLE tl_industry ADD
CONSTRAINT PK_tl_industry PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE tl_client;
CREATE TABLE tl_client (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
, object_type varchar2(30) NOT NULL ,
company_name varchar2(100) NOT NULL,
company_logo blob NULL,
email varchar2(100) NULL,
contact_name varchar2(100) NULL,
contact_surname varchar2(100) NULL,
phone varchar2(30) NULL,
state varchar2(200) NULL,
country varchar2(200) NULL,
post_code varchar2(10) NULL,
company_id number(12) NULL
);
ALTER TABLE tl_client ADD
CONSTRAINT PK_tl_client PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_client_company_id
ON tl_client (company_id);
-- DROP TABLE tl_Company;
CREATE TABLE tl_Company (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
, object_type varchar2(30) NOT NULL ,
company_name varchar2(100) NOT NULL,
hiring_team_type varchar2(200) NULL,
industry varchar2(200) NULL,
time_zone varchar2(200) NULL,
added_by_user_id number(12) NOT NULL
);
ALTER TABLE tl_Company ADD
CONSTRAINT PK_tl_Company PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE oneit_sec_user_extension;
CREATE TABLE oneit_sec_user_extension (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
, object_type varchar2(30) NOT NULL ,
forgot_password_mail_send_date date NULL,
forgot_password_key varchar2(10) NULL,
role_type varchar2(200) NULL,
phone varchar2(30) NULL,
user_id number(12) NULL,
company_id number(12) NULL
);
ALTER TABLE oneit_sec_user_extension ADD
CONSTRAINT PK_oneit_sec_user_extension PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_oneit_sec_user_extension_user_id
ON oneit_sec_user_extension (user_id);
CREATE INDEX idx_oneit_sec_user_extension_company_id
ON oneit_sec_user_extension (company_id);
......@@ -25,7 +25,8 @@ CREATE TABLE tl_job (
state varchar2(200) NULL,
country varchar2(200) NULL,
level_id number(12) NOT NULL,
secuser_id number(12) NULL
client_id number(12) NULL,
company_user_id number(12) NULL
);
......
-- @AutoRun
-- drop table tl_industry;
CREATE TABLE tl_industry (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
NAME varchar(200) NOT NULL,
VALUE varchar(200) NOT NULL,
DESCRIPTION varchar(200) NULL,
SORT_ORDER numeric(12) NOT NULL ,
DISABLED char(1) NOT NULL
);
ALTER TABLE tl_industry ADD
CONSTRAINT pk_tl_industry PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- @AutoRun
-- drop table tl_client;
CREATE TABLE tl_client (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
, object_type varchar(30) NOT NULL ,
company_name varchar(100) NOT NULL,
company_logo bytea NULL,
email varchar(100) NULL,
contact_name varchar(100) NULL,
contact_surname varchar(100) NULL,
phone varchar(30) NULL,
state varchar(200) NULL,
country varchar(200) NULL,
post_code varchar(10) NULL,
company_id numeric(12) NULL
);
ALTER TABLE tl_client ADD
CONSTRAINT pk_tl_client PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_tl_client_company_id
ON tl_client (company_id);
-- @AutoRun
-- drop table tl_company;
CREATE TABLE tl_company (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
, object_type varchar(30) NOT NULL ,
company_name varchar(100) NOT NULL,
hiring_team_type varchar(200) NULL,
industry varchar(200) NULL,
time_zone varchar(200) NULL,
added_by_user_id numeric(12) NOT NULL
);
ALTER TABLE tl_company ADD
CONSTRAINT pk_tl_company PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- @AutoRun
-- drop table oneit_sec_user_extension;
CREATE TABLE oneit_sec_user_extension (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
, object_type varchar(30) NOT NULL ,
forgot_password_mail_send_date timestamp NULL,
forgot_password_key varchar(10) NULL,
role_type varchar(200) NULL,
phone varchar(30) NULL,
user_id numeric(12) NULL,
company_id numeric(12) NULL
);
ALTER TABLE oneit_sec_user_extension ADD
CONSTRAINT pk_oneit_sec_user_extension PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_oneit_sec_user_extension_user_id
ON oneit_sec_user_extension (user_id);
CREATE INDEX idx_oneit_sec_user_extension_company_id
ON oneit_sec_user_extension (company_id);
......@@ -25,7 +25,8 @@ CREATE TABLE tl_job (
state varchar(200) NULL,
country varchar(200) NULL,
level_id numeric(12) NOT NULL,
secuser_id numeric(12) NULL
client_id numeric(12) NULL,
company_user_id numeric(12) NULL
);
......
......@@ -18,7 +18,7 @@ import oneit.utils.transform.MapTransform;
import oneit.utils.transform.param.ErrorTransform;
import oneit.utils.transform.param.ORMTransform;
import oneit.utils.transform.param.PrefixCompoundTransform;
import performa.orm.AdminUser;
import performa.orm.CompanyUser;
public class ForgotPasswordFP extends SaveFP
......@@ -58,21 +58,21 @@ public class ForgotPasswordFP extends SaveFP
{
LogMgr.log(LOG, LogLevel.PROCESSING1, "Inside ForgotPasswordFP for send reset pasword link mail to ", email);
AdminUser adminUser = secUser.getExtensionOrCreate(AdminUser.REFERENCE_AdminUser);
CompanyUser companyUser = secUser.getExtensionOrCreate(CompanyUser.REFERENCE_CompanyUser);
if(adminUser.getForgotPasswordKey()==null)
if(companyUser.getForgotPasswordKey()==null)
{
String resetCode = new RandomStringGen().generateHumanAlphaNum(new Integer(DEFAULT_PASSWORD_LENGTH));
adminUser.setForgotPasswordKey(resetCode);
companyUser.setForgotPasswordKey(resetCode);
}
adminUser.setForgotPasswordMailSendDate(new Date());
companyUser.setForgotPasswordMailSendDate(new Date());
Map emailParams = CollectionUtils.mapEntry("resetcode", adminUser.getForgotPasswordKey())
Map emailParams = CollectionUtils.mapEntry("resetcode", companyUser.getForgotPasswordKey())
.mapEntry("url", LoopbackHTTP.getRemoteAccessURL()
+ "/extensions/adminportal/reset_password.jsp"
+ "?id=" + adminUser.getID()
+ "&key=" + adminUser.getForgotPasswordKey()).toMap();
+ "?id=" + companyUser.getID()
+ "&key=" + companyUser.getForgotPasswordKey()).toMap();
PrefixCompoundTransform compoundTransform = new PrefixCompoundTransform();
ObjectTransform defaultTransform = new MapTransform(emailParams);
......
......@@ -8,7 +8,7 @@ import oneit.security.SecUser;
import oneit.servlets.forms.*;
import oneit.servlets.process.*;
import oneit.utils.*;
import performa.orm.AdminUser;
import performa.orm.CompanyUser;
import performa.utils.Utils;
......@@ -21,13 +21,13 @@ public class ResetPasswordFP extends ORMProcessFormProcessor
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
SecUser user = (SecUser) process.getAttribute("SecUser");
AdminUser adminUser = user.getExtension(AdminUser.REFERENCE_AdminUser);
CompanyUser companyUser = user.getExtension(CompanyUser.REFERENCE_CompanyUser);
if(adminUser != null)
if(companyUser != null)
{
LogMgr.log(LOG, LogLevel.PROCESSING1, "Inside ResetPasswordFP for reset pasword to ", user);
adminUser.setForgotPasswordKey(null);
companyUser.setForgotPasswordKey(null);
}
return Utils.processSuccessfulLogin(process, submission, params, user);
......
<?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="AdminUser" package="performa.orm" superclass="SecUserExtension">
<IMPORT value="oneit.security.*" />
<TABLE name="oneit_sec_user_extension" tablePrefix="object" polymorphic="TRUE">
<ATTRIB name="ForgotPasswordMailSendDate" type="Date" dbcol="forgot_password_mail_send_date" />
<ATTRIB name="ForgotPasswordKey" type="String" dbcol="forgot_password_key" length="10"/>
<SINGLEREFERENCE name="User" type="SecUser" dbcol="user_id" backreferenceName="Extensions" inSuper='TRUE'/>
</TABLE>
<SEARCH type="All" paramFilter="oneit_sec_user_extension.object_id is not null" >
</SEARCH>
<SEARCH type="IdPin" paramFilter="oneit_sec_user_extension.object_id is not null" singleton="TRUE">
<PARAM name="ID" type="Long" paramFilter="object_id = ${ID} " />
<PARAM name="Pin" type="String" paramFilter="verification_key = ${Pin}" />
</SEARCH>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
import performa.orm.types.*;
import oneit.business.shopping.orm.*;
public class Client extends BaseClient
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public Client ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
<?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="Client" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<IMPORT value="oneit.business.shopping.orm.*"/>
<TABLE name="tl_client" tablePrefix="object" polymorphic="TRUE">
<ATTRIB name="CompanyName" type="String" dbcol="company_name" mandatory="true" length="100"/>
<ATTRIB name="CompanyLogo" type="BinaryContent" dbcol="company_logo" mandatory="false" binaryHandler="loggedin" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE" />
<ATTRIB name="Email" type="String" dbcol="email" mandatory="false" length="100" validators="Email" />
<ATTRIB name="ContactName" type="String" dbcol="contact_name" mandatory="false" length="100"/>
<ATTRIB name="ContactSurname" type="String" dbcol="contact_surname" mandatory="false" length="100"/>
<ATTRIB name="Phone" type="String" dbcol="phone" mandatory="false" length="30" />
<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"/>
<SINGLEREFERENCE name="Company" type="Company" dbcol="company_id" backreferenceName="Clients"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_client.object_id is not null">
</SEARCH>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
import performa.orm.types.*;
public class Company extends BaseCompany
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public Company ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
<?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="Company" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<IMPORT value="performa.orm.types.TimeZone"/>
<MULTIPLEREFERENCE name="Users" type="CompanyUser" backreferenceName="Company"/>
<MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="Company"/>
<TABLE name="tl_Company" tablePrefix="object" polymorphic="TRUE">
<ATTRIB name="CompanyName" type="String" dbcol="company_name" mandatory="true" length="100" />
<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"/>
<SINGLEREFERENCE name="AddedByUser" type="CompanyUser" dbcol="added_by_user_id" mandatory="true"/>
</TABLE>
<SEARCH type="All" paramFilter="tl_company.object_id is not null" >
</SEARCH>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import oneit.objstore.ObjectTransaction;
import oneit.security.SecUser;
import oneit.utils.CollectionUtils;
import oneit.utils.StringUtils;
import oneit.objstore.*;
import oneit.utils.*;
public class AdminUser extends BaseAdminUser
public class CompanyUser extends BaseCompanyUser
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public AdminUser ()
public CompanyUser ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
public static AdminUser getAdminUserForForgotPassword(ObjectTransaction transaction, String userIDStr, String code)
public static CompanyUser getCompanyUserForForgotPassword(ObjectTransaction transaction, String userIDStr, String code)
{
userIDStr = StringUtils.subBlanks(userIDStr);
code = StringUtils.subBlanks(code);
if(userIDStr != null && code!=null)
{
AdminUser adminUser = AdminUser.getAdminUserByID(transaction, Long.parseLong(userIDStr));
CompanyUser companyUser = CompanyUser.getCompanyUserByID(transaction, Long.parseLong(userIDStr));
if(adminUser != null && CollectionUtils.equals(adminUser.getForgotPasswordKey(), code))
if(companyUser != null && CollectionUtils.equals(companyUser.getForgotPasswordKey(), code))
{
return adminUser;
return companyUser;
}
}
......
<?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="CompanyUser" package="performa.orm" superclass="SecUserExtension">
<IMPORT value="oneit.security.*" />
<IMPORT value="performa.orm.types.*"/>
<TABLE name="oneit_sec_user_extension" tablePrefix="object" polymorphic="TRUE">
<ATTRIB name="ForgotPasswordMailSendDate" type="Date" dbcol="forgot_password_mail_send_date" />
<ATTRIB name="ForgotPasswordKey" type="String" dbcol="forgot_password_key" length="10"/>
<ATTRIB name="Role" type="RoleType" dbcol="role_type" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="Phone" type="String" dbcol="phone" mandatory="false" length="30" />
<SINGLEREFERENCE name="User" type="SecUser" dbcol="user_id" backreferenceName="Extensions" inSuper='TRUE'/>
<SINGLEREFERENCE name="Company" type="Company" dbcol="company_id" backreferenceName="Users"/>
</TABLE>
<SEARCH type="All" paramFilter="oneit_sec_user_extension.object_id is not null" >
</SEARCH>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -53,7 +53,11 @@ public class Job extends BaseJob
public void initAttribs() throws BusinessException
{
setRandomKey(RandomStringGen.getRandomStringGen().generateAlphaNum(4));
setSecUser(SecUser.getTXUser(getTransaction()));
//TODO: verify
SecUser txUser = SecUser.getTXUser(getTransaction());
setCompanyUser(txUser.getExtension(CompanyUser.REFERENCE_CompanyUser));
}
......
......@@ -46,9 +46,10 @@
<ATTRIB name="State" type="State" dbcol="state" defaultValue="State.WA" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="Country" type="Countries" dbcol="country" defaultValue="Countries.AU" attribHelper="EnumeratedAttributeHelper"/>
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_id" mandatory="true"/>
<SINGLEREFERENCE name="SecUser" type="SecUser" dbcol="secuser_id" />
<SINGLEREFERENCE name="Level" type="Level" dbcol="level_id" mandatory="true"/>
<SINGLEREFERENCE name="Client" type="Client" dbcol="client_id" />
<SINGLEREFERENCE name="CompanyUser" type="CompanyUser" dbcol="company_user_id" />
</TABLE>
<SEARCH type="All" paramFilter="tl_job.object_id is not null" orderBy="tl_job.object_id" />
......
package performa.orm.types;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
import oneit.appservices.dbenums.*;
public class BO_Industry extends BaseBO_Industry
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public BO_Industry ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class HiringTeamType extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_HiringTeamType = new HiringTeamTypeFactory();
public static final HiringTeamType T1 = new HiringTeamType ("T1", "T1", "T1", false);
private static final HiringTeamType[] allHiringTeamTypes =
new HiringTeamType[] { T1};
private static HiringTeamType[] getAllHiringTeamTypes ()
{
return allHiringTeamTypes;
}
private HiringTeamType (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allHiringTeamTypes);
static
{
defineAdditionalData ();
}
public boolean isEqual (HiringTeamType other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return HiringTeamType.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return HiringTeamType.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_HiringTeamType;
}
public static HiringTeamType forName (String name)
{
if (name == null) { return null; }
HiringTeamType[] all = getAllHiringTeamTypes();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static HiringTeamType forValue (String value)
{
if (value == null) { return null; }
HiringTeamType[] all = getAllHiringTeamTypes();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllHiringTeamTypes (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllHiringTeamTypes());
}
public static HiringTeamType[] getHiringTeamTypeArray ()
{
return (HiringTeamType[])getAllHiringTeamTypes().clone ();
}
public static void defineAdditionalData ()
{
}
static class HiringTeamTypeFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return HiringTeamType.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return HiringTeamType.forValue (name);
}
public Enumeration getAll ()
{
return HiringTeamType.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="HiringTeamType">
<VALUE name="T1" value="T1" description="T1"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<DB_ENUM name="Industry" package="performa.orm.types" table="tl_industry" supportsDisabled="true" reloadable="true">
</DB_ENUM>
</ROOT>
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class RoleType extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_RoleType = new RoleTypeFactory();
public static final RoleType ADMIN = new RoleType ("ADMIN", "ADMIN", "Admin", false);
public static final RoleType STANDARD = new RoleType ("STANDARD", "STANDARD", "Standard", false);
private static final RoleType[] allRoleTypes =
new RoleType[] { ADMIN,STANDARD};
private static RoleType[] getAllRoleTypes ()
{
return allRoleTypes;
}
private RoleType (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allRoleTypes);
static
{
defineAdditionalData ();
}
public boolean isEqual (RoleType other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return RoleType.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return RoleType.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_RoleType;
}
public static RoleType forName (String name)
{
if (name == null) { return null; }
RoleType[] all = getAllRoleTypes();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static RoleType forValue (String value)
{
if (value == null) { return null; }
RoleType[] all = getAllRoleTypes();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllRoleTypes (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllRoleTypes());
}
public static RoleType[] getRoleTypeArray ()
{
return (RoleType[])getAllRoleTypes().clone ();
}
public static void defineAdditionalData ()
{
}
static class RoleTypeFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return RoleType.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return RoleType.forValue (name);
}
public Enumeration getAll ()
{
return RoleType.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="RoleType">
<VALUE name="ADMIN" value="ADMIN" description="Admin"/>
<VALUE name="STANDARD" value="STANDARD" description="Standard"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class TimeZone extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_TimeZone = new TimeZoneFactory();
public static final TimeZone T1 = new TimeZone ("T1", "T1", "T1", false);
private static final TimeZone[] allTimeZones =
new TimeZone[] { T1};
private static TimeZone[] getAllTimeZones ()
{
return allTimeZones;
}
private TimeZone (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allTimeZones);
static
{
defineAdditionalData ();
}
public boolean isEqual (TimeZone other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return TimeZone.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return TimeZone.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_TimeZone;
}
public static TimeZone forName (String name)
{
if (name == null) { return null; }
TimeZone[] all = getAllTimeZones();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static TimeZone forValue (String value)
{
if (value == null) { return null; }
TimeZone[] all = getAllTimeZones();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllTimeZones (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllTimeZones());
}
public static TimeZone[] getTimeZoneArray ()
{
return (TimeZone[])getAllTimeZones().clone ();
}
public static void defineAdditionalData ()
{
}
static class TimeZoneFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return TimeZone.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return TimeZone.forValue (name);
}
public Enumeration getAll ()
{
return TimeZone.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="TimeZone">
<VALUE name="T1" value="T1" description="T1"/>
</CONSTANT>
</ROOT>
\ No newline at end of file
......@@ -25,7 +25,7 @@
</oneit:button>
</div>
<div class="off-name">
<span class="austr-post">Australia Post</span> by <oneit:toString value="<%= SecUserToNameTransform.INSTANCE.transform(job.getSecUser()) %>" mode="EscapeHTML"/><span class="ex-management">&bull;&nbsp;
<span class="austr-post">Australia Post</span> by <oneit:toString value="<%= job.getCompanyUser() %>" mode="EscapeHTML" nullValue=""/><span class="ex-management">&bull;&nbsp;
<oneit:toString value="<%= job.getLevel() %>" mode="EscapeHTML" />
</span>
</div>
......
......@@ -46,7 +46,8 @@
<div class="form-page-area">
<div class="create-job">
<%
Job[] jobs = Job.SearchByAll().andSecUser(new EqualsFilter<>(SecUser.getTXUser(transaction))).search(transaction);
SecUser txUser = SecUser.getTXUser(process.getTransaction());
Job[] jobs = Job.SearchByAll().andCompanyUser(new EqualsFilter<>(txUser.getExtension(CompanyUser.REFERENCE_CompanyUser))).search(transaction);
if(jobs.length > 0)
{
......
......@@ -28,8 +28,10 @@
if(jobs==null)
{
SecUser txUser = SecUser.getTXUser(objTran);
jobs = Job.SearchByAll().andJobStatus(new EqualsFilter<>(jobStatus))
.andSecUser(new EqualsFilter(SecUser.getTXUser(transaction)))
.andCompanyUser(new EqualsFilter<>(txUser.getExtension(CompanyUser.REFERENCE_CompanyUser)))
.search(transaction);
process.setAttribute(jobListName, jobs);
......
......@@ -9,7 +9,7 @@
//TODO: filter with Client;
SecUser secUser = SecUser.getTXUser(transaction);
Job[] jobs = Job.SearchByAll().andJobStatus(new EqualsFilter<>(JobStatus.OPEN))
.andSecUser(new EqualsFilter(secUser))
.andCompanyUser(new EqualsFilter(secUser.getExtension(CompanyUser.REFERENCE_CompanyUser)))
.search(transaction);
Article jobsArticle = WebUtils.getArticleByShortCut(transaction, WebUtils.JOBS);
......@@ -68,7 +68,7 @@
<div class="dash-count c-gray">
<%
Job[] filledJobs = Job.SearchByAll().andJobStatus(new EqualsFilter<>(JobStatus.FILLED))
.andSecUser(new EqualsFilter(SecUser.getTXUser(transaction)))
.andCompanyUser(new EqualsFilter<>(secUser.getExtension(CompanyUser.REFERENCE_CompanyUser)))
.search(transaction);
int filledCount = filledJobs != null ? filledJobs.length : 0;
......
......@@ -8,7 +8,7 @@
<%
ORMProcessState process = (ORMProcessState)ProcessDecorator.getDefaultProcess(request);
String adminUserID = (String) process.getAttribute("adminUserID"); //request.getParameter("id");
String companyUserID = (String) process.getAttribute("companyUserID"); //request.getParameter("id");
String forgotpasswordCode = (String) process.getAttribute("forgotpasswordCode"); //request.getParameter("key");
SecUser user = (SecUser) process.getAttribute("SecUser");
Article home = WebUtils.getArticleByShortCut(process.getTransaction(), WebUtils.ADMIN_HOME);
......@@ -16,8 +16,8 @@
if(request.getParameter("id")!=null)
{
adminUserID = request.getParameter("id");
process.setAttribute("adminUserID", adminUserID);
companyUserID = request.getParameter("id");
process.setAttribute("companyUserID", companyUserID);
}
if(request.getParameter("key")!=null)
......@@ -26,13 +26,13 @@
process.setAttribute("forgotpasswordCode", forgotpasswordCode);
}
if(StringUtils.subBlanks(adminUserID) != null)
if(StringUtils.subBlanks(companyUserID) != null)
{
AdminUser adminUser = AdminUser.getAdminUserForForgotPassword(process.getTransaction(), adminUserID, forgotpasswordCode);
CompanyUser companyUser = CompanyUser.getCompanyUserForForgotPassword(process.getTransaction(), companyUserID, forgotpasswordCode);
if(adminUser != null)
if(companyUser != null)
{
user = adminUser.getUser();
user = companyUser.getUser();
// if(StringUtils.subBlanks(forgotpasswordCode) != null)
// {
......
......@@ -17,7 +17,7 @@
<MAP code="TestInput" class="performa.orm.TestInput"/>
<MAP code="JobApplication" class="performa.orm.JobApplication"/>
<MAP code="Candidate" class="performa.orm.Candidate"/>
<MAP code="AdminUser" class="performa.orm.AdminUser"/>
<MAP code="CompanyUser" class="performa.orm.CompanyUser"/>
</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.RedefineTableOperation">
<tableName factory="String">tl_job</tableName>
<column name="client_id" type="Long" length="11" nullable="true"/>
<column name="company_user_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.RedefineTableOperation">
<tableName factory="String">oneit_sec_user_extension</tableName>
<column name="role_type" type="String" nullable="true" length="200"/>
<column name="company_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="oneit_sec_user_extension" indexName="idx_oneit_sec_user_extension_company_id" isUnique="false">
<column name="company_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_client</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="object_type" type="String" nullable="false" length="30"/>
<column name="company_name" type="String" nullable="false" length="100"/>
<column name="company_logo" type="BLOB" nullable="true"/>
<column name="email" type="String" nullable="true" length="100"/>
<column name="contact_name" type="String" nullable="true" length="100"/>
<column name="contact_surname" type="String" nullable="true" length="100"/>
<column name="phone" type="String" nullable="true" length="30"/>
<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="company_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="tl_client" indexName="idx_tl_client_company_id" isUnique="false"><column name="company_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_company</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="object_type" type="String" nullable="false" length="30"/>
<column name="company_name" type="String" nullable="false" length="100"/>
<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="added_by_user_id" type="Long" length="11" nullable="false"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- @AutoRun
UPDATE oneit_sec_user_extension SET object_type='CompanyUser' WHERE object_type='AdminUser';
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment