BrightSide Workbench Full Report + Source Code
org.turro.financials.handshake.HandshakeItem Class Reference

Public Member Functions

 HandshakeItem (File file, Object handshake)
 
File getFile ()
 
String getFrom ()
 
String getDescription ()
 
HandshakeItemStatus getStatus ()
 
String getConnectImage ()
 
String getCreateImage ()
 
boolean deleteFile ()
 
void connect (Command command)
 
boolean create ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 54 of file HandshakeItem.java.

Constructor & Destructor Documentation

◆ HandshakeItem()

org.turro.financials.handshake.HandshakeItem.HandshakeItem ( File  file,
Object  handshake 
)

Definition at line 59 of file HandshakeItem.java.

59  {
60  this.file = file;
61  this.handshake = handshake;
62  }

Member Function Documentation

◆ connect()

void org.turro.financials.handshake.HandshakeItem.connect ( Command  command)

Definition at line 155 of file HandshakeItem.java.

155  {
156  if(handshake instanceof HandshakeContract) {
157  HandshakeContract hc = (HandshakeContract) handshake;
158  connectContract(hc, command);
159  } else if(handshake instanceof HandshakeDocument) {
160  // no connection to document
161  } else if(handshake instanceof HandshakeProduct) {
162  HandshakeProduct hp = (HandshakeProduct) handshake;
163  connectProduct(hp, command);
164  }
165  }

◆ create()

boolean org.turro.financials.handshake.HandshakeItem.create ( )

Definition at line 244 of file HandshakeItem.java.

244  {
245  if(handshake instanceof HandshakeContract) {
246  // no new contract
247  } else if(handshake instanceof HandshakeDocument) {
248  if(createDocument((HandshakeDocument) handshake)) return true;
249  } else if(handshake instanceof HandshakeProduct) {
250  HandshakeProduct hp = (HandshakeProduct) handshake;
251  if(createProduct(hp)) return true;
252  }
253  return false;
254  }

◆ deleteFile()

boolean org.turro.financials.handshake.HandshakeItem.deleteFile ( )

Definition at line 151 of file HandshakeItem.java.

151  {
152  return file.delete();
153  }

◆ getConnectImage()

String org.turro.financials.handshake.HandshakeItem.getConnectImage ( )

Definition at line 129 of file HandshakeItem.java.

129  {
130  if(handshake instanceof HandshakeContract) {
131  return Images.getImage("contract");
132  } else if(handshake instanceof HandshakeDocument) {
133  // no connection to document
134  } else if(handshake instanceof HandshakeProduct) {
135  return Images.getImage("product");
136  }
137  return null;
138  }
Here is the call graph for this function:

◆ getCreateImage()

String org.turro.financials.handshake.HandshakeItem.getCreateImage ( )

Definition at line 140 of file HandshakeItem.java.

140  {
141  if(handshake instanceof HandshakeContract) {
142  // no new contract
143  } else if(handshake instanceof HandshakeDocument) {
144  return Images.getImage("document_new");
145  } else if(handshake instanceof HandshakeProduct) {
146  return Images.getImage("product_new");
147  }
148  return null;
149  }
Here is the call graph for this function:

◆ getDescription()

String org.turro.financials.handshake.HandshakeItem.getDescription ( )

Definition at line 83 of file HandshakeItem.java.

83  {
84  if(handshake instanceof HandshakeContract) {
85  HandshakeContract hc = (HandshakeContract) handshake;
86  return hc.remoteName;
87  } else if(handshake instanceof HandshakeDocument) {
88  HandshakeDocument hd = (HandshakeDocument) handshake;
89  return hd.documentName + " " + hd.documentNumber + ", " + DateFormats.format(hd.documentDate, true);
90  } else if(handshake instanceof HandshakeProduct) {
91  HandshakeProduct hp = (HandshakeProduct) handshake;
92  return hp.description;
93  }
94  return null;
95  }
Here is the call graph for this function:

◆ getFile()

File org.turro.financials.handshake.HandshakeItem.getFile ( )

Definition at line 64 of file HandshakeItem.java.

64  {
65  return file;
66  }

◆ getFrom()

String org.turro.financials.handshake.HandshakeItem.getFrom ( )

Definition at line 68 of file HandshakeItem.java.

68  {
69  if(handshake instanceof HandshakeContract) {
70  HandshakeContract hc = (HandshakeContract) handshake;
71  return hc.petitioner;
72  } else if(handshake instanceof HandshakeDocument) {
73  HandshakeDocument hd = (HandshakeDocument) handshake;
74  HandshakeContract hc = hd.contract;
75  return hc.petitioner;
76  } else if(handshake instanceof HandshakeProduct) {
77  HandshakeProduct hp = (HandshakeProduct) handshake;
78  return hp.petitioner;
79  }
80  return null;
81  }

◆ getStatus()

HandshakeItemStatus org.turro.financials.handshake.HandshakeItem.getStatus ( )

Definition at line 97 of file HandshakeItem.java.

97  {
98  if(handshake instanceof HandshakeContract) {
99  HandshakeContract hc = (HandshakeContract) handshake;
100  Contract contract = HandshakeContract.getContractFromHandshake(hc);
101  if(contract != null) {
102  return HandshakeItemStatus.HSITEM_EXISTS;
103  } else {
104  return HandshakeItemStatus.HSITEM_NEW;
105  }
106  } else if(handshake instanceof HandshakeDocument) {
107  HandshakeDocument hd = (HandshakeDocument) handshake;
108  Contract contract = HandshakeContract.getContractFromHandshake(hd.contract);
109  if(contract != null) {
110  Document document = HandshakeDocument.getDocumentFromHandshake(contract, hd);
111  if(document != null) {
112  return HandshakeItemStatus.HSITEM_EXISTS;
113  } else {
114  return HandshakeItemStatus.HSITEM_NEW;
115  }
116  }
117  } else if(handshake instanceof HandshakeProduct) {
118  HandshakeProduct hp = (HandshakeProduct) handshake;
119  Product product = HandshakeProduct.getProductFromHandshake(hp);
120  if(product != null) {
121  return HandshakeItemStatus.HSITEM_EXISTS;
122  } else {
123  return HandshakeItemStatus.HSITEM_NEW;
124  }
125  }
126  return null;
127  }
Here is the call graph for this function:

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