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

Public Member Functions

 ProfileCtrl ()
 
void setContact (Contact contact)
 
String editLink (Object entity, String element)
 
String addCompanyLink ()
 
String addCenterLink ()
 
String publicLink (Object entity, String element)
 
String usersLink (Object entity, String element)
 
String followingLink (Object entity, String element)
 
String privateLink (Object entity, String element)
 
- Public Member Functions inherited from org.turro.elephant.direct.AbstractDirectEntityCtrl
 AbstractDirectEntityCtrl (String tmplRoot, String entityAttribute)
 
void setConstructor (IConstructor constructor)
 
void setEntityPath (String entityPath)
 
boolean hasContent ()
 
- Public Member Functions inherited from org.turro.elephant.direct.AbstractDirectContentCtrl
 AbstractDirectContentCtrl (String tmplRoot)
 
String createFormAction ()
 
String createPOST (String values)
 
String getAjaxSubmitUrl (String containerId)
 
String getAjaxUrl (String containerId, String values)
 
String getAjaxUrl (String containerId, KeyValueMap values)
 
String getAjaxEvalUrl (KeyValueMap values)
 
String createRightNowURL (String values)
 
String createRightNowURL (KeyValueMap values)
 
String createLinkTo (String link, KeyValueMap values)
 
String createURL ()
 
String createURL (IConstructor constructor, String values)
 
String createURL (IConstructor constructor, String values, int daysValid)
 
String createURL (IConstructor constructor, String values, int daysValid, boolean withDomain)
 
String createURL (IConstructor constructor, IContact recipe, String values, int daysValid, boolean withDomain)
 
String createURL (IConstructor constructor, IContact recipe, KeyValueMap values, int daysValid, boolean withDomain)
 
void setTemplate (String template)
 
void render (IConstructor constructor)
 
String parse (IConstructor constructor)
 
boolean itsMe (String id)
 
boolean myTurn (HttpServletRequest request)
 
void execute (ServletContext context, HttpServletRequest request, HttpServletResponse response)
 
void execute (IConstructor constructor)
 
- Public Member Functions inherited from org.turro.action.IEntityCtrl
void setTemplate (String template)
 
void render (IConstructor constructor)
 
String parse (IConstructor constructor)
 

Protected Member Functions

void prepareCleanMarker (ElephantMarker marker, KeyValueMap map)
 
void prepareMarker (ElephantMarker marker)
 
String getIdentifier ()
 
void doExecute (IConstructor constructor, KeyValueMap map)
 
- Protected Member Functions inherited from org.turro.elephant.direct.AbstractDirectEntityCtrl
ElephantMarker getMarker (IConstructor constructor)
 
- Protected Member Functions inherited from org.turro.elephant.direct.AbstractDirectContentCtrl
String getRedirContext (IConstructor constructor, boolean withDomain)
 
ElephantMarker getCleanMarkerFrom (IConstructor constructor)
 
void addContainerId (ElephantMarker marker, boolean container)
 
String getTmplRoot ()
 
String getTemplate ()
 
void writeMarkerToResponse (IConstructor constructor, KeyValueMap map)
 
void writeMarkerToResponse (IConstructor constructor, KeyValueMap map, Map extra)
 
void setNeedsUser (boolean needsUser)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.elephant.direct.AbstractDirectEntityCtrl
String entityPath
 
IElephantEntity iee
 
IConstructor norReentrantConstructor
 
- Protected Attributes inherited from org.turro.elephant.direct.AbstractDirectContentCtrl
String template = "full"
 

Detailed Description

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

Definition at line 47 of file ProfileCtrl.java.

Constructor & Destructor Documentation

◆ ProfileCtrl()

org.turro.contacts.profile.ProfileCtrl.ProfileCtrl ( )

Definition at line 51 of file ProfileCtrl.java.

51  {
52  super("widgets/profile", "profile");
53  setNeedsUser(true);
54  setTemplate("profile");
55  }
void setTemplate(String template)
Here is the call graph for this function:

Member Function Documentation

◆ addCenterLink()

String org.turro.contacts.profile.ProfileCtrl.addCenterLink ( )

Definition at line 84 of file ProfileCtrl.java.

84  {
85  KeyValueMap kvm = new KeyValueMap();
86  kvm.put("type", "add");
87  kvm.put("contact", contact.getId());
88  kvm.put("element", "center");
89  return createRightNowURL(kvm);
90  }
Here is the call graph for this function:

◆ addCompanyLink()

String org.turro.contacts.profile.ProfileCtrl.addCompanyLink ( )

Definition at line 76 of file ProfileCtrl.java.

76  {
77  KeyValueMap kvm = new KeyValueMap();
78  kvm.put("type", "add");
79  kvm.put("contact", contact.getId());
80  kvm.put("element", "company");
81  return createRightNowURL(kvm);
82  }
Here is the call graph for this function:

◆ doExecute()

void org.turro.contacts.profile.ProfileCtrl.doExecute ( IConstructor  constructor,
KeyValueMap  map 
)
protected

Reimplemented from org.turro.elephant.direct.AbstractDirectContentCtrl.

Definition at line 158 of file ProfileCtrl.java.

158  {
159  String type = map.get("type");
160  IContact current = Contacts.getContactById(map.get("contact"));
161  if(current != null) {
162  if("edit".equals(type)) {
163  try {
164  if(map.containsKey("relation")) {
165  BusinessRelation relation = getRelation(current, map.get("relation"));
166  switch(relation.getBusiness().getType()) {
167  case CONTACT_COMPANY:
168  constructor.redirect("/user/profile/editrb?" + Actions.createRightNowAction(map));
169  return;
170  case CONTACT_LEARNINGCENTER:
171  constructor.redirect("/user/profile/editrc?" + Actions.createRightNowAction(map));
172  return;
173  }
174  } else if("skills".equals(map.get("element"))) {
175  map.put("entityPath", ContactsPU.getObjectPath(current.getContact()));
176  constructor.redirect("/user/profile/editsk?" + Actions.createRightNowAction(map));
177  return;
178  } else {
179  constructor.redirect("/user/profile/edit?" + Actions.createRightNowAction(map));
180  return;
181  }
182  } catch (IOException ex) {
183  Logger.getLogger(ProfileCtrl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
184  }
185  } else if("add".equals(type)) {
186  try {
187  switch(map.get("element")) {
188  case "company":
189  constructor.redirect("/user/profile/editrb?" + Actions.createRightNowAction(map));
190  return;
191  case "center":
192  constructor.redirect("/user/profile/editrc?" + Actions.createRightNowAction(map));
193  return;
194  }
195  } catch (IOException ex) {
196  Logger.getLogger(ProfileCtrl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
197  }
198  } else {
199  ProfilePolicies pp = new ProfilePolicies((Contact) current.getContact());
200  PublishPolicy policy = PublishPolicy.PUBLISH_NONE;
201  BusinessRelation relation = getRelationFrom((Contact) current.getContact(), map.get("relation"));
202  if("public".equals(type)) {
203  policy = PublishPolicy.PUBLISH_ALL;
204  } else if("users".equals(type)) {
205  policy = PublishPolicy.PUBLISH_USERS;
206  } else if("following".equals(type)) {
207  policy = PublishPolicy.PUBLISH_FOLLOWING;
208  }
209  pp.setPolicy(relation == null ? current.getContact() : relation, map.get("element"), policy);
210  pp.save();
211  }
212  try {
213  constructor.redirect("/user/profile");
214  } catch (IOException ex) {
215  Logger.getLogger(ProfileCtrl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
216  }
217  }
218  }
Here is the call graph for this function:

◆ editLink()

String org.turro.contacts.profile.ProfileCtrl.editLink ( Object  entity,
String  element 
)

Definition at line 65 of file ProfileCtrl.java.

65  {
66  KeyValueMap kvm = new KeyValueMap();
67  kvm.put("type", "edit");
68  kvm.put("contact", contact.getId());
69  kvm.put("element", element);
70  if(entity instanceof ProfileRelation) {
71  kvm.put("relation", ((ProfileRelation) entity).getRelation().getId());
72  }
73  return createRightNowURL(kvm);
74  }
Here is the call graph for this function:

◆ followingLink()

String org.turro.contacts.profile.ProfileCtrl.followingLink ( Object  entity,
String  element 
)

Definition at line 114 of file ProfileCtrl.java.

114  {
115  KeyValueMap kvm = new KeyValueMap();
116  kvm.put("type", "following");
117  kvm.put("contact", contact.getId());
118  kvm.put("element", element);
119  if(entity instanceof ProfileRelation) {
120  kvm.put("relation", ((ProfileRelation) entity).getRelation().getId());
121  }
122  return createRightNowURL(kvm);
123  }
Here is the call graph for this function:

◆ getIdentifier()

String org.turro.contacts.profile.ProfileCtrl.getIdentifier ( )
protected

Reimplemented from org.turro.elephant.direct.AbstractDirectContentCtrl.

Definition at line 153 of file ProfileCtrl.java.

153  {
154  return ProfileCtrl.class.getAnnotation(DirectContent.class).identifier();
155  }

◆ prepareCleanMarker()

void org.turro.contacts.profile.ProfileCtrl.prepareCleanMarker ( ElephantMarker  marker,
KeyValueMap  map 
)
protected

Reimplemented from org.turro.elephant.direct.AbstractDirectContentCtrl.

Definition at line 137 of file ProfileCtrl.java.

137  {
138  marker.putAll(map);
139  marker.put("profile", new Profile((Contact) Contacts.getContactById(map.get("contact")).getContact(), true));
140  }
Here is the call graph for this function:

◆ prepareMarker()

void org.turro.contacts.profile.ProfileCtrl.prepareMarker ( ElephantMarker  marker)
protected

Reimplemented from org.turro.elephant.direct.AbstractDirectContentCtrl.

Definition at line 145 of file ProfileCtrl.java.

145  {
146  addContainerId(marker, true);
147  marker.put("profile", new Profile(contact, true));
148  }
void addContainerId(ElephantMarker marker, boolean container)
Here is the call graph for this function:

◆ privateLink()

String org.turro.contacts.profile.ProfileCtrl.privateLink ( Object  entity,
String  element 
)

Definition at line 125 of file ProfileCtrl.java.

125  {
126  KeyValueMap kvm = new KeyValueMap();
127  kvm.put("type", "private");
128  kvm.put("contact", contact.getId());
129  kvm.put("element", element);
130  if(entity instanceof ProfileRelation) {
131  kvm.put("relation", ((ProfileRelation) entity).getRelation().getId());
132  }
133  return createRightNowURL(kvm);
134  }
Here is the call graph for this function:

◆ publicLink()

String org.turro.contacts.profile.ProfileCtrl.publicLink ( Object  entity,
String  element 
)

Definition at line 92 of file ProfileCtrl.java.

92  {
93  KeyValueMap kvm = new KeyValueMap();
94  kvm.put("type", "public");
95  kvm.put("contact", contact.getId());
96  kvm.put("element", element);
97  if(entity instanceof ProfileRelation) {
98  kvm.put("relation", ((ProfileRelation) entity).getRelation().getId());
99  }
100  return createRightNowURL(kvm);
101  }
Here is the call graph for this function:

◆ setContact()

void org.turro.contacts.profile.ProfileCtrl.setContact ( Contact  contact)

Definition at line 57 of file ProfileCtrl.java.

57  {
58  if(contact == null) {
59  this.contact = (Contact) Contacts.getContactById(Authentication.getIContact().getId()).getContact();
60  } else {
61  this.contact = contact;
62  }
63  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ usersLink()

String org.turro.contacts.profile.ProfileCtrl.usersLink ( Object  entity,
String  element 
)

Definition at line 103 of file ProfileCtrl.java.

103  {
104  KeyValueMap kvm = new KeyValueMap();
105  kvm.put("type", "users");
106  kvm.put("contact", contact.getId());
107  kvm.put("element", element);
108  if(entity instanceof ProfileRelation) {
109  kvm.put("relation", ((ProfileRelation) entity).getRelation().getId());
110  }
111  return createRightNowURL(kvm);
112  }
Here is the call graph for this function:

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