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

Public Member Functions

void onLocale ()
 
void onSocialGroup (SelectEvent event)
 
void onEvent (UploadEvent t) throws Exception
 
void onSubscriptions ()
 
void onOrganigram ()
 
void onWelcome ()
 
void doFinally () throws Exception
 
- Public Member Functions inherited from org.turro.jpa.composer.EntityComposer< E, ID >
final void onChange (Event event)
 
final void onSave ()
 
final void onDelete ()
 
Object getEntity ()
 
Object getWrapper ()
 
void doBeforeComposeChildren (Component comp) throws Exception
 
void doAfterCompose (Component comp) throws Exception
 

Protected Member Functions

String getAttributeName ()
 
Contact getEntityInstance (String id)
 
DaoEntity getWrapperInstance (Component comp)
 
void doOnSave ()
 
void doOnDelete ()
 
void afterSave ()
 
boolean shouldBeSaved ()
 
boolean inSaveRole ()
 
boolean inDeleteRole ()
 
- Protected Member Functions inherited from org.turro.jpa.composer.EntityComposer< E, ID >
abstract E getEntityInstance (ID id)
 
boolean beforeSave ()
 
boolean beforeDelete ()
 
void afterDelete ()
 
void doOnChange ()
 
boolean hasChanged ()
 
void retrieveEntity ()
 
boolean canClose ()
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.jpa.composer.EntityComposer< E, ID >
entity
 
DaoEntity wrapper
 

Detailed Description

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

Definition at line 83 of file ContactComposer.java.

Member Function Documentation

◆ afterSave()

void org.turro.contacts.form.ContactComposer.afterSave ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 204 of file ContactComposer.java.

204  {
205  super.afterSave();
206  ParticipationCatchers.onChange(Contacts.getContact(entity));
207  if(isNew && entity != null) {
208  ContactMenu.showContact(entity.getId());
209  }
210  }
Here is the call graph for this function:

◆ doFinally()

void org.turro.contacts.form.ContactComposer.doFinally ( ) throws Exception

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 213 of file ContactComposer.java.

213  {
214  super.doFinally();
215  Application app = Application.getApplication();
216  isNew = Strings.isBlank(entity.getId());
217  localebox.sort();
218  fileAttach = new FileAttach(ContactsPU.getObjectPath(entity));
219  String faceFile = fileAttach.getPublicFile("/profile/face.png", false);
220  if(!Strings.isBlank(faceFile)) {
221  face.setSrc(faceFile + "?" + IdGenerator.generate());
222  }
223  if(!isNew) {
224  IPlugin vcard = Plugins.loadImplementation(IPlugin.class, "vcard");
225  if(vcard != null) {
226  vcard.setData("contact", entity);
227  qrcode.setContent((RenderedImage) vcard.getData("qrcode"));
228  }
229  for(String tabKey : getTabKeys()) {
230  Tab tab = new Tab(I_.get(tabKey));
231  contabs.appendChild(tab);
232 
233  ScrollTabpanel panel = new ScrollTabpanel();
234  conpanels.appendChild(panel);
235 
236  FieldValueGrid grid = new FieldValueGrid(tabKey);
237  panel.appendScrollableChild(grid);
238  grid.setContact(entity);
239  }
240  }
241  }
String getPublicFile(String file)
Definition: FileAttach.java:59
Here is the call graph for this function:

◆ doOnDelete()

void org.turro.contacts.form.ContactComposer.doOnDelete ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 190 of file ContactComposer.java.

190  {
191  ContactMenu.showEntityModal(entity.getId(), "contactId", "/contact/delContact.zul", new Command() {
192  @Override
193  public Object execute(Context context) {
194  ModalWindow mw = (ModalWindow) context.get("win");
195  if(mw.getResult() == 1) {
196  ContactComposer.super.doOnDelete();
197  }
198  return true;
199  }
200  });
201  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doOnSave()

void org.turro.contacts.form.ContactComposer.doOnSave ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 181 of file ContactComposer.java.

181  {
182  entity.checkEmptyness();
183  ContactWrapper.saveAnyway(entity, contact -> {
184  ContactComposer.super.doOnSave();
185  SocialGroups.checkInheritance(List.of(contact), wrapper.getDao());
186  });
187  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAttributeName()

String org.turro.contacts.form.ContactComposer.getAttributeName ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 157 of file ContactComposer.java.

157  {
158  return "contact";
159  }

◆ getEntityInstance()

Contact org.turro.contacts.form.ContactComposer.getEntityInstance ( String  id)
protected

Definition at line 162 of file ContactComposer.java.

162  {
163  if(id == null) {
164  entity = new Contact();
165  entity.setUserMenu(true);
166  } else {
167  entity = new ContactsPU().find(Contact.class, id);
168  }
169  return entity;
170  }

◆ getWrapperInstance()

DaoEntity org.turro.contacts.form.ContactComposer.getWrapperInstance ( Component  comp)
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 173 of file ContactComposer.java.

173  {
174  ContactWrapper w = new ContactWrapper(entity);
175  Framework.getCurrent().setSelectedLabel(w.getTabLabel());
176  Framework.getCurrent().setSelectedTooltiptext(w.getTooltiptext());
177  return w;
178  }
Here is the call graph for this function:

◆ inDeleteRole()

boolean org.turro.contacts.form.ContactComposer.inDeleteRole ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 254 of file ContactComposer.java.

254  {
255  return Application.getApplication().isInRole("contact:delete");
256  }
Here is the call graph for this function:

◆ inSaveRole()

boolean org.turro.contacts.form.ContactComposer.inSaveRole ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 249 of file ContactComposer.java.

249  {
250  return Application.getApplication().isInRole("contact:edit");
251  }
Here is the call graph for this function:

◆ onEvent()

void org.turro.contacts.form.ContactComposer.onEvent ( UploadEvent  t) throws Exception

Definition at line 115 of file ContactComposer.java.

115  {
116  File newFile = new File(ElephantContext.getRealPath(fileAttach.getPublishable() + "/profile/face.png"));
117  if(!newFile.getParentFile().exists()) {
118  newFile.getParentFile().mkdirs();
119  }
120  Media media = t.getMedia();
121  if(media != null) {
122  Medias.toFile(media, newFile, Medias.scaling(600));
123  }
124  if(newFile.exists()) {
125  try {
126  face.setContent(new AImage(newFile.getAbsolutePath()));
127  } catch (IOException ex) {
128  Logger.getLogger(EditProfileControl.class.getName()).log(Level.SEVERE, null, ex);
129  }
130  } else {
131  face.setSrc(null);
132  }
133  }
Here is the call graph for this function:

◆ onLocale()

void org.turro.contacts.form.ContactComposer.onLocale ( )

Definition at line 97 of file ContactComposer.java.

97  {
98  entity.setLocale(localebox.getObjectValue());
99  currencybox.setObjectValue(Currencies.getDefault(entity.getLocale()));
100  entity.setCurrency(currencybox.getObjectValue());
101  }
Here is the call graph for this function:

◆ onOrganigram()

void org.turro.contacts.form.ContactComposer.onOrganigram ( )

Definition at line 141 of file ContactComposer.java.

141  {
142  ContactMenu.showOrganigram(entity);
143  }
Here is the call graph for this function:

◆ onSocialGroup()

void org.turro.contacts.form.ContactComposer.onSocialGroup ( SelectEvent  event)

Definition at line 104 of file ContactComposer.java.

104  {
105  if(event.getReference() instanceof Listitem) {
106  Collection<SocialGroupValue> sgs = socialgroups.getSelected();
107  SocialGroups.absoluteSyndicate(
108  List.of(entity),
109  new HashSet<>(sgs.stream().map(sgv -> sgv.getKey()).collect(Collectors.toList())),
110  null);
111  }
112  }
Here is the call graph for this function:

◆ onSubscriptions()

void org.turro.contacts.form.ContactComposer.onSubscriptions ( )

Definition at line 136 of file ContactComposer.java.

136  {
137  ContactMenu.showSubscriptions(entity);
138  }
Here is the call graph for this function:

◆ onWelcome()

void org.turro.contacts.form.ContactComposer.onWelcome ( )

Definition at line 146 of file ContactComposer.java.

146  {
147  new MailPool().addContact(Contacts.getContact(entity))
148  .setRoot("/sign")
149  .put("contact", entity)
150  .put("link", ElephantContext.getServerUrl("http") + "?" +
151  Actions.createAction(entity.getConnectorMap().get(IContact.CONNECTOR_EMAIL).getValue(), "/user/changepass"))
152  .silentSendTemplate("welcome", I_.get("Welcome") + " : " + ElephantContext.getSiteName());
153  Clients.showNotification(I_.get("Welcome was sent..."));
154  }
Here is the call graph for this function:

◆ shouldBeSaved()

boolean org.turro.contacts.form.ContactComposer.shouldBeSaved ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 244 of file ContactComposer.java.

244  {
245  return !entity.isEmpty() && (Strings.isBlank(entity.getId())) || super.shouldBeSaved();
246  }

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