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

Public Member Functions

void onTitle ()
 
void onBusiness ()
 
void onResponsible ()
 
void onRole ()
 
void onType ()
 
void onThematic ()
 
void onRelatedUrl ()
 
void onStart ()
 
void onEnd ()
 
void onPrice ()
 
void onTax ()
 
void onPeriodicity ()
 
void onUpload (UploadEvent event)
 
void onText ()
 
void onSendTest ()
 
void onSave ()
 
void onCancel ()
 
void onPublish ()
 
void onDelete ()
 
void onDeleteImage ()
 
String getContextPath ()
 
void setContextPath (String contextPath)
 
void setResponse (ContactService service)
 
ContactService getService ()
 
String getImgUploadMsg ()
 
String createRef (IConstructor constructor, ContactService service, IContact contact) throws Exception
 
String createRef (IConstructor constructor, String redir) throws Exception
 
- Public Member Functions inherited from org.turro.elephant.TemplateControl
void setRootTmpl (String rootTmpl)
 
void setTmpl (String tmpl)
 
void afterCompose ()
 

Protected Member Functions

void doFinally ()
 

Detailed Description

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

Definition at line 70 of file EditServiceControl.java.

Member Function Documentation

◆ createRef() [1/2]

String org.turro.contacts.service.EditServiceControl.createRef ( IConstructor  constructor,
ContactService  service,
IContact  contact 
) throws Exception

Definition at line 335 of file EditServiceControl.java.

335  {
336  return createRef(constructor, service.getTimesSent() >=1 ?
337  Entities.getController(service).getEntityUrl() :
338  Entities.getController(service).getMemberUrl());
339  }
String createRef(IConstructor constructor, ContactService service, IContact contact)
Here is the call graph for this function:

◆ createRef() [2/2]

String org.turro.contacts.service.EditServiceControl.createRef ( IConstructor  constructor,
String  redir 
) throws Exception

Definition at line 341 of file EditServiceControl.java.

341  {
342  return "{liveref:" + redir + "}";
343  }

◆ doFinally()

void org.turro.contacts.service.EditServiceControl.doFinally ( )
protected

Reimplemented from org.turro.elephant.TemplateControl.

Definition at line 321 of file EditServiceControl.java.

321  {
322  super.doFinally();
323  IAgreements agreements = Plugins.loadImplementation(IAgreements.class, "agreements");
324  agreements.setContact(Authentication.getIContact());
325  if(!agreements.canAct("marketplace-new")) {
326  Application.getApplication().sendRedirect(agreements.getPendingActURL("marketplace-new"));
327  } else {
328  checkService();
329  initComponents();
330  }
331  }
Here is the call graph for this function:

◆ getContextPath()

String org.turro.contacts.service.EditServiceControl.getContextPath ( )

Definition at line 299 of file EditServiceControl.java.

299  {
300  return contextPath;
301  }

◆ getImgUploadMsg()

String org.turro.contacts.service.EditServiceControl.getImgUploadMsg ( )

Definition at line 316 of file EditServiceControl.java.

316  {
317  return I_.format("Image will be converted to %dx%d", 900, 450);
318  }
Here is the call graph for this function:

◆ getService()

ContactService org.turro.contacts.service.EditServiceControl.getService ( )

Definition at line 311 of file EditServiceControl.java.

311  {
312  checkService();
313  return service;
314  }

◆ onBusiness()

void org.turro.contacts.service.EditServiceControl.onBusiness ( )

Definition at line 98 of file EditServiceControl.java.

98  {
99  service.setIContact(business.getObjectValue());
100  responsible.setContact(business.getObjectValue());
101  responsible.setObjectValue(null);
102  }
void setIContact(IContact contact)
Here is the call graph for this function:

◆ onCancel()

void org.turro.contacts.service.EditServiceControl.onCancel ( )

Definition at line 236 of file EditServiceControl.java.

236  {
237  if(!Strings.isBlank(service.getId())) {
238  Application.getApplication().sendRedirect(contextPath + "?" +
239  MarkerHelper.setObfuscatedRightNowPars("item=" + service.getId()));
240  } else {
241  Application.getApplication().sendRedirect(contextPath);
242  }
243  }
Here is the call graph for this function:

◆ onDelete()

void org.turro.contacts.service.EditServiceControl.onDelete ( )

Definition at line 275 of file EditServiceControl.java.

275  {
276  if(!Strings.isBlank(service.getId())) {
277  Messages.confirmDeletion().add(service.getTitle()).show(() -> {
278  ContactServiceWrapper wrapper = new ContactServiceWrapper(service);
279  wrapper.delete();
280  Application.getApplication().sendRedirect(contextPath);
281  });
282  }
283  }
Here is the call graph for this function:

◆ onDeleteImage()

void org.turro.contacts.service.EditServiceControl.onDeleteImage ( )

Definition at line 286 of file EditServiceControl.java.

286  {
287  if(!Strings.isBlank(service.getId())) {
288  Messages.confirmDeletion().add(I_.get("Image")).show(() -> {
289  FileAttach fileAttach = new FileAttach(ContactsPU.getObjectPath(service));
290  File newFile = new File(ElephantContext.getRealPath(fileAttach.getPublishable() + "/profile/face.png"));
291  if(newFile.exists()) {
292  newFile.delete();
293  image.setSrc(null);
294  }
295  });
296  }
297  }
Here is the call graph for this function:

◆ onEnd()

void org.turro.contacts.service.EditServiceControl.onEnd ( )

Definition at line 145 of file EditServiceControl.java.

145  {
146  service.setEndDate(end.getValue());
147  }
Here is the call graph for this function:

◆ onPeriodicity()

void org.turro.contacts.service.EditServiceControl.onPeriodicity ( )

Definition at line 162 of file EditServiceControl.java.

162  {
163  service.setPeriodicity(periodicity.getObjectValue());
164  }
void setPeriodicity(Periodicity periodicity)
Here is the call graph for this function:

◆ onPrice()

void org.turro.contacts.service.EditServiceControl.onPrice ( )

Definition at line 150 of file EditServiceControl.java.

150  {
151  service.setPrice(price.getDoubleValue());
152  price.setValue(service.getPrice());
153  }
Here is the call graph for this function:

◆ onPublish()

void org.turro.contacts.service.EditServiceControl.onPublish ( )

Definition at line 246 of file EditServiceControl.java.

246  {
247  if(!service.isEmpty()) {
248  onSave();
249  HashMap args = new HashMap();
250  args.put("service", service);
251  args.put("wrapper", new ContactServiceWrapper(service));
252  args.put("notifier", this);
253  if(!Strings.isBlank(service.getId())) {
254  FileAttach fileAttach = new FileAttach(ContactsPU.getObjectPath(service));
255  args.put("face", fileAttach.getPublicFile("/profile/face.png", false));
256  args.put("link", Entities.getController(service).getEntityUrl());
257  }
258  try {
259  MailSenders.getPool()
260  .addAdministrators()
261  .addByEntity(service, null)
262  .setRoot("/services")
263  .putAll(args)
264  .sendTemplate("service-marketplace", composeSubject(service));
265  } catch (EmailException ex) {
266  Logger.getLogger(EditServiceControl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
267  }
268  Application.getApplication().sendRedirect(contextPath + "?" +
269  MarkerHelper.setObfuscatedRightNowPars("item=" + service.getId()));
270  new PublishServiceNotification(service).sendNotification();
271  }
272  }
Here is the call graph for this function:

◆ onRelatedUrl()

void org.turro.contacts.service.EditServiceControl.onRelatedUrl ( )

Definition at line 125 of file EditServiceControl.java.

125  {
126  String relUrl = relatedUrl.getValue();
127  if(!Strings.isBlank(relUrl)) {
128  if(relUrl.contains("@")) {
129  service.setRelatedURL(UrlCompose.fillMailGaps(relUrl));
130  } else {
131  service.setRelatedURL(UrlCompose.fillWebGaps(relUrl));
132  }
133  } else {
134  service.setRelatedURL(null);
135  }
136  relatedUrl.setValue(service.getRelatedURL());
137  }
void setRelatedURL(String relatedURL)
Here is the call graph for this function:

◆ onResponsible()

void org.turro.contacts.service.EditServiceControl.onResponsible ( )

Definition at line 105 of file EditServiceControl.java.

105  {
106  service.setIResponsible(responsible.getObjectValue());
107  }
void setIResponsible(IContact responsible)
Here is the call graph for this function:

◆ onRole()

void org.turro.contacts.service.EditServiceControl.onRole ( )

Definition at line 110 of file EditServiceControl.java.

110  {
111  service.setRole(role.getObjectValue());
112  }
void setRole(ContactServiceRole role)
Here is the call graph for this function:

◆ onSave()

void org.turro.contacts.service.EditServiceControl.onSave ( )

Definition at line 223 of file EditServiceControl.java.

223  {
224  if(!service.isEmpty()) {
225  // check @ and replace with @
226  ContactServiceWrapper wrapper = new ContactServiceWrapper(service);
227  service = wrapper.save();
228  Application.getApplication().sendRedirect(contextPath + "?" +
229  MarkerHelper.setObfuscatedRightNowPars("item=" + service.getId()));
230  } else {
231  Clients.showNotification(I_.get("Fill required fields"));
232  }
233  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onSendTest()

void org.turro.contacts.service.EditServiceControl.onSendTest ( )

Definition at line 195 of file EditServiceControl.java.

195  {
196  if(!service.isEmpty()) {
197  HashMap args = new HashMap();
198  args.put("service", service);
199  args.put("wrapper", new ContactServiceWrapper(service));
200  args.put("notifier", this);
201  if(!Strings.isBlank(service.getId())) {
202  FileAttach fileAttach = new FileAttach(ContactsPU.getObjectPath(service));
203  args.put("face", fileAttach.getPublicFile("/profile/face.png", false));
204  args.put("link", Entities.getController(service).getEntityUrl());
205  }
206  try {
207  MailSenders.getPool()
208  .addAdministrators()
209  .addByEntity(service, null)
210  .setRoot("/services")
211  .putAll(args)
212  .sendTemplate("service-test", composeSubject(service));
213  Clients.showNotification(I_.get("Test sent"));
214  } catch (EmailException ex) {
215  Logger.getLogger(EditServiceControl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
216  }
217  } else {
218  Clients.showNotification(I_.get("Fill required fields"));
219  }
220  }
Here is the call graph for this function:

◆ onStart()

void org.turro.contacts.service.EditServiceControl.onStart ( )

Definition at line 140 of file EditServiceControl.java.

140  {
141  service.setStartDate(start.getValue());
142  }
Here is the call graph for this function:

◆ onTax()

void org.turro.contacts.service.EditServiceControl.onTax ( )

Definition at line 156 of file EditServiceControl.java.

156  {
157  service.setTax(tax.getDoubleValue());
158  tax.setValue(service.getTax());
159  }
Here is the call graph for this function:

◆ onText()

void org.turro.contacts.service.EditServiceControl.onText ( )

Definition at line 189 of file EditServiceControl.java.

189  {
190  service.setWiki(text.getValue());
191  service.setText(text.getHtml());
192  }
Here is the call graph for this function:

◆ onThematic()

void org.turro.contacts.service.EditServiceControl.onThematic ( )

Definition at line 120 of file EditServiceControl.java.

120  {
121  service.setThematic(thematic.getObjectValue());
122  }
Here is the call graph for this function:

◆ onTitle()

void org.turro.contacts.service.EditServiceControl.onTitle ( )

Definition at line 93 of file EditServiceControl.java.

93  {
94  service.setTitle(title.getValue());
95  }
Here is the call graph for this function:

◆ onType()

void org.turro.contacts.service.EditServiceControl.onType ( )

Definition at line 115 of file EditServiceControl.java.

115  {
116  service.setType(type.getObjectValue());
117  }
Here is the call graph for this function:

◆ onUpload()

void org.turro.contacts.service.EditServiceControl.onUpload ( UploadEvent  event)

Definition at line 167 of file EditServiceControl.java.

167  {
168  FileAttach fileAttach = new FileAttach(ContactsPU.getObjectPath(service));
169  File newFile = new File(ElephantContext.getRealPath(fileAttach.getPublishable() + "/profile/face.png"));
170  if(!newFile.getParentFile().exists()) {
171  newFile.getParentFile().mkdirs();
172  }
173  Media media = event.getMedia();
174  if(media != null) {
175  Medias.toFile(media, newFile, Medias.smart(900, 450));
176  }
177  if(newFile.exists()) {
178  try {
179  image.setContent(new AImage(newFile.getAbsolutePath()));
180  } catch (IOException ex) {
181  Logger.getLogger(EditServiceControl.class.getName()).log(Level.SEVERE, null, ex);
182  }
183  } else {
184  image.setSrc(null);
185  }
186  }
Here is the call graph for this function:

◆ setContextPath()

void org.turro.contacts.service.EditServiceControl.setContextPath ( String  contextPath)

Definition at line 303 of file EditServiceControl.java.

303  {
304  this.contextPath = contextPath;
305  }

◆ setResponse()

void org.turro.contacts.service.EditServiceControl.setResponse ( ContactService  service)

Definition at line 307 of file EditServiceControl.java.

307  {
308  this.service = service;
309  }

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