BrightSide Workbench Full Report + Source Code
org.turro.contacts.form.ContactWrapper Class Reference
Inheritance diagram for org.turro.contacts.form.ContactWrapper:
Collaboration diagram for org.turro.contacts.form.ContactWrapper:

Public Member Functions

 ContactWrapper (Contact entity)
 
String getTabLabel ()
 
String getSelfLabel ()
 
String getTooltiptext ()
 
boolean delete ()
 
Contact save ()
 
Map< String, AddressgetAddress ()
 
Map< String, ConnectorgetConnector ()
 
Map< String, FieldValuegetField ()
 
boolean isSelf ()
 
boolean isInBusiness ()
 
String getPublishable ()
 
String getPrivate ()
 
String getFace ()
 
List< String > getFiles (String folder)
 
List< PairedFilegetImageFiles (String folder)
 
- 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)
 
ID getId ()
 
List< String > getMessages ()
 
boolean canDelete ()
 
boolean canSave ()
 
boolean equals (Object obj)
 
int hashCode ()
 

Static Public Member Functions

static void clearRelations (Dao dao, Contact contact)
 
static void saveAnyway (Contact contact, Consumer< Contact > onSave)
 
- 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

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

Definition at line 51 of file ContactWrapper.java.

Constructor & Destructor Documentation

◆ ContactWrapper()

org.turro.contacts.form.ContactWrapper.ContactWrapper ( Contact  entity)

Definition at line 57 of file ContactWrapper.java.

57  {
58  super(entity);
59  }

Member Function Documentation

◆ clearRelations()

static void org.turro.contacts.form.ContactWrapper.clearRelations ( Dao  dao,
Contact  contact 
)
static

Definition at line 186 of file ContactWrapper.java.

186  {
187  WhereClause wc = new WhereClause();
188  wc.addClause("delete from BusinessRelation as relation");
189  wc.addClause("where relation.contact = :contact or relation.business = :contact");
190  wc.addNamedValue("contact", contact);
191  dao.executeUpdate(wc);
192  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createDao()

Dao org.turro.contacts.form.ContactWrapper.createDao ( )
protected

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

Definition at line 78 of file ContactWrapper.java.

78  {
79  return new ContactsPU();
80  }

◆ delete()

boolean org.turro.contacts.form.ContactWrapper.delete ( )

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

Definition at line 83 of file ContactWrapper.java.

83  {
84  entity.checkEmptyness();
85  if(super.delete()) {
86  Application app = Application.getApplication();
88  return true;
89  }
90  return false;
91  }
static void clearRelations(Dao dao, Contact contact)
Here is the call graph for this function:

◆ getAddress()

Map<String, Address> org.turro.contacts.form.ContactWrapper.getAddress ( )

Definition at line 110 of file ContactWrapper.java.

110  {
111  if(address == null) {
112  address = new HashMap<>();
113  for(Address a : entity.getAddresses()) {
114  address.put(a.getDescription(), a);
115  }
116  }
117  return address;
118  }

◆ getConnector()

Map<String, Connector> org.turro.contacts.form.ContactWrapper.getConnector ( )

Definition at line 120 of file ContactWrapper.java.

120  {
121  if(connector == null) {
122  connector = new HashMap<>();
123  for(Connector c : entity.getConnectors()) {
124  connector.put(c.getDescription(), c);
125  }
126  }
127  return connector;
128  }

◆ getFace()

String org.turro.contacts.form.ContactWrapper.getFace ( )

Definition at line 156 of file ContactWrapper.java.

156  {
157  return getPublishable() + "/profile/face.png";
158  }
Here is the call graph for this function:

◆ getField()

Map<String, FieldValue> org.turro.contacts.form.ContactWrapper.getField ( )

Definition at line 130 of file ContactWrapper.java.

130  {
131  if(field == null) {
132  field = new HashMap<>();
133  for(FieldValue fv : entity.getFieldValues()) {
134  field.put(fv.getFieldDef().getTabKey() + "," + fv.getFieldDef().getLabelKey(), fv);
135  }
136  }
137  return field;
138  }

◆ getFiles()

List<String> org.turro.contacts.form.ContactWrapper.getFiles ( String  folder)

Definition at line 160 of file ContactWrapper.java.

160  {
161  File root = new File(ElephantContext.getRealPath(folder));
162  List<String> files = new ArrayList<>();
163  if(root.exists()) {
164  for(File f : root.listFiles()) {
165  if(f.isFile()) {
166  files.add(folder + "/" + f.getName());
167  }
168  }
169  }
170  return files;
171  }
Here is the call graph for this function:

◆ getImageFiles()

List<PairedFile> org.turro.contacts.form.ContactWrapper.getImageFiles ( String  folder)

Definition at line 173 of file ContactWrapper.java.

173  {
174  File root = new File(ElephantContext.getRealPath(folder));
175  List<PairedFile> files = new ArrayList<>();
176  if(root.exists()) {
177  for(File f : root.listFiles()) {
178  if(f.isFile()) {
179  files.add(new PairedFile(folder, f.getName(), folder + "/thumbs", ".png"));
180  }
181  }
182  }
183  return files;
184  }
Here is the call graph for this function:

◆ getPrivate()

String org.turro.contacts.form.ContactWrapper.getPrivate ( )

Definition at line 152 of file ContactWrapper.java.

152  {
153  return "/WEB-INF/files/contact/" + entity.getId();
154  }

◆ getPublishable()

String org.turro.contacts.form.ContactWrapper.getPublishable ( )

Definition at line 148 of file ContactWrapper.java.

148  {
149  return "/_internal/files/contact/" + entity.getId();
150  }
Here is the caller graph for this function:

◆ getSelfLabel()

String org.turro.contacts.form.ContactWrapper.getSelfLabel ( )

Definition at line 65 of file ContactWrapper.java.

65  {
66  return I_.get("Contact");
67  }
Here is the call graph for this function:

◆ getTabLabel()

String org.turro.contacts.form.ContactWrapper.getTabLabel ( )

Definition at line 61 of file ContactWrapper.java.

61  {
62  return entity.getName(); //getSelfLabel() + " #" + entity.getId();
63  }
Here is the caller graph for this function:

◆ getTooltiptext()

String org.turro.contacts.form.ContactWrapper.getTooltiptext ( )

Definition at line 69 of file ContactWrapper.java.

69  {
70  try {
71  return entity.getName();
72  } catch(Exception ex) {
73  return null;
74  }
75  }
Here is the caller graph for this function:

◆ isInBusiness()

boolean org.turro.contacts.form.ContactWrapper.isInBusiness ( )

Definition at line 144 of file ContactWrapper.java.

144  {
145  return entity.isInBusiness(Authentication.getIContact());
146  }
Here is the call graph for this function:

◆ isSelf()

boolean org.turro.contacts.form.ContactWrapper.isSelf ( )

Definition at line 140 of file ContactWrapper.java.

140  {
141  return Authentication.isLogged(entity.getIContact());
142  }
Here is the call graph for this function:

◆ save()

Contact org.turro.contacts.form.ContactWrapper.save ( )

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

Definition at line 94 of file ContactWrapper.java.

94  {
95  entity.checkEmptyness();
96  try {
97  entity = super.save();
98  new QueueManager().subscribeDefaults(ConstraintKeys.from(entity.getIContact()));
99  } catch (Exception ex) {
100  Logger.getLogger(ContactWrapper.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
101  }
102  return entity;
103  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveAnyway()

static void org.turro.contacts.form.ContactWrapper.saveAnyway ( Contact  contact,
Consumer< Contact onSave 
)
static

Definition at line 194 of file ContactWrapper.java.

194  {
195  DuplicatesModel dupmodel = new DuplicatesModel(contact);
196  if(dupmodel.isEmpty()) {
197  onSave.accept(contact);
198  } else {
199  Windows.title(I_.get("Duplicates"))
200  .width("70%")
201  .height("60%")
202  .addComponent("/contact/duplicates/duplicates.zul",
203  Map.of("contact", contact, "dupmodel", dupmodel, "onSave", onSave))
204  .closeable()
205  .show();
206  }
207  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shouldLog()

boolean org.turro.contacts.form.ContactWrapper.shouldLog ( )
protected

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

Definition at line 106 of file ContactWrapper.java.

106  {
107  return true;
108  }

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