BrightSide Workbench Full Report + Source Code
org.turro.vendor.VendorCalendar Class Reference
Inheritance diagram for org.turro.vendor.VendorCalendar:
Collaboration diagram for org.turro.vendor.VendorCalendar:

Public Member Functions

boolean itsMe (String id)
 
boolean myTurn (HttpServletRequest request)
 
void execute (ServletContext context, HttpServletRequest request, HttpServletResponse response)
 

Static Public Member Functions

static String getIdentifier ()
 

Detailed Description

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

Definition at line 47 of file VendorCalendar.java.

Member Function Documentation

◆ execute()

void org.turro.vendor.VendorCalendar.execute ( ServletContext  context,
HttpServletRequest  request,
HttpServletResponse  response 
)

Implements org.turro.elephant.direct.IDirectContent.

Definition at line 64 of file VendorCalendar.java.

64  {
65  String vendorId = request.getParameter("ses");
66  Dao dao = new CrmPU();
67  Vendor vendor = (Vendor) dao.getSingleResult(
68  "select v from Vendor v where v.idContact = ?",
69  new Object[] { vendorId.substring(3) });
70  Calendar cal = new Calendar(vendor.getName());
71  List<SaleAction> list = dao.getResultList(
72  "select sa from SaleAction sa " +
73  "where sa.vendorProspect.vendor = ? " +
74  "and sa.actionDate >= ?",
75  new Object[] { vendor, new CheckDate().addYears(-1).getDate() });
76  for(SaleAction sa : list) {
77  cal.addEvent(sa.getActionDate(), sa.getFinalDate(),
78  sa.getVendorProspect().getSaleProspect().getCustomer().getName(),
79  sa.getComment());
80  if(sa.getStatus() == SaleAction.SA_DONE) {
81  cal.setCompleted();
82  } else if(sa.getStatus() == SaleAction.SA_CANCELLED) {
83  cal.setCompleted();
84  cal.setCancelled();
85  }
86  cal.setOrganizer(vendor.getName(), vendor.getIContact().getConnector(IUser.CONNECTOR_EMAIL));
87  for(IContact c : sa.getIAttendees()) {
88  cal.addAttendee(c.getName(), c.getConnector(IUser.CONNECTOR_EMAIL));
89  }
90  Address address = sa.getAddress();
91  if(address != null) cal.addLocation(address.getAddressString());
92  }
93  try {
94  response.setContentType("text/calendar");
95  response.setCharacterEncoding("UTF-8");
96  cal.output(response.getOutputStream());
97  } catch (IOException ex) {
98  Logger.getLogger(VendorCalendar.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
99  }
100  }
Here is the call graph for this function:

◆ getIdentifier()

static String org.turro.vendor.VendorCalendar.getIdentifier ( )
static

Definition at line 49 of file VendorCalendar.java.

49  {
50  return VendorCalendar.class.getAnnotation(DirectContent.class).identifier();
51  }

◆ itsMe()

boolean org.turro.vendor.VendorCalendar.itsMe ( String  id)

Implements org.turro.elephant.direct.IDirectContent.

Definition at line 54 of file VendorCalendar.java.

54  {
55  return getIdentifier().equals(id);
56  }

◆ myTurn()

boolean org.turro.vendor.VendorCalendar.myTurn ( HttpServletRequest  request)

Implements org.turro.elephant.direct.IDirectContent.

Definition at line 59 of file VendorCalendar.java.

59  {
60  return DirectContents.isYourTurn(request, getIdentifier());
61  }
Here is the call graph for this function:

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