Commit 967e72cc by Nilu

Assume user - providing user alias to handle billing - partially complete

parent 9ec2a80e
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">it_does_not_matter</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="xxxx" type="CLOB" nullable="true"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE it_does_not_matter;
CREATE TABLE it_does_not_matter (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
xxxx text NULL
);
ALTER TABLE it_does_not_matter ADD
CONSTRAINT PK_it_does_not_matter PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE it_does_not_matter;
CREATE TABLE it_does_not_matter (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
xxxx clob NULL
);
ALTER TABLE it_does_not_matter ADD
CONSTRAINT PK_it_does_not_matter PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- @AutoRun
-- drop table it_does_not_matter;
CREATE TABLE it_does_not_matter (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
xxxx text NULL
);
ALTER TABLE it_does_not_matter ADD
CONSTRAINT pk_it_does_not_matter PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
package performa.form;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.appservices.accesslog.AccessLog;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.objstore.ObjectTransaction;
import oneit.objstore.StorageException;
import oneit.security.AuthorisationToken;
import oneit.security.LoginProcessor;
import oneit.security.SecUser;
import oneit.security.jsp.MaintainUserFP;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessFormProcessor;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.security.SessionSecUserDecorator;
import oneit.servlets.utils.decorator.LoggingDecorator;
import oneit.servlets.utils.session.SessionManager;
import oneit.utils.BusinessException;
import performa.orm.HiringTeam;
public class AssumeHTAdminFP extends ORMProcessFormProcessor
{
public static final String UNASSUME_SEC_USER_ID = "oeit.unassumeSecUser";
private LoginProcessor loginFP;
@Override
public SuccessfulResult processForm(ORMProcessState process,
SubmissionDetails submission,
Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
HiringTeam hiringTeam = (HiringTeam) request.getAttribute("HiringTeam");
SecUser editor = (SecUser) request.getAttribute(AuthorisationToken.AUTH_TOKEN_ID);
SecUser secUser = hiringTeam.getAddedByUser() != null ? hiringTeam.getAddedByUser().getUser() : null;
if (secUser == null)
{
return null;
}
process.getTransaction().assertPrivilege("securityAssumeUser");
LogMgr.log( MaintainUserFP.LOG, LogLevel.BUSINESS1, "Assuming: ", secUser.getUserName(), " emp#: ", secUser.getObjectID(), " by ", editor );
SecUser toAssume = (SecUser)secUser.getInTransaction(ObjectTransaction.getTransaction());
AccessLog.getAccessLog().recordAccess("LOGIN", "Assume.jsp", toAssume.getAuthToken(), LoggingDecorator.getSessionID(submission.getRequest()), AccessLog.ACCESS_RESULT_OK, submission.getRequest().getRemoteAddr());
SessionManager.clearSession(request.getSession());
request.getSession().setAttribute(UNASSUME_SEC_USER_ID, editor);
request.getSession().setAttribute(SecUser.SEC_USER_ID, toAssume);
request.getSession().setAttribute(SessionSecUserDecorator.REFRESH_SECURITY, Boolean.TRUE);
request.getSession().setAttribute("SelectedHiringTeam", hiringTeam);
return loginFP.processSuccessfulLogin(submission, new HashMap(), toAssume);
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.search;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
import oneit.servlets.orm.*;
public abstract class BaseSearchHiringTeam extends SearchExecutor
{
// Reference instance for the object
public static final SearchHiringTeam REFERENCE_SearchHiringTeam = new SearchHiringTeam ();
// Reference instance for the object
public static final SearchHiringTeam DUMMY_SearchHiringTeam = new DummySearchHiringTeam ();
// Static constants corresponding to field names
public static final String FIELD_Details = "Details";
// Static constants corresponding to searches
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<SearchHiringTeam> HELPER_Details = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private String _Details;
// Private attributes corresponding to single references
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_SearchHiringTeam = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_Details_Validators;
// Arrays of behaviour decorators
private static final SearchHiringTeamBehaviourDecorator[] SearchHiringTeam_BehaviourDecorators;
static
{
try
{
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
FIELD_Details_Validators = (AttributeValidator[])setupAttribMetaData_Details(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_SearchHiringTeam.initialiseReference ();
DUMMY_SearchHiringTeam.initialiseReference ();
SearchHiringTeam_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(SearchHiringTeam.class).toArray(new SearchHiringTeamBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static List setupAttribMetaData_Details(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "xxxx");
metaInfo.put ("name", "Details");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for SearchHiringTeam.Details:", metaInfo);
ATTRIBUTES_METADATA_SearchHiringTeam.put (FIELD_Details, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(SearchHiringTeam.class, "Details", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for SearchHiringTeam.Details:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseSearchHiringTeam ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return SearchHiringTeam_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_Details = (String)(HELPER_Details.initialise (_Details));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
return this;
}
/**
* Get the attribute Details
*/
public String getDetails ()
{
assertValid();
String valToReturn = _Details;
for (SearchHiringTeamBehaviourDecorator bhd : SearchHiringTeam_BehaviourDecorators)
{
valToReturn = bhd.getDetails ((SearchHiringTeam)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 preDetailsChange (String newDetails) 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 postDetailsChange () throws FieldException
{
}
public FieldWriteability getWriteability_Details ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute Details. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setDetails (String newDetails) throws FieldException
{
boolean oldAndNewIdentical = HELPER_Details.compare (_Details, newDetails);
try
{
for (SearchHiringTeamBehaviourDecorator bhd : SearchHiringTeam_BehaviourDecorators)
{
newDetails = bhd.setDetails ((SearchHiringTeam)this, newDetails);
oldAndNewIdentical = HELPER_Details.compare (_Details, newDetails);
}
if (FIELD_Details_Validators.length > 0)
{
Object newDetailsObj = HELPER_Details.toObject (newDetails);
if (newDetailsObj != null)
{
int loopMax = FIELD_Details_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_SearchHiringTeam.get (FIELD_Details);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_Details_Validators[v].checkAttribute (this, FIELD_Details, metadata, newDetailsObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_Details () != FieldWriteability.FALSE, "Field Details is not writeable");
preDetailsChange (newDetails);
markFieldChange (FIELD_Details);
_Details = newDetails;
postFieldChange (FIELD_Details);
postDetailsChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public SearchHiringTeam newInstance ()
{
return new SearchHiringTeam ();
}
public SearchHiringTeam referenceInstance ()
{
return REFERENCE_SearchHiringTeam;
}
public SearchHiringTeam getInTransaction (ObjectTransaction t) throws StorageException
{
return getSearchHiringTeamByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_SearchHiringTeam;
}
public String getBaseSetName ()
{
return "it_does_not_matter";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet it_does_not_matterPSet = allSets.getPersistentSet (myID, "it_does_not_matter", myPSetStatus);
it_does_not_matterPSet.setAttrib (FIELD_ObjectID, myID);
it_does_not_matterPSet.setAttrib (FIELD_Details, HELPER_Details.toObject (_Details)); //
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet it_does_not_matterPSet = allSets.getPersistentSet (objectID, "it_does_not_matter");
_Details = (String)(HELPER_Details.fromObject (_Details, it_does_not_matterPSet.getAttrib (FIELD_Details))); //
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof SearchHiringTeam)
{
SearchHiringTeam otherSearchHiringTeam = (SearchHiringTeam)other;
try
{
setDetails (otherSearchHiringTeam.getDetails ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseSearchHiringTeam)
{
BaseSearchHiringTeam sourceSearchHiringTeam = (BaseSearchHiringTeam)(source);
_Details = sourceSearchHiringTeam._Details;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseSearchHiringTeam)
{
BaseSearchHiringTeam sourceSearchHiringTeam = (BaseSearchHiringTeam)(source);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseSearchHiringTeam)
{
BaseSearchHiringTeam sourceSearchHiringTeam = (BaseSearchHiringTeam)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_Details = (String)(HELPER_Details.readExternal (_Details, vals.get(FIELD_Details))); //
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_Details, HELPER_Details.writeExternal (_Details));
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseSearchHiringTeam)
{
BaseSearchHiringTeam otherSearchHiringTeam = (BaseSearchHiringTeam)(other);
if (!HELPER_Details.compare(this._Details, otherSearchHiringTeam._Details))
{
listener.notifyFieldChange(this, other, FIELD_Details, HELPER_Details.toObject(this._Details), HELPER_Details.toObject(otherSearchHiringTeam._Details));
}
// Compare single assocs
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_Details, HELPER_Details.toObject(getDetails()));
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
}
public static SearchHiringTeam createSearchHiringTeam (ObjectTransaction transaction) throws StorageException
{
SearchHiringTeam result = new SearchHiringTeam ();
result.initialiseNewObject (transaction);
return result;
}
public static SearchHiringTeam getSearchHiringTeamByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (SearchHiringTeam)(transaction.getObjectByID (REFERENCE_SearchHiringTeam, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Details))
{
return filter.matches (getDetails ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Details))
{
return HELPER_Details.toObject (getDetails ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Details))
{
return HELPER_Details;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_Details))
{
setDetails ((String)(HELPER_Details.fromObject (_Details, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_Details))
{
return getWriteability_Details ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_Details () != FieldWriteability.TRUE)
{
fields.add (FIELD_Details);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_Details.getAttribObject (getClass (), _Details, false, FIELD_Details));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_SearchHiringTeam.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_SearchHiringTeam.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_SearchHiringTeam.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_SearchHiringTeam.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class SearchHiringTeamBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<SearchHiringTeam>
{
/**
* Get the attribute Details
*/
public String getDetails (SearchHiringTeam obj, String original)
{
return original;
}
/**
* Change the value set for attribute Details.
* May modify the field beforehand
* Occurs before validation.
*/
public String setDetails (SearchHiringTeam obj, String newDetails) throws FieldException
{
return newDetails;
}
}
public ORMPipeLine pipes()
{
return new SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> ((SearchHiringTeam)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> pipelineSearchHiringTeam()
{
return (SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam>) pipes();
}
public static SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> pipesSearchHiringTeam(Collection<SearchHiringTeam> items)
{
return REFERENCE_SearchHiringTeam.new SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> (items);
}
public static SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> pipesSearchHiringTeam(SearchHiringTeam[] _items)
{
return pipesSearchHiringTeam(Arrays.asList (_items));
}
public static SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> pipesSearchHiringTeam()
{
return pipesSearchHiringTeam((Collection)null);
}
public class SearchHiringTeamPipeLineFactory<From extends BaseBusinessClass, Me extends SearchHiringTeam> extends SearchExecutorPipeLineFactory<From, Me>
{
public <Prev> SearchHiringTeamPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public SearchHiringTeamPipeLineFactory (From seed)
{
super(seed);
}
public SearchHiringTeamPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("Details"))
{
return toDetails ();
}
return super.to(name);
}
public PipeLine<From, String> toDetails () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Details)); }
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummySearchHiringTeam extends SearchHiringTeam
{
// Default constructor primarily to support Externalisable
public DummySearchHiringTeam()
{
super();
}
public void assertValid ()
{
}
}
package performa.search;
import oneit.objstore.BaseBusinessClass;
import performa.orm.HiringTeam;
public class SearchHiringTeam extends BaseSearchHiringTeam
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public SearchHiringTeam ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
@Override
public BaseBusinessClass[] doSearch()
{
return HiringTeam.searchAll(getTransaction());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="SearchHiringTeam" package="performa.search" superclass="SearchExecutor" >
<IMPORT value="oneit.servlets.orm.*" />
<TABLE name="it_does_not_matter" tablePrefix="object" polymorphic="FALSE" >
<ATTRIB name="Details" type="String" dbcol="xxxx" />
</TABLE>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.search;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
import oneit.servlets.orm.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class SearchHiringTeamPersistenceMgr extends SearchExecutorPersistenceMgr
{
private static final LoggingArea SearchHiringTeamPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "SearchHiringTeam");
// Private attributes corresponding to business object data
private String dummyDetails;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_Details = DefaultAttributeHelper.INSTANCE;
public SearchHiringTeamPersistenceMgr ()
{
dummyDetails = (String)(HELPER_Details.initialise (dummyDetails));
}
private String SELECT_COLUMNS = "{PREFIX}it_does_not_matter.object_id as id, {PREFIX}it_does_not_matter.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}it_does_not_matter.object_CREATED_DATE as CREATED_DATE, {PREFIX}it_does_not_matter.xxxx, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, SearchHiringTeam.REFERENCE_SearchHiringTeam);
if (objectToReturn instanceof SearchHiringTeam)
{
LogMgr.log (SearchHiringTeamPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a SearchHiringTeam");
}
}
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(id, "it_does_not_matter", PersistentSetStatus.FETCHED);
// Check for persistent sets already prefetched
if (false || !it_does_not_matterPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!it_does_not_matterPSet.containsAttrib(SearchHiringTeam.FIELD_Details))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (SearchHiringTeamPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Non Polymorphic */
SearchHiringTeam result = new SearchHiringTeam ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}it_does_not_matter " +
"WHERE " + SELECT_JOINS + "{PREFIX}it_does_not_matter.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(objectID, "it_does_not_matter");
if (it_does_not_matterPSet.getStatus () != PersistentSetStatus.PROCESSED &&
it_does_not_matterPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}it_does_not_matter " +
"SET xxxx = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE it_does_not_matter.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_Details.getForSQL(dummyDetails, it_does_not_matterPSet.getAttrib (SearchHiringTeam.FIELD_Details))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}it_does_not_matter WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "it_does_not_matter", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (SearchHiringTeamPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "it_does_not_matter");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:it_does_not_matter for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (SearchHiringTeamPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (SearchHiringTeamPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(objectID, "it_does_not_matter");
LogMgr.log (SearchHiringTeamPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (it_does_not_matterPSet.getStatus () != PersistentSetStatus.PROCESSED &&
it_does_not_matterPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}it_does_not_matter " +
"WHERE it_does_not_matter.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}it_does_not_matter WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "it_does_not_matter");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:it_does_not_matter for row:" + objectID;
LogMgr.log (SearchHiringTeamPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, SearchHiringTeam> results = new LinkedHashMap ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (SearchHiringTeam.REFERENCE_SearchHiringTeam.getObjectIDSpace (), r.getLong ("id"));
SearchHiringTeam resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, SearchHiringTeam.REFERENCE_SearchHiringTeam);
if (cachedElement instanceof SearchHiringTeam)
{
LogMgr.log (SearchHiringTeamPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (SearchHiringTeam)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a SearchHiringTeam");
}
}
else
{
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(objectID, "it_does_not_matter", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
resultElement = new SearchHiringTeam ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
results.put (objectID, resultElement);
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (SearchHiringTeamPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}it_does_not_matter " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else
{
BaseBusinessClass[] resultsArray = super.find(searchType, allPSets, criteria, context, sqlMgr);
Vector results = new Vector ();
for (int x = 0 ; x < resultsArray.length ; ++x)
{
if (resultsArray[x] instanceof SearchHiringTeam)
{
results.add (resultsArray[x]);
}
else
{
// Ignore
}
}
resultsArray = new BaseBusinessClass[results.size ()];
results.copyInto (resultsArray);
return resultsArray;
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(objectID, "it_does_not_matter", PersistentSetStatus.FETCHED);
// Object Modified
it_does_not_matterPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
it_does_not_matterPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));
it_does_not_matterPSet.setAttrib(SearchHiringTeam.FIELD_Details, HELPER_Details.getFromRS(dummyDetails, r, "xxxx"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet it_does_not_matterPSet = allPSets.getPersistentSet(objectID, "it_does_not_matter");
if (it_does_not_matterPSet.getStatus () != PersistentSetStatus.PROCESSED &&
it_does_not_matterPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}it_does_not_matter " +
" (xxxx, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_Details.getForSQL(dummyDetails, it_does_not_matterPSet.getAttrib (SearchHiringTeam.FIELD_Details))) .listEntry (objectID.longID ()).toList().toArray());
it_does_not_matterPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
Debug.assertion(hiringTeam != null , "Invalid hiring team in admin portal my company"); Debug.assertion(hiringTeam != null , "Invalid hiring team in admin portal my company");
String hiringTeamList = WebUtils.getSamePageInRenderMode(request, "Page"); String hiringTeamList = WebUtils.getSamePageInRenderMode(request, "Page");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing"); String nextPage = WebUtils.getSamePageInRenderMode(request, (hiringTeam.getIsPPJ() == null || (!hiringTeam.getIsPPJ() && hiringTeam.getPaymentPlan() == null)) ? "ManagePlan" : "Billing");
String replaceCardPage = WebUtils.getSamePageInRenderMode(request, "ReplaceCard"); String replaceCardPage = WebUtils.getSamePageInRenderMode(request, "ReplaceCard");
%> %>
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
boolean ownBilling = hiringTeam.getManageOwnBilling(); boolean ownBilling = hiringTeam.getManageOwnBilling();
String disabled = ownBilling ? "false" : "true"; String disabled = ownBilling ? "false" : "true";
String disabledClass = ownBilling ? "" : "billing-disabled"; String disabledClass = ownBilling ? "" : "billing-disabled";
boolean isAssumedUser = Utils.isAssumedUser(request);
%> %>
<oneit:dynIncluded> <oneit:dynIncluded>
...@@ -33,10 +35,9 @@ ...@@ -33,10 +35,9 @@
<% <%
RoleType userRole = companyUser.getRoleForHiringTeam(hiringTeam); RoleType userRole = companyUser.getRoleForHiringTeam(hiringTeam);
if(userRole != RoleType.STANDARD && hiringTeam.getManageOwnBilling()) if((hiringTeam.getIsPPJ() == null || (!hiringTeam.getIsPPJ() && hiringTeam.getPaymentPlan() == null) || isAssumedUser) && hiringTeam.getManageOwnBilling())
{ {
%> %>
<li class="<%= tabNumber == "2" ? "active" : ""%>"> <li class="<%= tabNumber == "2" ? "active" : ""%>">
<oneit:button value=" " name="gotoPage" skin="link" <oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", secondPage) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", secondPage)
...@@ -44,6 +45,12 @@ ...@@ -44,6 +45,12 @@
Manage Plan Manage Plan
</oneit:button> </oneit:button>
</li> </li>
<%
}
if((userRole != RoleType.STANDARD && hiringTeam.getCardID() == null || isAssumedUser) && hiringTeam.getManageOwnBilling())
{
%>
<li class="<%= tabNumber == "3" ? "active" : ""%>"> <li class="<%= tabNumber == "3" ? "active" : ""%>">
<oneit:button value=" " name="gotoPage" skin="link" <oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", thirdPage) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", thirdPage)
...@@ -51,6 +58,12 @@ ...@@ -51,6 +58,12 @@
Billing Billing
</oneit:button> </oneit:button>
</li> </li>
<%
}
if(userRole != RoleType.STANDARD && hiringTeam.getManageOwnBilling())
{
%>
<li class="<%= tabNumber == "4" ? "active" : ""%>"> <li class="<%= tabNumber == "4" ? "active" : ""%>">
<oneit:button value=" " name="gotoPage" skin="link" <oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", forthPage) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", forthPage)
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
new Comparator[]{ CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR), CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR), CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR) }); new Comparator[]{ CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR), CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR), CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR) });
Article jobsArticle = WebUtils.getArticleByShortCut(transaction, WebUtils.JOBS); Article jobsArticle = WebUtils.getArticleByShortCut(transaction, WebUtils.JOBS);
Article companyArticle = WebUtils.getArticleByShortCut(transaction, WebUtils.MY_COMPANY);
String nextPage = jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.VIEW_APPLICANTS).toMap()); String nextPage = jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.VIEW_APPLICANTS).toMap());
String shortlistPage = jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.APPLICANTS_SHORTLIST).toMap()); String shortlistPage = jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.APPLICANTS_SHORTLIST).toMap());
String homePage = WebUtils.getSamePageInRenderMode(request, "Page"); String homePage = WebUtils.getSamePageInRenderMode(request, "Page");
...@@ -75,6 +76,27 @@ ...@@ -75,6 +76,27 @@
boolean canCreateJob = Utils.allowJobCreation(hiringTeam); boolean canCreateJob = Utils.allowJobCreation(hiringTeam);
%> %>
<style>
#overlay {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,0.5);
z-index: 2;
cursor: pointer;
}
.welcome-pop-top {
margin-top: 20%;
}
.main-welcome-popup h2 {
padding: 0 20px 0;
}
</style>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() $(document).ready(function()
{ {
...@@ -92,7 +114,7 @@ ...@@ -92,7 +114,7 @@
<div class="welcome-box"> <div class="welcome-box">
<div class="dashboard-welcome"> <div class="dashboard-welcome">
<div class="welcome-text"> Welcome <br/> <%= firstTime ? "" : "back"%> <oneit:toString value="<%= secUser.getFirstName()!=null ? secUser.getFirstName() : secUser.getUserName()%>" mode="EscapeHTML"/>!</div> <div class="welcome-text"> Welcome <br/> <%= firstTime ? "" : "back"%> <oneit:toString value="<%= secUser.getFirstName()!=null ? secUser.getFirstName() : secUser.getUserName()%>" mode="EscapeHTML"/>!</div>
<a class="d-create-job-btn <%= canCreateJob ? "" : "disabled"%>" href="<%= canCreateJob ? jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.CREATE_JOB).toMap()) : "#" %>">Create a Job</a> <a class="d-create-job-btn <%= canCreateJob ? "" : "disabled"%>" href="<%= canCreateJob ? jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.START_JOB).toMap()) : "#" %>">Create a Job</a>
</div> </div>
<div class="col-sm-3 col-xs-12 d-three-box green-light"> <div class="col-sm-3 col-xs-12 d-three-box green-light">
<div class="d-fl-left eq-height"> <div class="d-fl-left eq-height">
...@@ -195,7 +217,56 @@ ...@@ -195,7 +217,56 @@
</div> </div>
</div> </div>
</oneit:form> </oneit:form>
<%
if(hiringTeam.getCardID() == null)
{
%>
<oneit:form name="setupBilling" method="post" enctype="multipart/form-data">
<div id="overlay">
<div class="modal-dialog welcome-pop-top">
<div class="modal-body main-welcome-popup">
<h2>You haven't set up billing yet!</h2>
<p>Please set up billing details before creating jobs.</p>
<div class="create-y-f-job">
<oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", companyArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "Billing").toMap()))
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.toMap() %>">
Setup Billing
</oneit:button>
</div>
</div>
</div>
</div>
</oneit:form>
<%
}
else if(hiringTeam.getIsPPJ() == null || (!hiringTeam.getIsPPJ() && hiringTeam.getPaymentPlan() == null))
{
%>
<oneit:form name="setupPlan" method="post" enctype="multipart/form-data">
<div id="overlay">
<div class="modal-dialog welcome-pop-top">
<div class="modal-body main-welcome-popup">
<h2>You haven't set up a payment plan yet!</h2>
<p>Please select a payment plan before creating jobs</p>
<div class="create-y-f-job">
<oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", companyArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "ManagePlan").toMap()))
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.toMap() %>">
Setup Payment Plan
</oneit:button>
</div>
</div>
</div>
</div>
</oneit:form>
<%
}
%>
<!-- not using --> <!-- not using -->
<div class="modal fade" id="welcomepopup" role="dialog"> <div class="modal fade" id="welcomepopup" role="dialog">
<div class="modal-dialog welcome-pop-top"> <div class="modal-dialog welcome-pop-top">
......
...@@ -7,4 +7,11 @@ ...@@ -7,4 +7,11 @@
<FORM name="*.testAnalysis" factory="Participant" class="performa.form.TestAnalysisFP"/> <FORM name="*.testAnalysis" factory="Participant" class="performa.form.TestAnalysisFP"/>
</NODE> </NODE>
<NODE name="customers_jsp" factory="Participant">
<INHERITS factory="Named" nodename="CoreORMAdmin"/>
<FORM name="*.assume" factory="Participant" class="performa.form.AssumeHTAdminFP">
<NODE name="loginFP" factory="Named" nodename="CMSLoginFP"/>
</FORM>
</NODE>
</OBJECTS> </OBJECTS>
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<!-- <TOPMENU name="MENU.TEST_ANALYSIS" desc="Test Analysis" sortOrder="100" factory="Participant" class="oneit.servlets.jsp.ui.DefaultUICustomiser$Element" <!-- <TOPMENU name="MENU.TEST_ANALYSIS" desc="Test Analysis" sortOrder="100" factory="Participant" class="oneit.servlets.jsp.ui.DefaultUICustomiser$Element"
link="/extensions/performa/testAnalysis.jsp"/> --> link="/extensions/performa/testAnalysis.jsp"/> -->
<CHILD name="Performa.Customers" desc="Customers" sortOrder="10" toplevel="ADMIN" priv="admin" link="/extensions/performa/customers.jsp" factory="Participant" class="oneit.servlets.jsp.ui.DefaultUICustomiser$Element" />
</NODE> </NODE>
......
<%@ page extends="oneit.servlets.jsp.FormJSP"%>
<%@ include file="/setuprequest.jsp"%>
<%@ include file="inc/stdimports.jsp"%>
<%@ include file="/editor/stdimports.jsp"%>
<%@ page import="oneit.security.jsp.*" %>
<%! protected String getName (ServletConfig config) { return "customers_jsp"; } %>
<%
ORMProcessState process = (ORMProcessState) ProcessDecorator.getDefaultProcess(request);
ObjectTransaction objTran = process.getTransaction ();
String currentPage = request.getContextPath() + "/extensions/performa/customers.jsp";
SecUser secUser = SecUser.getTXUser(objTran);
UserSortOption userSortOpt = (UserSortOption) process.getAttribute("UserSortOption");
SearchHiringTeam searchHT = (SearchHiringTeam) RunSearchExecutorFP.setupExecutor(request, SearchHiringTeam.REFERENCE_SearchHiringTeam, true);
HiringTeam[] hiringTeams = (HiringTeam[]) process.getAttribute("HiringTeams");
if(hiringTeams == null)
{
hiringTeams = (HiringTeam[]) searchHT.doSearch();
}
if (getData (request, GenericObjSearchDF.GENERIC_SEARCH_RESULTS) != null)
{
hiringTeams = (HiringTeam[])getData (request, GenericObjSearchDF.GENERIC_SEARCH_RESULTS);
}
process.setAttribute("HiringTeams", hiringTeams);
if( request.getParameter("UserSortOption") != null)
{
userSortOpt = UserSortOption.forName((String) request.getParameter("UserSortOption"));
}
if(userSortOpt == null)
{
userSortOpt = UserSortOption.ALPHA_A_Z;
}
process.setAttribute("UserSortOption", userSortOpt);
// process.setAttribute( SecProcessConstants.SEC_USER , secUser);
Collection<HiringTeam> sortedHiringTeams = Utils.getHiringTeamsSorted(Arrays.asList(hiringTeams), userSortOpt);
request.setAttribute("oneit.pageFormDetails", CollectionUtils.mapEntry("name", "Customers").mapEntry("enctype", "multipart/form-data").toMap());
request.setAttribute("oneit.pageHeaderTitle", "Customers");
%>
<%@include file="/editor/header.jsp"%>
<oneit:css>
<oneit:css href="/css/common.css" />
</oneit:css>
<style>
.dashboard-content-area {
margin-top: 0px ;
width: 100%;
}
</style>
<div class="dashboard-content-area second-part">
<div class="jobs-list-shorting">
<div class="d-job-title all-jobs-title">Customers</div>
<div class="shorting-dropdown">
<span class="order-label">order by</span>
<select class="form-control" onChange="location=this.value">
<%
for (UserSortOption sortOption : UserSortOption.getUserSortOptionArray())
{
String optionLink = currentPage + "?UserSortOption=" + sortOption.getName() ;
%>
<option <%= (userSortOpt != null && userSortOpt == sortOption ? "selected" : "" )%> value="<%= optionLink %>">
<oneit:toString value="<%= sortOption.getDescription() %>" mode="EscapeHTML"/>
</option>
<%
}
%>
</select>
</div>
</div>
<div class="main-client-list">
<%
for(HiringTeam hiringTeam : sortedHiringTeams)
{
Job[] filledJobs = Job.SearchByAll().andJobStatus(new EqualsFilter<>(JobStatus.FILLED))
.andHiringTeam(new EqualsFilter<>(hiringTeam))
.search(objTran);
int filledCount = filledJobs != null ? filledJobs.length : 0;
Job[] openJobs = Job.SearchByAll().andJobStatus(new EqualsFilter<>(JobStatus.OPEN))
.andHiringTeam(new EqualsFilter<>(hiringTeam))
.search(objTran);
int openCount = openJobs != null ? openJobs.length : 0;
int clientCount = hiringTeam.pipelineHiringTeam().toClients().uniqueVals().size();
%>
<div class="client-list" id="<%= hiringTeam.getID() %>">
<div class="client-row" >
<div class="client-name-cell jl-c" style="width:50%;">
<div class="client-name">
<a href="<%= "&ClientID="+hiringTeam.getObjectID() %>">
<oneit:toString value="<%= hiringTeam.getHiringTeamName() %>" mode="EscapeHTML" />
</a>
</div>
</div>
</div>
<div class="<%= "application-count jl-c " + (clientCount == 0 ? "opaque-jobcount" : "")%>">
<oneit:toString value="<%= clientCount %>" mode="EscapeHTML" nullValue="0"/>
<span class="grey-span">Clients</span>
</div>
<div class="<%= "application-count jl-c " + (openCount == 0 ? "opaque-jobcount" : "")%>">
<oneit:toString value="<%= openCount %>" mode="EscapeHTML" nullValue="0"/>
<span class="grey-span">Open Jobs</span>
</div>
<div class="<%= "application-count jl-c " + (filledCount == 0 ? "opaque-jobcount" : "")%>">
<oneit:toString value="<%= filledCount %>" mode="EscapeHTML" nullValue="0"/>
<span class="grey-span">Jobs Filled</span>
</div>
<div class="application-count jl-c" style="width:20%;">
<oneit:button value="Login as Admin" name="assume" cssClass="btn btn-primary loginAsAdmin"
requestAttribs="<%= CollectionUtils.mapEntry("HiringTeam", hiringTeam)
.toMap()%>"/>
</div>
</div>
<%
}
%>
</div>
</div>
<%@include file="/editor/footer.jsp"%>
\ 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