BrightSide Workbench Full Report + Source Code
org.turro.financials.model.product.ProductWrapper Class Reference
Inheritance diagram for org.turro.financials.model.product.ProductWrapper:
Collaboration diagram for org.turro.financials.model.product.ProductWrapper:

Public Member Functions

 ProductWrapper (Product entity)
 
boolean canDelete ()
 
Product save (List< ProductByContractor > pbc)
 
boolean canSave ()
 
- Public Member Functions inherited from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >
 DaoEntity ()
 
 DaoEntity (Class< T > persistentClass)
 
 DaoEntity (T entity)
 
Dao getDao ()
 
getEntity ()
 
IElephantEntity getIee ()
 
find (ID id)
 
save ()
 
boolean delete ()
 
ID getId ()
 
List< String > getMessages ()
 
boolean equals (Object obj)
 
int hashCode ()
 

Static Public Member Functions

static boolean hasAvailableContractorProducts (Contract contract)
 
static boolean hasAvailableProducts ()
 
- Static Public Member Functions inherited from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >
static Object getEntityId (Object entity)
 
static boolean isNewId (Object id)
 

Protected Member Functions

Dao createDao ()
 
boolean shouldLog ()
 
- Protected Member Functions inherited from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >
void logEntity (SystemLogType logType, Object entity, String action, String data)
 
String dataEntity (Object entity)
 
void initOperation ()
 
void addMessage (String message)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >
entity
 
ID id
 
List< String > messages = new ArrayList<>()
 

Detailed Description

Constructor & Destructor Documentation

◆ ProductWrapper()

org.turro.financials.model.product.ProductWrapper.ProductWrapper ( Product  entity)

Member Function Documentation

◆ canDelete()

boolean org.turro.financials.model.product.ProductWrapper.canDelete ( )

Reimplemented from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >.

Definition at line 44 of file bsfinancials-core/src/main/java/org/turro/financials/model/product/ProductWrapper.java.

44  {
45  if(!super.canDelete()) return false;
46  Long count = (Long) getDao().getSingleResult(
47  "select count(*) from DocumentLine " +
48  "where product = ?",
49  new Object[] { entity });
50  if(count == 0) {
51  count = (Long) getDao().getSingleResult(
52  "select count(*) from DocumentLine " +
53  "where productByContractor.product = ?",
54  new Object[] { entity });
55  }
56  return count == 0;
57  }
Object getSingleResult(WhereClause wc)
Definition: Dao.java:380
Here is the call graph for this function:

◆ canSave()

boolean org.turro.financials.model.product.ProductWrapper.canSave ( )

Reimplemented from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >.

Reimplemented in org.turro.financials.product.logic.ProductWrapper.

Definition at line 73 of file bsfinancials-core/src/main/java/org/turro/financials/model/product/ProductWrapper.java.

73  {
74  Long count = entity.getId() > 0 ? 0 : (Long) getDao().getSingleResult(
75  "select count(*) from Product " +
76  "where productCode = ?",
77  new Object[] { entity.getProductCode() });
78  return count == 0;
79  }
Here is the call graph for this function:

◆ createDao()

Dao org.turro.financials.model.product.ProductWrapper.createDao ( )
protected

◆ hasAvailableContractorProducts()

static boolean org.turro.financials.model.product.ProductWrapper.hasAvailableContractorProducts ( Contract  contract)
static

Definition at line 81 of file bsfinancials-core/src/main/java/org/turro/financials/model/product/ProductWrapper.java.

81  {
82  Dao dao = new FinancialsPU();
83  Long result = (Long) dao.getSingleResult(
84  "select count(pbp) from ProductByContractor as pbp " +
85  "where pbp.contract = ?",
86  new Object[] {
87  contract
88  }
89  );
90  if(result == null || result == 0) {
91  return false;
92  }
93  return true;
94  }
Here is the call graph for this function:

◆ hasAvailableProducts()

static boolean org.turro.financials.model.product.ProductWrapper.hasAvailableProducts ( )
static

Definition at line 96 of file bsfinancials-core/src/main/java/org/turro/financials/model/product/ProductWrapper.java.

96  {
97  Dao dao = new FinancialsPU();
98  Long result = (Long) dao.getSingleResult(
99  "select count(p) from Product as p"
100  );
101  if(result == null || result == 0) {
102  return false;
103  }
104  return true;
105  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save()

Product org.turro.financials.model.product.ProductWrapper.save ( List< ProductByContractor pbc)

Definition at line 64 of file bsfinancials-core/src/main/java/org/turro/financials/model/product/ProductWrapper.java.

64  {
65  if(pbc != null) {
66  entity.getProductByContractors().clear();
67  entity.getProductByContractors().addAll(pbc);
68  }
69  return save();
70  }
Here is the call graph for this function:

◆ shouldLog()

boolean org.turro.financials.model.product.ProductWrapper.shouldLog ( )
protected

The documentation for this class was generated from the following file: