19 package org.turro.financials.handshake;
21 import com.google.gson.Gson;
23 import java.io.IOException;
24 import java.util.Objects;
25 import java.util.logging.Level;
26 import java.util.logging.Logger;
27 import org.turro.elephant.context.ElephantContext;
28 import org.turro.elephant.impl.util.FileUtil;
29 import org.turro.financials.db.FinancialsPU;
30 import org.turro.financials.entity.Company;
31 import org.turro.financials.entity.Contract;
32 import org.turro.financials.entity.ContractHandshake;
33 import org.turro.financials.model.business.CompanyWrapper;
34 import org.turro.jpa.Dao;
35 import org.turro.util.IdGenerator;
43 public final static String
54 return new Gson().toJson(hc);
79 }
catch (IOException ex) {
88 }
catch (IOException ex) {
106 "select ch from ContractHandshake ch " +
107 "where ch.remoteServer = ? " +
108 "and ch.remoteId = ?",
124 if(!folder.exists()) { folder.mkdirs(); }
125 for(File file : folder.listFiles()) {
137 "update ContractHandshake " +
138 "set remoteId = ? " +
139 "where remoteServer = ? " +
140 "and contract.id = ?",
151 hash = 89 * hash + (int) (this.remoteId ^ (this.remoteId >>> 32));
152 hash = 89 * hash + Objects.hashCode(this.remoteServer);
161 if (getClass() != obj.getClass()) {
165 if (this.remoteId != other.
remoteId) {
168 if (!Objects.equals(
this.remoteServer, other.
remoteServer)) {
static String getRealPath(String path)
static String getServerUrl(String scheme)
static String logMsg(String msg)
static void setContent(File file, String value)
static String getContent(File file)
static Contract getContractFromRemoteContract(String value)
static void saveHandshakeToFile(File file, HandshakeContract hc)
static Contract getContractFromHandshake(HandshakeContract hc)
static void saveHandshakePetition(HandshakeContract hc)
boolean equals(Object obj)
static String createJsonFromContract(Contract contract)
static ContractHandshake getContractHandshakeFromHandshake(HandshakeContract hc)
static boolean updateRemoteId(String remoteServer, String remoteId, long contractId)
static HandshakeContract createHandshakeFromContract(Contract contract)
static HandshakeContract createHandshakeFromJson(String value)
static boolean existsHandshake(HandshakeContract hc)
static final String HANDSHAKE_FOLDER
static HandshakeContract createHandshakeFromFile(File file)
static Company getDefaultCompany()
int executeUpdate(String query)
Object getSingleResultOrNull(SqlClause sc)