19 package org.turro.contacts.form;
22 import java.util.ArrayList;
23 import java.util.HashMap;
24 import java.util.List;
26 import java.util.function.Consumer;
27 import java.util.logging.Level;
28 import java.util.logging.Logger;
29 import org.turro.action.queue.ConstraintKeys;
30 import org.turro.auth.Authentication;
31 import org.turro.contacts.Address;
32 import org.turro.contacts.Connector;
33 import org.turro.contacts.Contact;
34 import org.turro.contacts.FieldValue;
35 import org.turro.contacts.db.ContactsPU;
36 import org.turro.contacts.duplicates.DuplicatesModel;
37 import org.turro.contacts.util.PairedFile;
38 import org.turro.elephant.context.Application;
39 import org.turro.elephant.context.ElephantContext;
40 import org.turro.elephant.db.WhereClause;
41 import org.turro.i18n.I_;
42 import org.turro.jpa.Dao;
43 import org.turro.jpa.entity.DaoEntity;
44 import org.turro.mail.queue.QueueManager;
45 import org.turro.zkoss.dialog.Windows;
53 private Map<String, Connector> connector;
54 private Map<String, FieldValue> field;
55 private Map<String, Address> address;
66 return I_.
get(
"Contact");
72 }
catch(Exception ex) {
83 public boolean delete() {
99 }
catch (Exception ex) {
111 if(address ==
null) {
112 address =
new HashMap<>();
114 address.put(a.getDescription(), a);
121 if(connector ==
null) {
122 connector =
new HashMap<>();
124 connector.put(c.getDescription(), c);
132 field =
new HashMap<>();
134 field.put(fv.getFieldDef().getTabKey() +
"," + fv.getFieldDef().getLabelKey(), fv);
149 return "/_internal/files/contact/" +
entity.getId();
153 return "/WEB-INF/files/contact/" +
entity.getId();
162 List<String> files =
new ArrayList<>();
164 for(File f : root.listFiles()) {
166 files.add(folder +
"/" + f.getName());
175 List<PairedFile> files =
new ArrayList<>();
177 for(File f : root.listFiles()) {
179 files.add(
new PairedFile(folder, f.getName(), folder +
"/thumbs",
".png"));
188 wc.
addClause(
"delete from BusinessRelation as relation");
189 wc.
addClause(
"where relation.contact = :contact or relation.business = :contact");
196 if(dupmodel.isEmpty()) {
197 onSave.accept(contact);
203 Map.of(
"contact", contact,
"dupmodel", dupmodel,
"onSave", onSave))
static ConstraintKeys from(IContact contact)
static IContact getIContact()
static boolean isLogged(IContact contact)
static Application getApplication()
static String getRealPath(String path)
static String logMsg(String msg)
void addClause(String clause)
void addNamedValue(String name, Object value)
static String get(String msg)
int executeUpdate(String query)
void subscribeDefaults(ConstraintKeys keys)
static Windows title(String title)
Windows addComponent(HtmlBasedComponent component)
Windows width(String width)
Windows height(String height)