BrightSide Workbench Full Report + Source Code
org.turro.mail.tracker.ImageMailTracker Class Reference
Inheritance diagram for org.turro.mail.tracker.ImageMailTracker:
Collaboration diagram for org.turro.mail.tracker.ImageMailTracker:

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 createURL (IConstructor constructor, String image, String entityPath, IContact contact) throws UnsupportedEncodingException, Exception
 
static String getIdentifier ()
 

Detailed Description

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

Definition at line 49 of file ImageMailTracker.java.

Member Function Documentation

◆ createURL()

static String org.turro.mail.tracker.ImageMailTracker.createURL ( IConstructor  constructor,
String  image,
String  entityPath,
IContact  contact 
) throws UnsupportedEncodingException, Exception
static

Definition at line 51 of file ImageMailTracker.java.

52  {
53  if(contact != null && contact.isWebUser()) {
54  HashMap<String, String> values = new HashMap<>();
55  values.put("idcontact", contact.getId());
56  values.put("entityPath", entityPath);
57  values.put("image", image);
58  return DirectContents.doCreateParameter(getIdentifier(), getIdentifier(), values);
59  } else {
60  return "";
61  }
62  }

◆ execute()

void org.turro.mail.tracker.ImageMailTracker.execute ( ServletContext  context,
HttpServletRequest  request,
HttpServletResponse  response 
)

Implements org.turro.elephant.direct.IDirectContent.

Definition at line 79 of file ImageMailTracker.java.

79  {
80  try {
81  IConstructor constructor = ElephantContext.getConstructor(request, response);
82  String imgtk = constructor.getParameter(getIdentifier(), false);
83  if(!Strings.isBlank(imgtk)) {
84  KeyValueMap map = new KeyValueMap(ElephantContext.decrypt(imgtk));
85  response.setContentType("image/png");
86  File f = new File(ElephantContext.getRealPath(map.get("image")));
87  BufferedImage bi = ImageIO.read(f);
88  OutputStream out = response.getOutputStream();
89  ImageIO.write(bi, "png", out);
90  out.close();
91  MailTracker mt = new MailTracker();
92  mt.setEntityPath(map.get("entityPath"));
93  mt.setIdContact(map.get("idcontact"));
94  mt.setReadDate(new Date());
95  new ElephantPU().saveObject(mt);
96  }
97  } catch (Exception ex) {
98  Logger.getLogger(ImageMailTracker.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
99  }
100  }
Here is the call graph for this function:

◆ getIdentifier()

static String org.turro.mail.tracker.ImageMailTracker.getIdentifier ( )
static

Definition at line 64 of file ImageMailTracker.java.

64  {
65  return ImageMailTracker.class.getAnnotation(DirectContent.class).identifier();
66  }

◆ itsMe()

boolean org.turro.mail.tracker.ImageMailTracker.itsMe ( String  id)

Implements org.turro.elephant.direct.IDirectContent.

Definition at line 69 of file ImageMailTracker.java.

69  {
70  return getIdentifier().equals(id);
71  }

◆ myTurn()

boolean org.turro.mail.tracker.ImageMailTracker.myTurn ( HttpServletRequest  request)

Implements org.turro.elephant.direct.IDirectContent.

Definition at line 74 of file ImageMailTracker.java.

74  {
75  return DirectContents.isYourTurn(request, getIdentifier());
76  }
Here is the call graph for this function:

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