BrightSide Workbench Full Report + Source Code
org.turro.www.directory.EditDataControl Class Reference
Inheritance diagram for org.turro.www.directory.EditDataControl:
Collaboration diagram for org.turro.www.directory.EditDataControl:

Public Member Functions

void onEmail ()
 
void onPhone ()
 
void onBusiness ()
 
void onPosition ()
 
void onWeb ()
 
void onNetwork ()
 
void onDirectory () throws IOException
 
void onEvent (UploadEvent t) throws Exception
 
void onSave ()
 
String getPath ()
 
void setPath (String path)
 
- Public Member Functions inherited from org.turro.elephant.TemplateControl
void setRootTmpl (String rootTmpl)
 
void setTmpl (String tmpl)
 
void afterCompose ()
 

Static Public Attributes

static final String EMAIL_DIRECTORY = "EmailDirectory"
 

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 58 of file EditDataControl.java.

Member Function Documentation

◆ doFinally()

void org.turro.www.directory.EditDataControl.doFinally ( )
protected

Reimplemented from org.turro.elephant.TemplateControl.

Definition at line 168 of file EditDataControl.java.

168  {
169  super.doFinally();
170  contact = Authentication.getIContact();
171  initComponents();
172  }

◆ getPath()

String org.turro.www.directory.EditDataControl.getPath ( )

Definition at line 159 of file EditDataControl.java.

159  {
160  return path;
161  }

◆ onBusiness()

void org.turro.www.directory.EditDataControl.onBusiness ( )

Definition at line 91 of file EditDataControl.java.

91  {
92  contact.setConnector(BUSINESS_DIRECTORY, business.getValue());
93  }
void setConnector(String id, String value)

◆ onDirectory()

void org.turro.www.directory.EditDataControl.onDirectory ( ) throws IOException

Definition at line 111 of file EditDataControl.java.

111  {
112  if(!Authentication.isBehaving()) {
113  // Might cause problems when BEHAVE_AS
114  Authentication.reauthenticate();
115  }
116  Application.getApplication().sendRedirect(path);
117  }

◆ onEmail()

void org.turro.www.directory.EditDataControl.onEmail ( )

Definition at line 81 of file EditDataControl.java.

81  {
82  contact.setConnector(EMAIL_DIRECTORY, email.getValue());
83  }

◆ onEvent()

void org.turro.www.directory.EditDataControl.onEvent ( UploadEvent  t) throws Exception

Definition at line 120 of file EditDataControl.java.

120  {
121  FileAttach fileAttach = new FileAttach(ContactsPU.getObjectPath(contact.getContact()));
122  File newFile = new File(ElephantContext.getRealPath(fileAttach.getPublishable() + "/profile/face.png"));
123  if(!newFile.getParentFile().exists()) {
124  newFile.getParentFile().mkdirs();
125  }
126  try (FileOutputStream fos = new FileOutputStream(newFile)) {
127  Media media = t.getMedia();
128  if(media != null) {
129  if(media.inMemory()) {
130  fos.write(media.isBinary() ? media.getByteData() : media.getStringData().getBytes());
131  } else {
132  byte[] buffer = new byte[102400];
133  try (InputStream is = media.isBinary() ? media.getStreamData() : new ReaderInputStream(media.getReaderData())) {
134  int r;
135  while((r = is.read(buffer)) != -1) {
136  fos.write(buffer, 0, r);
137  }
138  }
139  }
140  }
141  }
142  String faceFile = fileAttach.getPublicFile("/profile/face.png", false);
143  if(!Strings.isBlank(faceFile)) {
144  face.setContent(new AImage(ElephantContext.getRealPath(faceFile)));
145  } else {
146  face.setSrc(null);
147  }
148  }

◆ onNetwork()

void org.turro.www.directory.EditDataControl.onNetwork ( )

Definition at line 106 of file EditDataControl.java.

106  {
107  contact.setConnector(NETWORK_DIRECTORY, network.getValue());
108  }

◆ onPhone()

void org.turro.www.directory.EditDataControl.onPhone ( )

Definition at line 86 of file EditDataControl.java.

86  {
87  contact.setConnector(PHONE_DIRECTORY, phone.getValue());
88  }

◆ onPosition()

void org.turro.www.directory.EditDataControl.onPosition ( )

Definition at line 96 of file EditDataControl.java.

96  {
97  contact.setConnector(POSITION_DIRECTORY, position.getValue());
98  }

◆ onSave()

void org.turro.www.directory.EditDataControl.onSave ( )

Definition at line 151 of file EditDataControl.java.

151  {
152  if(contact.isWebUser()) {
153  new ContactWrapper((Contact) contact.getContact()).save();
154  Application.getApplication().sendRedirect(path); // + MarkerHelper.setObfuscatedPars("item=" + contact.getId()));
155  sendNotification((Contact) contact.getContact());
156  }
157  }

◆ onWeb()

void org.turro.www.directory.EditDataControl.onWeb ( )

Definition at line 101 of file EditDataControl.java.

101  {
102  contact.setConnector(WEB_DIRECTORY, web.getValue());
103  }

◆ setPath()

void org.turro.www.directory.EditDataControl.setPath ( String  path)

Definition at line 163 of file EditDataControl.java.

163  {
164  this.path = path;
165  }

Member Data Documentation

◆ EMAIL_DIRECTORY

final String org.turro.www.directory.EditDataControl.EMAIL_DIRECTORY = "EmailDirectory"
static

Definition at line 61 of file EditDataControl.java.


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