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

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, AgreementSignature signature, IContact contact, boolean accept) 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 48 of file AgreementAction.java.

Member Function Documentation

◆ createURL()

static String org.turro.agreements.AgreementAction.createURL ( IConstructor  constructor,
AgreementSignature  signature,
IContact  contact,
boolean  accept 
) throws UnsupportedEncodingException, Exception
static

Definition at line 50 of file AgreementAction.java.

50  {
51  HashMap<String, String> values = new HashMap<>();
52  values.put(Actions.USER_PAR, contact.getConnector(IUser.CONNECTOR_EMAIL));
53  values.put(Actions.REDIR_PAR, URLEncoder.encode(ElephantContext.getRootWebPath() + "/user/myagreements?item=" + signature.getId(), "UTF-8"));
54  values.put("agreementId", ObjectString.formatNativeObject(signature.getAgreement().getId(), false));
55  values.put("contactId", contact.getId());
56  values.put("accept", ObjectString.formatNativeObject(Boolean.valueOf(accept), false));
57  return ElephantContext.getRootWebPath() +
58  DirectContents.DIRECT_CONTENT_PATH + getIdentifier() +
59  "?" + Actions.createAction(values, 7, false);
60  }
Here is the caller graph for this function:

◆ execute()

void org.turro.agreements.AgreementAction.execute ( ServletContext  context,
HttpServletRequest  request,
HttpServletResponse  response 
)

Implements org.turro.elephant.direct.IDirectContent.

Definition at line 77 of file AgreementAction.java.

77  {
78  try {
79  IConstructor constructor = ElephantContext.getConstructor(request, response);
80  KeyValueMap map = Actions.getAction(constructor);
81  if(Actions.prepareActions(constructor, map)) {
82  AgreementsUtil agreements = new AgreementsUtil(map.get("contactId"));
83  agreements.sign(
84  (Long) ObjectString.parseNativeString(map.get("agreementId"), Long.class, true),
85  (Boolean) ObjectString.parseNativeString(map.get("accept"), Boolean.class, true));
86  response.sendRedirect(URLDecoder.decode(map.get(Actions.REDIR_PAR), "UTF-8"));
87  }
88  } catch (IOException ex) {
89  Logger.getLogger(AgreementAction.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
90  }
91  }
Here is the call graph for this function:

◆ getIdentifier()

static String org.turro.agreements.AgreementAction.getIdentifier ( )
static

Definition at line 62 of file AgreementAction.java.

62  {
63  return AgreementAction.class.getAnnotation(DirectContent.class).identifier();
64  }

◆ itsMe()

boolean org.turro.agreements.AgreementAction.itsMe ( String  id)

Implements org.turro.elephant.direct.IDirectContent.

Definition at line 67 of file AgreementAction.java.

67  {
68  return getIdentifier().equals(id);
69  }

◆ myTurn()

boolean org.turro.agreements.AgreementAction.myTurn ( HttpServletRequest  request)

Implements org.turro.elephant.direct.IDirectContent.

Definition at line 72 of file AgreementAction.java.

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

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