Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/expand project type #174

Closed
wants to merge 10 commits into from
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.autentia.tnt.businessobject;

public enum BillingType {
NO_BILLABLE, CLOSED_PRICE, TIME_AND_MATERIALS, TIME_AND_MATERIALS_LIMITED, BUNDLE_OF_HOURS
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;

import org.acegisecurity.acls.objectidentity.ObjectIdentityImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.autentia.tnt.dao.ITransferObject;




/**
* Transfer object to store Projects
* @author stajanov code generator
Expand Down Expand Up @@ -90,10 +90,10 @@ public boolean isFinished(){



private Boolean billable;


private BillingType billingType;



private Integer ownerId;


Expand Down Expand Up @@ -189,16 +189,6 @@ public void setDescription( String description ) {
}



public Boolean getBillable() {
return billable;
}
public void setBillable( Boolean billable ) {
this.billable = billable;
}



public Integer getOwnerId() {
return ownerId;
}
Expand Down Expand Up @@ -259,6 +249,18 @@ public void setCosts( Set<ProjectCost> costs ) {
}


// TODO: remove this method (used in activityBean - deprecated)
public Boolean getBillable(){
return false;
}
public BillingType getBillingType() {
return billingType;
}
public void setBillingType(BillingType billingType) {
this.billingType = billingType;
}


public BigDecimal getEstimatedCost() { return estimatedCost; }

public void setEstimatedCost(BigDecimal estimatedCost) { this.estimatedCost = estimatedCost; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,22 @@ public String getHQL() {
}
}

if (isBillableSet()) {
ret.append((ret.length() == 0) ? "WHERE " : " AND ");
if (getBillable() == null) {
ret.append("billable is NULL");
} else {
ret.append("billable = :arg" + (iArgNum++));
}

if( isBillingTypeSet() ){
ret.append( (ret.length()==0) ? "WHERE " : " AND " );
if( getBillingType()==null ){
ret.append( "billingType is NULL" );
} else {
ret.append( "billingType = :arg"+(iArgNum++) );
}
}


if (isOwnerIdSet()) {
ret.append((ret.length() == 0) ? "WHERE " : " AND ");
if (getOwnerId() == null) {
ret.append("ownerId is NULL");

if( isOwnerIdSet() ){
ret.append( (ret.length()==0) ? "WHERE " : " AND " );
if( getOwnerId()==null ){
ret.append( "ownerId is NULL" );
} else {
ret.append("ownerId = :arg" + (iArgNum++));
}
Expand Down Expand Up @@ -241,12 +244,12 @@ public Object[] getArguments() {
ret.add(description);
}

if (isBillableSet() && getBillable() != null) {
ret.add(billable);
if( isBillingTypeSet() && getBillingType()!=null ){
ret.add( billingType );
}

if (isOwnerIdSet() && getOwnerId() != null) {
ret.add(ownerId);
if( isOwnerIdSet() && getOwnerId()!=null ){
ret.add( ownerId );
}

if (isDepartmentIdSet() && getDepartmentId() != null) {
Expand Down Expand Up @@ -312,19 +315,33 @@ public void reset() {
unsetStartEndDate();
unsetEndEndDate();

unsetOpen();

unsetName();

unsetDescription();

unsetBillable();

unsetOwnerId();

unsetDepartmentId();

unsetStartInsertDate();


unsetOpen();



unsetName();



unsetDescription();



unsetBillingType();



unsetOwnerId();



unsetDepartmentId();



unsetStartInsertDate();
unsetEndInsertDate();

unsetStartUpdateDate();
Expand Down Expand Up @@ -372,10 +389,76 @@ public String toString() {
ret.append(")");
}

if (isOpenSet()) {
ret.append("(open");
ret.append("=" + open);
ret.append(")");



if( isOpenSet() ){
ret.append( "(open" );
ret.append( "="+open );
ret.append( ")" );
}





if( isNameSet() ){
ret.append( "(name" );
ret.append( "="+name );
ret.append( ")" );
}





if( isDescriptionSet() ){
ret.append( "(description" );
ret.append( "="+description );
ret.append( ")" );
}




if( isBillingTypeSet() ){
ret.append( "(billingType" );
ret.append( "="+billingType );
ret.append( ")" );
}




if( isOwnerIdSet() ){
ret.append( "(ownerId" );
ret.append( "="+ownerId );
ret.append( ")" );
}





if( isDepartmentIdSet() ){
ret.append( "(departmentId" );
ret.append( "="+departmentId );
ret.append( ")" );
}





if( isStartInsertDateSet() ){
ret.append( "(startInsertDate" );
ret.append( "="+startInsertDate );
ret.append( ")" );
}
if( isEndInsertDateSet() ){
ret.append( "(endInsertDate" );
ret.append( "="+endInsertDate );
ret.append( ")" );
}

if (isNameSet()) {
Expand All @@ -390,12 +473,6 @@ public String toString() {
ret.append(")");
}

if (isBillableSet()) {
ret.append("(billable");
ret.append("=" + billable);
ret.append(")");
}

if (isOwnerIdSet()) {
ret.append("(ownerId");
ret.append("=" + ownerId);
Expand Down Expand Up @@ -595,21 +672,18 @@ public void unsetDescription() {
this.descriptionSet = false;
}

public boolean isBillableSet() {
return billableSet;
public boolean isBillingTypeSet(){
return billingTypeSet;
}

public Boolean getBillable() {
return billable;
public BillingType getBillingType(){
return billingType;
}

public void setBillable(Boolean billable) {
this.billable = billable;
this.billableSet = true;
public void setBillingType( BillingType billingType ){
this.billingType = billingType;
this.billingTypeSet = true;
}

public void unsetBillable() {
this.billableSet = false;
public void unsetBillingType(){
this.billingTypeSet = false;
}

public boolean isOwnerIdSet() {
Expand Down Expand Up @@ -837,8 +911,8 @@ public void unsetCosts() {
private boolean descriptionSet;
private String description;

private boolean billableSet;
private Boolean billable;
private boolean billingTypeSet;
private BillingType billingType;

private boolean ownerIdSet;
private Integer ownerId;
Expand Down Expand Up @@ -873,13 +947,14 @@ public void unsetCosts() {

private boolean costsSet;
private List<ProjectCost> costs;



// Returns if there are a search condition active
public boolean isSearchActive() {
return customIsSearchActive() || startStartDateSet || endStartDateSet || startEndDateSet || endEndDateSet || openSet
|| nameSet || descriptionSet || billableSet || ownerIdSet || departmentIdSet || startInsertDateSet
|| nameSet || descriptionSet || ownerIdSet || departmentIdSet || startInsertDateSet
|| endInsertDateSet || startUpdateDateSet || endUpdateDateSet || clientSet || rolesSet || costsSet || offerSet
|| estimatedCostSet || orderSet;
|| estimatedCostSet || orderSet || billingTypeSet;
}

/* generated by stajanov (do not edit/delete) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@
<key column="projectId" />
<one-to-many class="com.autentia.tnt.businessobject.ProjectCost" />
</set>
<property name="billable" type="java.lang.Boolean" />
<property name="ownerId" type="java.lang.Integer" column="ownerId"/>
<property name="departmentId" type="java.lang.Integer" column="departmentId"/>
<property name="insertDate" type="java.util.Date" column="insertDate" insert="false" update="false"/>
<property name="updateDate" type="java.util.Date" column="updateDate" insert="false" update="false"/>
<many-to-one name="offer" class="com.autentia.tnt.businessobject.Offer" column="offerId" unique="true" />
<property name="billingType" not-null="true" column="billingType">
<type name="com.autentia.tnt.util.GenericEnumUserType">
<param name="enumClassName">com.autentia.tnt.businessobject.BillingType</param>
</type>
</property>
<property name="order" type="java.lang.String" column="orderNumber"/>
<property name="estimatedCost" type="java.math.BigDecimal" column="estimatedCost"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ private Project createProject() {
project.setOwnerId(1);
project.setDepartmentId(1);
project.setStartDate(new Date());
project.setBillable(false);
project.setOpen(true);
project.setClient(organization);

Expand Down
Loading
Loading