Commit 6ebd772e by Nilu

move stripe reference to company from company user

parent bee8281b
......@@ -19,6 +19,8 @@
<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="stripe_reference" type="String" nullable="true" length="100"/>
<column name="stripe_subscription" type="String" nullable="true" length="100"/>
<column name="added_by_user_id" type="Long" length="11" nullable="false"/>
</NODE>
......
......@@ -18,8 +18,6 @@
<column name="verification_key" type="String" nullable="true" length="10"/>
<column name="is_account_verified" type="Boolean" nullable="true"/>
<column name="is_email_changed" 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="user_id" type="Long" length="11" nullable="true"/>
<column name="company_id" type="Long" length="11" nullable="true"/>
</NODE>
......
......@@ -19,6 +19,8 @@ CREATE TABLE tl_company (
post_code varchar(10) NULL,
city varchar(100) NULL,
has_client_support char(1) NULL,
stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL,
added_by_user_id numeric(12) NOT NULL
);
......
......@@ -17,8 +17,6 @@ CREATE TABLE oneit_sec_user_extension (
verification_key varchar(10) NULL,
is_account_verified char(1) NULL,
is_email_changed char(1) NULL,
stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL,
user_id numeric(12) NULL,
company_id numeric(12) NULL
);
......
......@@ -20,6 +20,8 @@ CREATE TABLE tl_company (
post_code varchar2(10) NULL,
city varchar2(100) NULL,
has_client_support char(1) NULL,
stripe_reference varchar2(100) NULL,
stripe_subscription varchar2(100) NULL,
added_by_user_id number(12) NOT NULL
);
......
......@@ -18,8 +18,6 @@ CREATE TABLE oneit_sec_user_extension (
verification_key varchar2(10) NULL,
is_account_verified char(1) NULL,
is_email_changed char(1) NULL,
stripe_reference varchar2(100) NULL,
stripe_subscription varchar2(100) NULL,
user_id number(12) NULL,
company_id number(12) NULL
);
......
......@@ -20,6 +20,8 @@ CREATE TABLE tl_company (
post_code varchar(10) NULL,
city varchar(100) NULL,
has_client_support char(1) NULL,
stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL,
added_by_user_id numeric(12) NOT NULL
);
......
......@@ -18,8 +18,6 @@ CREATE TABLE oneit_sec_user_extension (
verification_key varchar(10) NULL,
is_account_verified char(1) NULL,
is_email_changed char(1) NULL,
stripe_reference varchar(100) NULL,
stripe_subscription varchar(100) NULL,
user_id numeric(12) NULL,
company_id numeric(12) NULL
);
......
......@@ -118,10 +118,10 @@ public class SendCompanyUserInvitesFP extends SaveFP
// Need to handle properly when plan and billing screens are added
StripeUtils.createCustomer(companyUser);
LogMgr.log(LOG, LogLevel.PROCESSING1,"Created customer in Stripe, customer reference ", companyUser.getStripeReference());
LogMgr.log(LOG, LogLevel.PROCESSING1,"Created customer in Stripe, customer reference ", company.getStripeReference());
StripeUtils.subscribeCustomer(companyUser);
LogMgr.log(LOG, LogLevel.PROCESSING1,"Subscribed customer to default plan in Stripe, subscription reference ", companyUser.getStripeSubscription());
StripeUtils.subscribeCustomer(company);
LogMgr.log(LOG, LogLevel.PROCESSING1,"Subscribed customer to default plan in Stripe, subscription reference ", company.getStripeSubscription());
//process user invitations
......
......@@ -55,6 +55,8 @@ public abstract class BaseCompany extends BaseBusinessClass
public static final String FIELD_PostCode = "PostCode";
public static final String FIELD_City = "City";
public static final String FIELD_HasClientSupport = "HasClientSupport";
public static final String FIELD_StripeReference = "StripeReference";
public static final String FIELD_StripeSubscription = "StripeSubscription";
public static final String FIELD_UserEmail = "UserEmail";
public static final String FIELD_FirstName = "FirstName";
public static final String FIELD_LastName = "LastName";
......@@ -83,6 +85,8 @@ public abstract class BaseCompany extends BaseBusinessClass
private static final DefaultAttributeHelper<Company> HELPER_PostCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_City = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_HasClientSupport = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_StripeReference = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<Company> HELPER_StripeSubscription = 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_LastName = DefaultAttributeHelper.INSTANCE;
......@@ -103,6 +107,8 @@ public abstract class BaseCompany extends BaseBusinessClass
private String _PostCode;
private String _City;
private Boolean _HasClientSupport;
private String _StripeReference;
private String _StripeSubscription;
private String _UserEmail;
private String _FirstName;
private String _LastName;
......@@ -141,6 +147,8 @@ public abstract class BaseCompany extends BaseBusinessClass
private static final AttributeValidator[] FIELD_PostCode_Validators;
private static final AttributeValidator[] FIELD_City_Validators;
private static final AttributeValidator[] FIELD_HasClientSupport_Validators;
private static final AttributeValidator[] FIELD_StripeReference_Validators;
private static final AttributeValidator[] FIELD_StripeSubscription_Validators;
// Arrays of behaviour decorators
......@@ -176,6 +184,8 @@ public abstract class BaseCompany extends BaseBusinessClass
FIELD_PostCode_Validators = (AttributeValidator[])setupAttribMetaData_PostCode(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_City_Validators = (AttributeValidator[])setupAttribMetaData_City(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HasClientSupport_Validators = (AttributeValidator[])setupAttribMetaData_HasClientSupport(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_StripeReference_Validators = (AttributeValidator[])setupAttribMetaData_StripeReference(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_StripeSubscription_Validators = (AttributeValidator[])setupAttribMetaData_StripeSubscription(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_Company.initialiseReference ();
......@@ -562,6 +572,44 @@ public abstract class BaseCompany extends BaseBusinessClass
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_StripeReference(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "stripe_reference");
metaInfo.put ("length", "100");
metaInfo.put ("name", "StripeReference");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Company.StripeReference:", metaInfo);
ATTRIBUTES_METADATA_Company.put (FIELD_StripeReference, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Company.class, "StripeReference", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Company.StripeReference:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_StripeSubscription(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "stripe_subscription");
metaInfo.put ("length", "100");
metaInfo.put ("name", "StripeSubscription");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Company.StripeSubscription:", metaInfo);
ATTRIBUTES_METADATA_Company.put (FIELD_StripeSubscription, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(Company.class, "StripeSubscription", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for Company.StripeSubscription:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
......@@ -600,6 +648,8 @@ public abstract class BaseCompany extends BaseBusinessClass
_PostCode = (String)(HELPER_PostCode.initialise (_PostCode));
_City = (String)(HELPER_City.initialise (_City));
_HasClientSupport = (Boolean)(Boolean.FALSE);
_StripeReference = (String)(HELPER_StripeReference.initialise (_StripeReference));
_StripeSubscription = (String)(HELPER_StripeSubscription.initialise (_StripeSubscription));
_UserEmail = (String)(HELPER_UserEmail.initialise (_UserEmail));
_FirstName = (String)(HELPER_FirstName.initialise (_FirstName));
_LastName = (String)(HELPER_LastName.initialise (_LastName));
......@@ -1716,6 +1766,202 @@ public abstract class BaseCompany extends BaseBusinessClass
}
/**
* Get the attribute StripeReference
*/
public String getStripeReference ()
{
assertValid();
String valToReturn = _StripeReference;
for (CompanyBehaviourDecorator bhd : Company_BehaviourDecorators)
{
valToReturn = bhd.getStripeReference ((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 preStripeReferenceChange (String newStripeReference) 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 postStripeReferenceChange () throws FieldException
{
}
public FieldWriteability getWriteability_StripeReference ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute StripeReference. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setStripeReference (String newStripeReference) throws FieldException
{
boolean oldAndNewIdentical = HELPER_StripeReference.compare (_StripeReference, newStripeReference);
try
{
for (CompanyBehaviourDecorator bhd : Company_BehaviourDecorators)
{
newStripeReference = bhd.setStripeReference ((Company)this, newStripeReference);
oldAndNewIdentical = HELPER_StripeReference.compare (_StripeReference, newStripeReference);
}
if (FIELD_StripeReference_Validators.length > 0)
{
Object newStripeReferenceObj = HELPER_StripeReference.toObject (newStripeReference);
if (newStripeReferenceObj != null)
{
int loopMax = FIELD_StripeReference_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Company.get (FIELD_StripeReference);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_StripeReference_Validators[v].checkAttribute (this, FIELD_StripeReference, metadata, newStripeReferenceObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_StripeReference () != FieldWriteability.FALSE, "Field StripeReference is not writeable");
preStripeReferenceChange (newStripeReference);
markFieldChange (FIELD_StripeReference);
_StripeReference = newStripeReference;
postFieldChange (FIELD_StripeReference);
postStripeReferenceChange ();
}
}
/**
* Get the attribute StripeSubscription
*/
public String getStripeSubscription ()
{
assertValid();
String valToReturn = _StripeSubscription;
for (CompanyBehaviourDecorator bhd : Company_BehaviourDecorators)
{
valToReturn = bhd.getStripeSubscription ((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 preStripeSubscriptionChange (String newStripeSubscription) 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 postStripeSubscriptionChange () throws FieldException
{
}
public FieldWriteability getWriteability_StripeSubscription ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute StripeSubscription. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setStripeSubscription (String newStripeSubscription) throws FieldException
{
boolean oldAndNewIdentical = HELPER_StripeSubscription.compare (_StripeSubscription, newStripeSubscription);
try
{
for (CompanyBehaviourDecorator bhd : Company_BehaviourDecorators)
{
newStripeSubscription = bhd.setStripeSubscription ((Company)this, newStripeSubscription);
oldAndNewIdentical = HELPER_StripeSubscription.compare (_StripeSubscription, newStripeSubscription);
}
if (FIELD_StripeSubscription_Validators.length > 0)
{
Object newStripeSubscriptionObj = HELPER_StripeSubscription.toObject (newStripeSubscription);
if (newStripeSubscriptionObj != null)
{
int loopMax = FIELD_StripeSubscription_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_Company.get (FIELD_StripeSubscription);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_StripeSubscription_Validators[v].checkAttribute (this, FIELD_StripeSubscription, metadata, newStripeSubscriptionObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_StripeSubscription () != FieldWriteability.FALSE, "Field StripeSubscription is not writeable");
preStripeSubscriptionChange (newStripeSubscription);
markFieldChange (FIELD_StripeSubscription);
_StripeSubscription = newStripeSubscription;
postFieldChange (FIELD_StripeSubscription);
postStripeSubscriptionChange ();
}
}
/**
* Get the attribute UserEmail
*/
public String getUserEmail ()
......@@ -2931,6 +3177,8 @@ public abstract class BaseCompany extends BaseBusinessClass
tl_companyPSet.setAttrib (FIELD_PostCode, HELPER_PostCode.toObject (_PostCode)); //
tl_companyPSet.setAttrib (FIELD_City, HELPER_City.toObject (_City)); //
tl_companyPSet.setAttrib (FIELD_HasClientSupport, HELPER_HasClientSupport.toObject (_HasClientSupport)); //
tl_companyPSet.setAttrib (FIELD_StripeReference, HELPER_StripeReference.toObject (_StripeReference)); //
tl_companyPSet.setAttrib (FIELD_StripeSubscription, HELPER_StripeSubscription.toObject (_StripeSubscription)); //
_AddedByUser.getPersistentSets (allSets);
}
......@@ -2957,6 +3205,8 @@ public abstract class BaseCompany extends BaseBusinessClass
_PostCode = (String)(HELPER_PostCode.fromObject (_PostCode, tl_companyPSet.getAttrib (FIELD_PostCode))); //
_City = (String)(HELPER_City.fromObject (_City, tl_companyPSet.getAttrib (FIELD_City))); //
_HasClientSupport = (Boolean)(HELPER_HasClientSupport.fromObject (_HasClientSupport, tl_companyPSet.getAttrib (FIELD_HasClientSupport))); //
_StripeReference = (String)(HELPER_StripeReference.fromObject (_StripeReference, tl_companyPSet.getAttrib (FIELD_StripeReference))); //
_StripeSubscription = (String)(HELPER_StripeSubscription.fromObject (_StripeSubscription, tl_companyPSet.getAttrib (FIELD_StripeSubscription))); //
_AddedByUser.setFromPersistentSets (objectID, allSets);
}
......@@ -3072,6 +3322,24 @@ public abstract class BaseCompany extends BaseBusinessClass
e.addException (ex);
}
try
{
setStripeReference (otherCompany.getStripeReference ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setStripeSubscription (otherCompany.getStripeSubscription ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
......@@ -3098,6 +3366,8 @@ public abstract class BaseCompany extends BaseBusinessClass
_PostCode = sourceCompany._PostCode;
_City = sourceCompany._City;
_HasClientSupport = sourceCompany._HasClientSupport;
_StripeReference = sourceCompany._StripeReference;
_StripeSubscription = sourceCompany._StripeSubscription;
_UserEmail = sourceCompany._UserEmail;
_FirstName = sourceCompany._FirstName;
_LastName = sourceCompany._LastName;
......@@ -3172,6 +3442,8 @@ public abstract class BaseCompany extends BaseBusinessClass
_PostCode = (String)(HELPER_PostCode.readExternal (_PostCode, vals.get(FIELD_PostCode))); //
_City = (String)(HELPER_City.readExternal (_City, vals.get(FIELD_City))); //
_HasClientSupport = (Boolean)(HELPER_HasClientSupport.readExternal (_HasClientSupport, vals.get(FIELD_HasClientSupport))); //
_StripeReference = (String)(HELPER_StripeReference.readExternal (_StripeReference, vals.get(FIELD_StripeReference))); //
_StripeSubscription = (String)(HELPER_StripeSubscription.readExternal (_StripeSubscription, vals.get(FIELD_StripeSubscription))); //
_UserEmail = (String)(HELPER_UserEmail.readExternal (_UserEmail, vals.get(FIELD_UserEmail))); //
_FirstName = (String)(HELPER_FirstName.readExternal (_FirstName, vals.get(FIELD_FirstName))); //
_LastName = (String)(HELPER_LastName.readExternal (_LastName, vals.get(FIELD_LastName))); //
......@@ -3203,6 +3475,8 @@ public abstract class BaseCompany extends BaseBusinessClass
vals.put (FIELD_PostCode, HELPER_PostCode.writeExternal (_PostCode));
vals.put (FIELD_City, HELPER_City.writeExternal (_City));
vals.put (FIELD_HasClientSupport, HELPER_HasClientSupport.writeExternal (_HasClientSupport));
vals.put (FIELD_StripeReference, HELPER_StripeReference.writeExternal (_StripeReference));
vals.put (FIELD_StripeSubscription, HELPER_StripeSubscription.writeExternal (_StripeSubscription));
vals.put (FIELD_UserEmail, HELPER_UserEmail.writeExternal (_UserEmail));
vals.put (FIELD_FirstName, HELPER_FirstName.writeExternal (_FirstName));
vals.put (FIELD_LastName, HELPER_LastName.writeExternal (_LastName));
......@@ -3269,6 +3543,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{
listener.notifyFieldChange(this, other, FIELD_HasClientSupport, HELPER_HasClientSupport.toObject(this._HasClientSupport), HELPER_HasClientSupport.toObject(otherCompany._HasClientSupport));
}
if (!HELPER_StripeReference.compare(this._StripeReference, otherCompany._StripeReference))
{
listener.notifyFieldChange(this, other, FIELD_StripeReference, HELPER_StripeReference.toObject(this._StripeReference), HELPER_StripeReference.toObject(otherCompany._StripeReference));
}
if (!HELPER_StripeSubscription.compare(this._StripeSubscription, otherCompany._StripeSubscription))
{
listener.notifyFieldChange(this, other, FIELD_StripeSubscription, HELPER_StripeSubscription.toObject(this._StripeSubscription), HELPER_StripeSubscription.toObject(otherCompany._StripeSubscription));
}
// Compare single assocs
_AddedByUser.compare (otherCompany._AddedByUser, listener);
......@@ -3311,6 +3593,8 @@ public abstract class BaseCompany extends BaseBusinessClass
visitor.visitField(this, FIELD_PostCode, HELPER_PostCode.toObject(getPostCode()));
visitor.visitField(this, FIELD_City, HELPER_City.toObject(getCity()));
visitor.visitField(this, FIELD_HasClientSupport, HELPER_HasClientSupport.toObject(getHasClientSupport()));
visitor.visitField(this, FIELD_StripeReference, HELPER_StripeReference.toObject(getStripeReference()));
visitor.visitField(this, FIELD_StripeSubscription, HELPER_StripeSubscription.toObject(getStripeSubscription()));
visitor.visitAssociation (_AddedByUser);
visitor.visitAssociation (_Users);
visitor.visitAssociation (_Clients);
......@@ -3403,6 +3687,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return filter.matches (getHasClientSupport ());
}
else if (attribName.equals (FIELD_StripeReference))
{
return filter.matches (getStripeReference ());
}
else if (attribName.equals (FIELD_StripeSubscription))
{
return filter.matches (getStripeSubscription ());
}
else if (attribName.equals (SINGLEREFERENCE_AddedByUser))
{
return filter.matches (getAddedByUser ());
......@@ -3504,6 +3796,18 @@ public abstract class BaseCompany extends BaseBusinessClass
return this;
}
public SearchAll andStripeReference (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_company.stripe_reference", "StripeReference");
return this;
}
public SearchAll andStripeSubscription (QueryFilter<String> filter)
{
filter.addFilter (context, "tl_company.stripe_subscription", "StripeSubscription");
return this;
}
public SearchAll andAddedByUser (QueryFilter<CompanyUser> filter)
{
filter.addFilter (context, "tl_company.added_by_user_id", "AddedByUser");
......@@ -3589,6 +3893,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return HELPER_HasClientSupport.toObject (getHasClientSupport ());
}
else if (attribName.equals (FIELD_StripeReference))
{
return HELPER_StripeReference.toObject (getStripeReference ());
}
else if (attribName.equals (FIELD_StripeSubscription))
{
return HELPER_StripeSubscription.toObject (getStripeSubscription ());
}
else if (attribName.equals (FIELD_UserEmail))
{
return HELPER_UserEmail.toObject (getUserEmail ());
......@@ -3670,6 +3982,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return HELPER_HasClientSupport;
}
else if (attribName.equals (FIELD_StripeReference))
{
return HELPER_StripeReference;
}
else if (attribName.equals (FIELD_StripeSubscription))
{
return HELPER_StripeSubscription;
}
else if (attribName.equals (FIELD_UserEmail))
{
return HELPER_UserEmail;
......@@ -3751,6 +4071,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{
setHasClientSupport ((Boolean)(HELPER_HasClientSupport.fromObject (_HasClientSupport, attribValue)));
}
else if (attribName.equals (FIELD_StripeReference))
{
setStripeReference ((String)(HELPER_StripeReference.fromObject (_StripeReference, attribValue)));
}
else if (attribName.equals (FIELD_StripeSubscription))
{
setStripeSubscription ((String)(HELPER_StripeSubscription.fromObject (_StripeSubscription, attribValue)));
}
else if (attribName.equals (FIELD_UserEmail))
{
setUserEmail ((String)(HELPER_UserEmail.fromObject (_UserEmail, attribValue)));
......@@ -3839,6 +4167,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return getWriteability_HasClientSupport ();
}
else if (fieldName.equals (FIELD_StripeReference))
{
return getWriteability_StripeReference ();
}
else if (fieldName.equals (FIELD_StripeSubscription))
{
return getWriteability_StripeSubscription ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_Users))
{
return getWriteability_Users ();
......@@ -3940,6 +4276,16 @@ public abstract class BaseCompany extends BaseBusinessClass
fields.add (FIELD_HasClientSupport);
}
if (getWriteability_StripeReference () != FieldWriteability.TRUE)
{
fields.add (FIELD_StripeReference);
}
if (getWriteability_StripeSubscription () != FieldWriteability.TRUE)
{
fields.add (FIELD_StripeSubscription);
}
if (getWriteability_UserEmail () != FieldWriteability.TRUE)
{
fields.add (FIELD_UserEmail);
......@@ -3990,6 +4336,8 @@ public abstract class BaseCompany extends BaseBusinessClass
result.add(HELPER_PostCode.getAttribObject (getClass (), _PostCode, false, FIELD_PostCode));
result.add(HELPER_City.getAttribObject (getClass (), _City, false, FIELD_City));
result.add(HELPER_HasClientSupport.getAttribObject (getClass (), _HasClientSupport, false, FIELD_HasClientSupport));
result.add(HELPER_StripeReference.getAttribObject (getClass (), _StripeReference, false, FIELD_StripeReference));
result.add(HELPER_StripeSubscription.getAttribObject (getClass (), _StripeSubscription, false, FIELD_StripeSubscription));
result.add(HELPER_UserEmail.getAttribObject (getClass (), _UserEmail, false, FIELD_UserEmail));
result.add(HELPER_FirstName.getAttribObject (getClass (), _FirstName, false, FIELD_FirstName));
result.add(HELPER_LastName.getAttribObject (getClass (), _LastName, false, FIELD_LastName));
......@@ -4263,6 +4611,42 @@ public abstract class BaseCompany extends BaseBusinessClass
}
/**
* Get the attribute StripeReference
*/
public String getStripeReference (Company obj, String original)
{
return original;
}
/**
* Change the value set for attribute StripeReference.
* May modify the field beforehand
* Occurs before validation.
*/
public String setStripeReference (Company obj, String newStripeReference) throws FieldException
{
return newStripeReference;
}
/**
* Get the attribute StripeSubscription
*/
public String getStripeSubscription (Company obj, String original)
{
return original;
}
/**
* Change the value set for attribute StripeSubscription.
* May modify the field beforehand
* Occurs before validation.
*/
public String setStripeSubscription (Company obj, String newStripeSubscription) throws FieldException
{
return newStripeSubscription;
}
/**
* Get the attribute UserEmail
*/
public String getUserEmail (Company obj, String original)
......@@ -4498,6 +4882,14 @@ public abstract class BaseCompany extends BaseBusinessClass
{
return toHasClientSupport ();
}
if (name.equals ("StripeReference"))
{
return toStripeReference ();
}
if (name.equals ("StripeSubscription"))
{
return toStripeSubscription ();
}
if (name.equals ("AddedByUser"))
{
return toAddedByUser ();
......@@ -4541,6 +4933,10 @@ public abstract class BaseCompany extends BaseBusinessClass
public PipeLine<From, String> toCity () { return pipe(new ORMAttributePipe<Me, String>(FIELD_City)); }
public PipeLine<From, Boolean> toHasClientSupport () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_HasClientSupport)); }
public PipeLine<From, String> toStripeReference () { return pipe(new ORMAttributePipe<Me, String>(FIELD_StripeReference)); }
public PipeLine<From, String> toStripeSubscription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_StripeSubscription)); }
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toAddedByUser () { return toAddedByUser (Filter.ALL); }
public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toAddedByUser (Filter<CompanyUser> filter)
......
......@@ -51,8 +51,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
public static final String FIELD_VerificationKey = "VerificationKey";
public static final String FIELD_IsAccountVerified = "IsAccountVerified";
public static final String FIELD_IsEmailChanged = "IsEmailChanged";
public static final String FIELD_StripeReference = "StripeReference";
public static final String FIELD_StripeSubscription = "StripeSubscription";
public static final String FIELD_Email = "Email";
public static final String FIELD_Password = "Password";
public static final String FIELD_ConfirmPassword = "ConfirmPassword";
......@@ -75,8 +73,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
private static final DefaultAttributeHelper<CompanyUser> HELPER_VerificationKey = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_IsAccountVerified = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_IsEmailChanged = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_StripeReference = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_StripeSubscription = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_Email = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_Password = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<CompanyUser> HELPER_ConfirmPassword = DefaultAttributeHelper.INSTANCE;
......@@ -92,8 +88,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
private String _VerificationKey;
private Boolean _IsAccountVerified;
private Boolean _IsEmailChanged;
private String _StripeReference;
private String _StripeSubscription;
private String _Email;
private String _Password;
private String _ConfirmPassword;
......@@ -122,8 +116,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
private static final AttributeValidator[] FIELD_VerificationKey_Validators;
private static final AttributeValidator[] FIELD_IsAccountVerified_Validators;
private static final AttributeValidator[] FIELD_IsEmailChanged_Validators;
private static final AttributeValidator[] FIELD_StripeReference_Validators;
private static final AttributeValidator[] FIELD_StripeSubscription_Validators;
// Arrays of behaviour decorators
......@@ -151,8 +143,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
FIELD_VerificationKey_Validators = (AttributeValidator[])setupAttribMetaData_VerificationKey(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_IsAccountVerified_Validators = (AttributeValidator[])setupAttribMetaData_IsAccountVerified(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_IsEmailChanged_Validators = (AttributeValidator[])setupAttribMetaData_IsEmailChanged(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_StripeReference_Validators = (AttributeValidator[])setupAttribMetaData_StripeReference(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_StripeSubscription_Validators = (AttributeValidator[])setupAttribMetaData_StripeSubscription(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_CompanyUser.initialiseReference ();
......@@ -407,44 +397,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_StripeReference(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "stripe_reference");
metaInfo.put ("length", "100");
metaInfo.put ("name", "StripeReference");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.StripeReference:", metaInfo);
ATTRIBUTES_METADATA_CompanyUser.put (FIELD_StripeReference, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(CompanyUser.class, "StripeReference", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for CompanyUser.StripeReference:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_StripeSubscription(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "stripe_subscription");
metaInfo.put ("length", "100");
metaInfo.put ("name", "StripeSubscription");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.StripeSubscription:", metaInfo);
ATTRIBUTES_METADATA_CompanyUser.put (FIELD_StripeSubscription, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(CompanyUser.class, "StripeSubscription", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for CompanyUser.StripeSubscription:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
......@@ -481,8 +433,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationKey = (String)(HELPER_VerificationKey.initialise (_VerificationKey));
_IsAccountVerified = (Boolean)(Boolean.FALSE);
_IsEmailChanged = (Boolean)(Boolean.FALSE);
_StripeReference = (String)(HELPER_StripeReference.initialise (_StripeReference));
_StripeSubscription = (String)(HELPER_StripeSubscription.initialise (_StripeSubscription));
_Email = (String)(HELPER_Email.initialise (_Email));
_Password = (String)(HELPER_Password.initialise (_Password));
_ConfirmPassword = (String)(HELPER_ConfirmPassword.initialise (_ConfirmPassword));
......@@ -1395,202 +1345,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
}
/**
* Get the attribute StripeReference
*/
public String getStripeReference ()
{
assertValid();
String valToReturn = _StripeReference;
for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
{
valToReturn = bhd.getStripeReference ((CompanyUser)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 preStripeReferenceChange (String newStripeReference) 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 postStripeReferenceChange () throws FieldException
{
}
public FieldWriteability getWriteability_StripeReference ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute StripeReference. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setStripeReference (String newStripeReference) throws FieldException
{
boolean oldAndNewIdentical = HELPER_StripeReference.compare (_StripeReference, newStripeReference);
try
{
for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
{
newStripeReference = bhd.setStripeReference ((CompanyUser)this, newStripeReference);
oldAndNewIdentical = HELPER_StripeReference.compare (_StripeReference, newStripeReference);
}
if (FIELD_StripeReference_Validators.length > 0)
{
Object newStripeReferenceObj = HELPER_StripeReference.toObject (newStripeReference);
if (newStripeReferenceObj != null)
{
int loopMax = FIELD_StripeReference_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_CompanyUser.get (FIELD_StripeReference);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_StripeReference_Validators[v].checkAttribute (this, FIELD_StripeReference, metadata, newStripeReferenceObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_StripeReference () != FieldWriteability.FALSE, "Field StripeReference is not writeable");
preStripeReferenceChange (newStripeReference);
markFieldChange (FIELD_StripeReference);
_StripeReference = newStripeReference;
postFieldChange (FIELD_StripeReference);
postStripeReferenceChange ();
}
}
/**
* Get the attribute StripeSubscription
*/
public String getStripeSubscription ()
{
assertValid();
String valToReturn = _StripeSubscription;
for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
{
valToReturn = bhd.getStripeSubscription ((CompanyUser)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 preStripeSubscriptionChange (String newStripeSubscription) 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 postStripeSubscriptionChange () throws FieldException
{
}
public FieldWriteability getWriteability_StripeSubscription ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute StripeSubscription. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setStripeSubscription (String newStripeSubscription) throws FieldException
{
boolean oldAndNewIdentical = HELPER_StripeSubscription.compare (_StripeSubscription, newStripeSubscription);
try
{
for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
{
newStripeSubscription = bhd.setStripeSubscription ((CompanyUser)this, newStripeSubscription);
oldAndNewIdentical = HELPER_StripeSubscription.compare (_StripeSubscription, newStripeSubscription);
}
if (FIELD_StripeSubscription_Validators.length > 0)
{
Object newStripeSubscriptionObj = HELPER_StripeSubscription.toObject (newStripeSubscription);
if (newStripeSubscriptionObj != null)
{
int loopMax = FIELD_StripeSubscription_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_CompanyUser.get (FIELD_StripeSubscription);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_StripeSubscription_Validators[v].checkAttribute (this, FIELD_StripeSubscription, metadata, newStripeSubscriptionObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_StripeSubscription () != FieldWriteability.FALSE, "Field StripeSubscription is not writeable");
preStripeSubscriptionChange (newStripeSubscription);
markFieldChange (FIELD_StripeSubscription);
_StripeSubscription = newStripeSubscription;
postFieldChange (FIELD_StripeSubscription);
postStripeSubscriptionChange ();
}
}
/**
* Get the attribute Email
*/
public String getEmail ()
......@@ -2292,8 +2046,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
oneit_sec_user_extensionPSet.setAttrib (FIELD_VerificationKey, HELPER_VerificationKey.toObject (_VerificationKey)); //
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_StripeReference, HELPER_StripeReference.toObject (_StripeReference)); //
oneit_sec_user_extensionPSet.setAttrib (FIELD_StripeSubscription, HELPER_StripeSubscription.toObject (_StripeSubscription)); //
_Company.getPersistentSets (allSets);
}
......@@ -2318,8 +2070,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationKey = (String)(HELPER_VerificationKey.fromObject (_VerificationKey, oneit_sec_user_extensionPSet.getAttrib (FIELD_VerificationKey))); //
_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))); //
_StripeReference = (String)(HELPER_StripeReference.fromObject (_StripeReference, oneit_sec_user_extensionPSet.getAttrib (FIELD_StripeReference))); //
_StripeSubscription = (String)(HELPER_StripeSubscription.fromObject (_StripeSubscription, oneit_sec_user_extensionPSet.getAttrib (FIELD_StripeSubscription))); //
_Company.setFromPersistentSets (objectID, allSets);
}
......@@ -2417,24 +2167,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
e.addException (ex);
}
try
{
setStripeReference (otherCompanyUser.getStripeReference ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setStripeSubscription (otherCompanyUser.getStripeSubscription ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
......@@ -2459,8 +2191,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationKey = sourceCompanyUser._VerificationKey;
_IsAccountVerified = sourceCompanyUser._IsAccountVerified;
_IsEmailChanged = sourceCompanyUser._IsEmailChanged;
_StripeReference = sourceCompanyUser._StripeReference;
_StripeSubscription = sourceCompanyUser._StripeSubscription;
_Email = sourceCompanyUser._Email;
_Password = sourceCompanyUser._Password;
_ConfirmPassword = sourceCompanyUser._ConfirmPassword;
......@@ -2526,8 +2256,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationKey = (String)(HELPER_VerificationKey.readExternal (_VerificationKey, vals.get(FIELD_VerificationKey))); //
_IsAccountVerified = (Boolean)(HELPER_IsAccountVerified.readExternal (_IsAccountVerified, vals.get(FIELD_IsAccountVerified))); //
_IsEmailChanged = (Boolean)(HELPER_IsEmailChanged.readExternal (_IsEmailChanged, vals.get(FIELD_IsEmailChanged))); //
_StripeReference = (String)(HELPER_StripeReference.readExternal (_StripeReference, vals.get(FIELD_StripeReference))); //
_StripeSubscription = (String)(HELPER_StripeSubscription.readExternal (_StripeSubscription, vals.get(FIELD_StripeSubscription))); //
_Email = (String)(HELPER_Email.readExternal (_Email, vals.get(FIELD_Email))); //
_Password = (String)(HELPER_Password.readExternal (_Password, vals.get(FIELD_Password))); //
_ConfirmPassword = (String)(HELPER_ConfirmPassword.readExternal (_ConfirmPassword, vals.get(FIELD_ConfirmPassword))); //
......@@ -2552,8 +2280,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
vals.put (FIELD_VerificationKey, HELPER_VerificationKey.writeExternal (_VerificationKey));
vals.put (FIELD_IsAccountVerified, HELPER_IsAccountVerified.writeExternal (_IsAccountVerified));
vals.put (FIELD_IsEmailChanged, HELPER_IsEmailChanged.writeExternal (_IsEmailChanged));
vals.put (FIELD_StripeReference, HELPER_StripeReference.writeExternal (_StripeReference));
vals.put (FIELD_StripeSubscription, HELPER_StripeSubscription.writeExternal (_StripeSubscription));
vals.put (FIELD_Email, HELPER_Email.writeExternal (_Email));
vals.put (FIELD_Password, HELPER_Password.writeExternal (_Password));
vals.put (FIELD_ConfirmPassword, HELPER_ConfirmPassword.writeExternal (_ConfirmPassword));
......@@ -2607,14 +2333,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
listener.notifyFieldChange(this, other, FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject(this._IsEmailChanged), HELPER_IsEmailChanged.toObject(otherCompanyUser._IsEmailChanged));
}
if (!HELPER_StripeReference.compare(this._StripeReference, otherCompanyUser._StripeReference))
{
listener.notifyFieldChange(this, other, FIELD_StripeReference, HELPER_StripeReference.toObject(this._StripeReference), HELPER_StripeReference.toObject(otherCompanyUser._StripeReference));
}
if (!HELPER_StripeSubscription.compare(this._StripeSubscription, otherCompanyUser._StripeSubscription))
{
listener.notifyFieldChange(this, other, FIELD_StripeSubscription, HELPER_StripeSubscription.toObject(this._StripeSubscription), HELPER_StripeSubscription.toObject(otherCompanyUser._StripeSubscription));
}
// Compare single assocs
_Company.compare (otherCompanyUser._Company, listener);
......@@ -2650,8 +2368,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
visitor.visitField(this, FIELD_VerificationKey, HELPER_VerificationKey.toObject(getVerificationKey()));
visitor.visitField(this, FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject(getIsAccountVerified()));
visitor.visitField(this, FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject(getIsEmailChanged()));
visitor.visitField(this, FIELD_StripeReference, HELPER_StripeReference.toObject(getStripeReference()));
visitor.visitField(this, FIELD_StripeSubscription, HELPER_StripeSubscription.toObject(getStripeSubscription()));
visitor.visitAssociation (_Company);
}
......@@ -2726,14 +2442,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return filter.matches (getIsEmailChanged ());
}
else if (attribName.equals (FIELD_StripeReference))
{
return filter.matches (getStripeReference ());
}
else if (attribName.equals (FIELD_StripeSubscription))
{
return filter.matches (getStripeSubscription ());
}
else if (attribName.equals (SINGLEREFERENCE_Company))
{
return filter.matches (getCompany ());
......@@ -2823,18 +2531,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
return this;
}
public SearchAll andStripeReference (QueryFilter<String> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.stripe_reference", "StripeReference");
return this;
}
public SearchAll andStripeSubscription (QueryFilter<String> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.stripe_subscription", "StripeSubscription");
return this;
}
public SearchAll andUser (QueryFilter<SecUser> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
......@@ -2958,18 +2654,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
return this;
}
public SearchAllCompanyUsers andStripeReference (QueryFilter<String> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.stripe_reference", "StripeReference");
return this;
}
public SearchAllCompanyUsers andStripeSubscription (QueryFilter<String> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.stripe_subscription", "StripeSubscription");
return this;
}
public SearchAllCompanyUsers andUser (QueryFilter<SecUser> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
......@@ -3100,18 +2784,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
return this;
}
public SearchIdPin andStripeReference (QueryFilter<String> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.stripe_reference", "StripeReference");
return this;
}
public SearchIdPin andStripeSubscription (QueryFilter<String> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.stripe_subscription", "StripeSubscription");
return this;
}
public SearchIdPin andUser (QueryFilter<SecUser> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
......@@ -3195,14 +2867,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return HELPER_IsEmailChanged.toObject (getIsEmailChanged ());
}
else if (attribName.equals (FIELD_StripeReference))
{
return HELPER_StripeReference.toObject (getStripeReference ());
}
else if (attribName.equals (FIELD_StripeSubscription))
{
return HELPER_StripeSubscription.toObject (getStripeSubscription ());
}
else if (attribName.equals (FIELD_Email))
{
return HELPER_Email.toObject (getEmail ());
......@@ -3264,14 +2928,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return HELPER_IsEmailChanged;
}
else if (attribName.equals (FIELD_StripeReference))
{
return HELPER_StripeReference;
}
else if (attribName.equals (FIELD_StripeSubscription))
{
return HELPER_StripeSubscription;
}
else if (attribName.equals (FIELD_Email))
{
return HELPER_Email;
......@@ -3333,14 +2989,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
setIsEmailChanged ((Boolean)(HELPER_IsEmailChanged.fromObject (_IsEmailChanged, attribValue)));
}
else if (attribName.equals (FIELD_StripeReference))
{
setStripeReference ((String)(HELPER_StripeReference.fromObject (_StripeReference, attribValue)));
}
else if (attribName.equals (FIELD_StripeSubscription))
{
setStripeSubscription ((String)(HELPER_StripeSubscription.fromObject (_StripeSubscription, attribValue)));
}
else if (attribName.equals (FIELD_Email))
{
setEmail ((String)(HELPER_Email.fromObject (_Email, attribValue)));
......@@ -3409,14 +3057,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return getWriteability_IsEmailChanged ();
}
else if (fieldName.equals (FIELD_StripeReference))
{
return getWriteability_StripeReference ();
}
else if (fieldName.equals (FIELD_StripeSubscription))
{
return getWriteability_StripeSubscription ();
}
else if (fieldName.equals (SINGLEREFERENCE_Company))
{
return getWriteability_Company ();
......@@ -3488,16 +3128,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
fields.add (FIELD_IsEmailChanged);
}
if (getWriteability_StripeReference () != FieldWriteability.TRUE)
{
fields.add (FIELD_StripeReference);
}
if (getWriteability_StripeSubscription () != FieldWriteability.TRUE)
{
fields.add (FIELD_StripeSubscription);
}
if (getWriteability_Email () != FieldWriteability.TRUE)
{
fields.add (FIELD_Email);
......@@ -3531,8 +3161,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
result.add(HELPER_VerificationKey.getAttribObject (getClass (), _VerificationKey, false, FIELD_VerificationKey));
result.add(HELPER_IsAccountVerified.getAttribObject (getClass (), _IsAccountVerified, false, FIELD_IsAccountVerified));
result.add(HELPER_IsEmailChanged.getAttribObject (getClass (), _IsEmailChanged, false, FIELD_IsEmailChanged));
result.add(HELPER_StripeReference.getAttribObject (getClass (), _StripeReference, false, FIELD_StripeReference));
result.add(HELPER_StripeSubscription.getAttribObject (getClass (), _StripeSubscription, false, FIELD_StripeSubscription));
result.add(HELPER_Email.getAttribObject (getClass (), _Email, false, FIELD_Email));
result.add(HELPER_Password.getAttribObject (getClass (), _Password, false, FIELD_Password));
result.add(HELPER_ConfirmPassword.getAttribObject (getClass (), _ConfirmPassword, false, FIELD_ConfirmPassword));
......@@ -3749,42 +3377,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
}
/**
* Get the attribute StripeReference
*/
public String getStripeReference (CompanyUser obj, String original)
{
return original;
}
/**
* Change the value set for attribute StripeReference.
* May modify the field beforehand
* Occurs before validation.
*/
public String setStripeReference (CompanyUser obj, String newStripeReference) throws FieldException
{
return newStripeReference;
}
/**
* Get the attribute StripeSubscription
*/
public String getStripeSubscription (CompanyUser obj, String original)
{
return original;
}
/**
* Change the value set for attribute StripeSubscription.
* May modify the field beforehand
* Occurs before validation.
*/
public String setStripeSubscription (CompanyUser obj, String newStripeSubscription) throws FieldException
{
return newStripeSubscription;
}
/**
* Get the attribute Email
*/
public String getEmail (CompanyUser obj, String original)
......@@ -3938,14 +3530,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return toIsEmailChanged ();
}
if (name.equals ("StripeReference"))
{
return toStripeReference ();
}
if (name.equals ("StripeSubscription"))
{
return toStripeSubscription ();
}
if (name.equals ("Company"))
{
return toCompany ();
......@@ -3979,10 +3563,6 @@ public abstract class BaseCompanyUser extends SecUserExtension
public PipeLine<From, Boolean> toIsAccountVerified () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsAccountVerified)); }
public PipeLine<From, Boolean> toIsEmailChanged () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsEmailChanged)); }
public PipeLine<From, String> toStripeReference () { return pipe(new ORMAttributePipe<Me, String>(FIELD_StripeReference)); }
public PipeLine<From, String> toStripeSubscription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_StripeSubscription)); }
public Company.CompanyPipeLineFactory<From, Company> toCompany () { return toCompany (Filter.ALL); }
public Company.CompanyPipeLineFactory<From, Company> toCompany (Filter<Company> filter)
......
......@@ -20,18 +20,20 @@
<TABLE name="tl_company" tablePrefix="object">
<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="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="IsVerified" type="Boolean" dbcol="is_verified" defaultValue="Boolean.FALSE"/>
<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="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="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="IsVerified" type="Boolean" dbcol="is_verified" defaultValue="Boolean.FALSE"/>
<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="StripeReference" type="String" dbcol="stripe_reference" length="100"/>
<ATTRIB name="StripeSubscription" type="String" dbcol="stripe_subscription" length="100"/>
<SINGLEREFERENCE name="AddedByUser" type="CompanyUser" dbcol="added_by_user_id" mandatory="true"/>
</TABLE>
......
......@@ -40,6 +40,8 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
private String dummyPostCode;
private String dummyCity;
private Boolean dummyHasClientSupport;
private String dummyStripeReference;
private String dummyStripeSubscription;
// Static constants corresponding to attribute helpers
......@@ -54,6 +56,8 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
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_StripeReference = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_StripeSubscription = DefaultAttributeHelper.INSTANCE;
......@@ -71,10 +75,12 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
dummyPostCode = (String)(HELPER_PostCode.initialise (dummyPostCode));
dummyCity = (String)(HELPER_City.initialise (dummyCity));
dummyHasClientSupport = (Boolean)(HELPER_HasClientSupport.initialise (dummyHasClientSupport));
dummyStripeReference = (String)(HELPER_StripeReference.initialise (dummyStripeReference));
dummyStripeSubscription = (String)(HELPER_StripeSubscription.initialise (dummyStripeSubscription));
}
private String SELECT_COLUMNS = "{PREFIX}tl_company.object_id as id, {PREFIX}tl_company.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_company.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_company.company_name, {PREFIX}tl_company.company_logo, {PREFIX}tl_company.hiring_team_type, {PREFIX}tl_company.industry, {PREFIX}tl_company.time_zone, {PREFIX}tl_company.is_verified, {PREFIX}tl_company.state, {PREFIX}tl_company.country, {PREFIX}tl_company.post_code, {PREFIX}tl_company.city, {PREFIX}tl_company.has_client_support, {PREFIX}tl_company.added_by_user_id, 1 AS commasafe ";
private String SELECT_COLUMNS = "{PREFIX}tl_company.object_id as id, {PREFIX}tl_company.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_company.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_company.company_name, {PREFIX}tl_company.company_logo, {PREFIX}tl_company.hiring_team_type, {PREFIX}tl_company.industry, {PREFIX}tl_company.time_zone, {PREFIX}tl_company.is_verified, {PREFIX}tl_company.state, {PREFIX}tl_company.country, {PREFIX}tl_company.post_code, {PREFIX}tl_company.city, {PREFIX}tl_company.has_client_support, {PREFIX}tl_company.stripe_reference, {PREFIX}tl_company.stripe_subscription, {PREFIX}tl_company.added_by_user_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -136,6 +142,8 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
!tl_companyPSet.containsAttrib(Company.FIELD_PostCode)||
!tl_companyPSet.containsAttrib(Company.FIELD_City)||
!tl_companyPSet.containsAttrib(Company.FIELD_HasClientSupport)||
!tl_companyPSet.containsAttrib(Company.FIELD_StripeReference)||
!tl_companyPSet.containsAttrib(Company.FIELD_StripeSubscription)||
!tl_companyPSet.containsAttrib(Company.SINGLEREFERENCE_AddedByUser))
{
// We will need to retrieve it
......@@ -206,10 +214,10 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_company " +
"SET company_name = ?, company_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, is_verified = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, added_by_user_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"SET company_name = ?, company_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, is_verified = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, stripe_reference = ?, stripe_subscription = ?, added_by_user_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_company.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_CompanyName.getForSQL(dummyCompanyName, tl_companyPSet.getAttrib (Company.FIELD_CompanyName))).listEntry (HELPER_CompanyLogo.getForSQL(dummyCompanyLogo, tl_companyPSet.getAttrib (Company.FIELD_CompanyLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_companyPSet.getAttrib (Company.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_companyPSet.getAttrib (Company.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_companyPSet.getAttrib (Company.FIELD_TimeZone))).listEntry (HELPER_IsVerified.getForSQL(dummyIsVerified, tl_companyPSet.getAttrib (Company.FIELD_IsVerified))).listEntry (HELPER_State.getForSQL(dummyState, tl_companyPSet.getAttrib (Company.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_companyPSet.getAttrib (Company.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_companyPSet.getAttrib (Company.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_companyPSet.getAttrib (Company.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_companyPSet.getAttrib (Company.FIELD_HasClientSupport))).listEntry (SQLManager.CheckNull((Long)(tl_companyPSet.getAttrib (Company.SINGLEREFERENCE_AddedByUser)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
CollectionUtils.listEntry (HELPER_CompanyName.getForSQL(dummyCompanyName, tl_companyPSet.getAttrib (Company.FIELD_CompanyName))).listEntry (HELPER_CompanyLogo.getForSQL(dummyCompanyLogo, tl_companyPSet.getAttrib (Company.FIELD_CompanyLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_companyPSet.getAttrib (Company.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_companyPSet.getAttrib (Company.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_companyPSet.getAttrib (Company.FIELD_TimeZone))).listEntry (HELPER_IsVerified.getForSQL(dummyIsVerified, tl_companyPSet.getAttrib (Company.FIELD_IsVerified))).listEntry (HELPER_State.getForSQL(dummyState, tl_companyPSet.getAttrib (Company.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_companyPSet.getAttrib (Company.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_companyPSet.getAttrib (Company.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_companyPSet.getAttrib (Company.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_companyPSet.getAttrib (Company.FIELD_HasClientSupport))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_companyPSet.getAttrib (Company.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_companyPSet.getAttrib (Company.FIELD_StripeSubscription))).listEntry (SQLManager.CheckNull((Long)(tl_companyPSet.getAttrib (Company.SINGLEREFERENCE_AddedByUser)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -476,6 +484,8 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
tl_companyPSet.setAttrib(Company.FIELD_PostCode, HELPER_PostCode.getFromRS(dummyPostCode, r, "post_code"));
tl_companyPSet.setAttrib(Company.FIELD_City, HELPER_City.getFromRS(dummyCity, r, "city"));
tl_companyPSet.setAttrib(Company.FIELD_HasClientSupport, HELPER_HasClientSupport.getFromRS(dummyHasClientSupport, r, "has_client_support"));
tl_companyPSet.setAttrib(Company.FIELD_StripeReference, HELPER_StripeReference.getFromRS(dummyStripeReference, r, "stripe_reference"));
tl_companyPSet.setAttrib(Company.FIELD_StripeSubscription, HELPER_StripeSubscription.getFromRS(dummyStripeSubscription, r, "stripe_subscription"));
tl_companyPSet.setAttrib(Company.SINGLEREFERENCE_AddedByUser, r.getObject ("added_by_user_id"));
......@@ -494,10 +504,10 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_company " +
" (company_name, company_logo, hiring_team_type, industry, time_zone, is_verified, state, country, post_code, city, has_client_support, added_by_user_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
" (company_name, company_logo, hiring_team_type, industry, time_zone, is_verified, state, country, post_code, city, has_client_support, stripe_reference, stripe_subscription, added_by_user_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_CompanyName.getForSQL(dummyCompanyName, tl_companyPSet.getAttrib (Company.FIELD_CompanyName))).listEntry (HELPER_CompanyLogo.getForSQL(dummyCompanyLogo, tl_companyPSet.getAttrib (Company.FIELD_CompanyLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_companyPSet.getAttrib (Company.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_companyPSet.getAttrib (Company.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_companyPSet.getAttrib (Company.FIELD_TimeZone))).listEntry (HELPER_IsVerified.getForSQL(dummyIsVerified, tl_companyPSet.getAttrib (Company.FIELD_IsVerified))).listEntry (HELPER_State.getForSQL(dummyState, tl_companyPSet.getAttrib (Company.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_companyPSet.getAttrib (Company.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_companyPSet.getAttrib (Company.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_companyPSet.getAttrib (Company.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_companyPSet.getAttrib (Company.FIELD_HasClientSupport))) .listEntry (SQLManager.CheckNull((Long)(tl_companyPSet.getAttrib (Company.SINGLEREFERENCE_AddedByUser)))) .listEntry (objectID.longID ()).toList().toArray());
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_CompanyName.getForSQL(dummyCompanyName, tl_companyPSet.getAttrib (Company.FIELD_CompanyName))).listEntry (HELPER_CompanyLogo.getForSQL(dummyCompanyLogo, tl_companyPSet.getAttrib (Company.FIELD_CompanyLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_companyPSet.getAttrib (Company.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_companyPSet.getAttrib (Company.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_companyPSet.getAttrib (Company.FIELD_TimeZone))).listEntry (HELPER_IsVerified.getForSQL(dummyIsVerified, tl_companyPSet.getAttrib (Company.FIELD_IsVerified))).listEntry (HELPER_State.getForSQL(dummyState, tl_companyPSet.getAttrib (Company.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_companyPSet.getAttrib (Company.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_companyPSet.getAttrib (Company.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_companyPSet.getAttrib (Company.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_companyPSet.getAttrib (Company.FIELD_HasClientSupport))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_companyPSet.getAttrib (Company.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_companyPSet.getAttrib (Company.FIELD_StripeSubscription))) .listEntry (SQLManager.CheckNull((Long)(tl_companyPSet.getAttrib (Company.SINGLEREFERENCE_AddedByUser)))) .listEntry (objectID.longID ()).toList().toArray());
tl_companyPSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
......@@ -22,8 +22,6 @@
<ATTRIB name="VerificationKey" type="String" dbcol="verification_key" length="10"/>
<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="StripeReference" type="String" dbcol="stripe_reference" length="100"/>
<ATTRIB name="StripeSubscription" type="String" dbcol="stripe_subscription" length="100"/>
<SINGLEREFERENCE name="User" type="SecUser" dbcol="user_id" backreferenceName="Extensions" inSuper='TRUE'/>
<SINGLEREFERENCE name="Company" type="Company" dbcol="company_id" backreferenceName="Users"/>
......
......@@ -37,8 +37,6 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
private String dummyVerificationKey;
private Boolean dummyIsAccountVerified;
private Boolean dummyIsEmailChanged;
private String dummyStripeReference;
private String dummyStripeSubscription;
// Static constants corresponding to attribute helpers
......@@ -51,8 +49,6 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
private static final DefaultAttributeHelper HELPER_VerificationKey = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IsAccountVerified = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_IsEmailChanged = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_StripeReference = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_StripeSubscription = DefaultAttributeHelper.INSTANCE;
......@@ -68,12 +64,10 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
dummyVerificationKey = (String)(HELPER_VerificationKey.initialise (dummyVerificationKey));
dummyIsAccountVerified = (Boolean)(HELPER_IsAccountVerified.initialise (dummyIsAccountVerified));
dummyIsEmailChanged = (Boolean)(HELPER_IsEmailChanged.initialise (dummyIsEmailChanged));
dummyStripeReference = (String)(HELPER_StripeReference.initialise (dummyStripeReference));
dummyStripeSubscription = (String)(HELPER_StripeSubscription.initialise (dummyStripeSubscription));
}
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.stripe_reference, {PREFIX}oneit_sec_user_extension.stripe_subscription, {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, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -134,8 +128,6 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_VerificationKey)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_IsAccountVerified)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_IsEmailChanged)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_StripeReference)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.FIELD_StripeSubscription)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.SINGLEREFERENCE_User)||
!oneit_sec_user_extensionPSet.containsAttrib(CompanyUser.SINGLEREFERENCE_Company))
{
......@@ -236,10 +228,10 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"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 = ?, stripe_reference = ?, stripe_subscription = ?, 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 = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"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 (HELPER_StripeReference.getForSQL(dummyStripeReference, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_StripeSubscription))).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 (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -665,8 +657,6 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.FIELD_VerificationKey, HELPER_VerificationKey.getFromRS(dummyVerificationKey, r, "verification_key"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.FIELD_IsAccountVerified, HELPER_IsAccountVerified.getFromRS(dummyIsAccountVerified, r, "is_account_verified"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.FIELD_IsEmailChanged, HELPER_IsEmailChanged.getFromRS(dummyIsEmailChanged, r, "is_email_changed"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.FIELD_StripeReference, HELPER_StripeReference.getFromRS(dummyStripeReference, r, "stripe_reference"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.FIELD_StripeSubscription, HELPER_StripeSubscription.getFromRS(dummyStripeSubscription, r, "stripe_subscription"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.SINGLEREFERENCE_User, r.getObject ("user_id"));
oneit_sec_user_extensionPSet.setAttrib(CompanyUser.SINGLEREFERENCE_Company, r.getObject ("company_id"));
......@@ -686,10 +676,10 @@ public class CompanyUserPersistenceMgr extends SecUserExtensionPersistenceMgr
{
executeStatement (sqlMgr,
"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, stripe_reference, stripe_subscription, 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, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE, object_TYPE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + 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 (HELPER_StripeReference.getForSQL(dummyStripeReference, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, oneit_sec_user_extensionPSet.getAttrib (CompanyUser.FIELD_StripeSubscription))) .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());
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + 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());
oneit_sec_user_extensionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
......@@ -21,6 +21,7 @@ import oneit.objstore.StorageException;
import oneit.security.SecUser;
import oneit.utils.DateDiff;
import oneit.utils.parsers.FieldException;
import performa.orm.Company;
import performa.orm.CompanyUser;
......@@ -41,15 +42,16 @@ public class StripeUtils
{
try
{
Company company = companyUser.getCompany();
SecUser secUser = companyUser.getUser();
Map<String, Object> customerParams = new HashMap<>();
customerParams.put("description", companyUser.getCompany());
customerParams.put("description", company);
customerParams.put("email", secUser.getEmail());
Customer customer = Customer.create(customerParams);
companyUser.setStripeReference(customer.getId());
company.setStripeReference(customer.getId());
}
catch (StorageException | AuthenticationException | InvalidRequestException | APIConnectionException | CardException | APIException ex)
......@@ -59,7 +61,7 @@ public class StripeUtils
}
public static void subscribeCustomer(CompanyUser companyUser) throws FieldException
public static void subscribeCustomer(Company company) throws FieldException
{
try
{
......@@ -76,12 +78,12 @@ public class StripeUtils
Map<String, Object> params = new HashMap<>();
params.put("items", items);
params.put("coupon", STRIPE_COUPON_ID);
params.put("customer", companyUser.getStripeReference());
params.put("customer", company.getStripeReference());
params.put("trial_end", trialExpiry.getTime() / 1000L);
Subscription subscription = Subscription.create(params);
companyUser.setStripeSubscription(subscription.getId());
company.setStripeSubscription(subscription.getId());
}
catch (StorageException | AuthenticationException | InvalidRequestException | APIConnectionException | CardException | APIException ex)
{
......
<?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_company</tableName>
<column name="stripe_reference" type="String" nullable="true" length="100"/>
<column name="stripe_subscription" type="String" nullable="true" length="100"/>
</NODE>
</NODE>
</OBJECTS>
\ 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