BrightSide Workbench Full Report + Source Code
org.turro.wd.files.WorkFile Class Reference
Inheritance diagram for org.turro.wd.files.WorkFile:
Collaboration diagram for org.turro.wd.files.WorkFile:

Public Member Functions

Date getDownModification ()
 
void setDownModification (Date downModification)
 
File getFile ()
 
void setFile (File file)
 
String getName ()
 
void setName (String name)
 
Directory getParent ()
 
void setParent (Directory parent)
 
boolean isServerLocked ()
 
void setServerLocked (boolean serverLocked)
 
String getServerLocker ()
 
void setServerLocker (String serverLocker)
 
String getServerOwner ()
 
void setServerOwner (String serverOwner)
 
String getServerOwnerName ()
 
void setServerOwnerName (String serverOwnerName)
 
long getServerSize ()
 
void setServerSize (long serverSize)
 
String getSystemPath ()
 
String getSystemName ()
 
File getSystemFile ()
 
boolean isExistsOnServer ()
 
boolean isDownloadable () throws ParseException
 
boolean isUploadable () throws ParseException
 
void readXML (Element root) throws ParseException
 
void writeXML (Element root)
 
boolean checkExisting ()
 
int compareTo (WorkFile o)
 
void doUpload (String comment, int commitAction)
 
void doDownload (int updateAction)
 
void doUnlock ()
 

Detailed Description

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

Definition at line 42 of file WorkFile.java.

Member Function Documentation

◆ checkExisting()

boolean org.turro.wd.files.WorkFile.checkExisting ( )

Definition at line 162 of file WorkFile.java.

162  {
163  return getSystemFile().exists();
164  }
Here is the call graph for this function:

◆ compareTo()

int org.turro.wd.files.WorkFile.compareTo ( WorkFile  o)

Definition at line 166 of file WorkFile.java.

166  {
167  if(getName() == null || o.getName() == null) {
168  return 0;
169  }
170  return getName().compareTo(o.getName());
171  }
Here is the call graph for this function:

◆ doDownload()

void org.turro.wd.files.WorkFile.doDownload ( int  updateAction)

Definition at line 196 of file WorkFile.java.

196  {
197  try {
198  if((updateAction == SyncTask.UPDATE_DO_NOTHING) ||
199  (!isDownloadable()) && !(updateAction == SyncTask.UPDATE_UPDATE_FOR_EDITING)) return;
200  GetQuery getQuery = new GetQuery(
201  parent.getHost(), parent.getPort(),
202  parent.getContext() + "/pservice/download", false);
203  getQuery.getParameters().put("user", parent.getUser());
204  getQuery.getParameters().put("forEditing",
205  (updateAction == SyncTask.UPDATE_UPDATE_FOR_EDITING) ? "true" : "false");
206  getQuery.getParameters().put("path", parent.getAbsolutePath());
207  getQuery.getParameters().put("fileName", getName());
208  getQuery.setSerializer(new FileSerializer());
209  File receivedFile = (File) getQuery.execute();
210  new File(parent.getSystemPath()).mkdirs();
211  File saveFile = getSystemFile();
212  OutputStream os = new FileOutputStream(saveFile);
213  ((FileSerializer) getQuery.getSerializer())
214  .writeObject(receivedFile, os);
215  os.close();
216  saveFile.setLastModified(downModification.getTime());
217  } catch (ParseException ex) {
218  Logger.getLogger(WorkFile.class.getName()).log(Level.SEVERE, null, ex);
219  } catch (IOException ex) {
220  Logger.getLogger(WorkFile.class.getName()).log(Level.SEVERE, null, ex);
221  } catch (SerializationException ex) {
222  Logger.getLogger(WorkFile.class.getName()).log(Level.SEVERE, null, ex);
223  } catch (QueryException ex) {
224  Logger.getLogger(WorkFile.class.getName()).log(Level.SEVERE, null, ex);
225  }
226  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doUnlock()

void org.turro.wd.files.WorkFile.doUnlock ( )

Definition at line 228 of file WorkFile.java.

228  {
229  try {
230  GetQuery getQuery = new GetQuery(
231  parent.getHost(), parent.getPort(),
232  parent.getContext() + "/pservice/unlock", false);
233  getQuery.getParameters().put("user", parent.getUser());
234  getQuery.getParameters().put("path", parent.getAbsolutePath());
235  getQuery.getParameters().put("fileName", getName());
236  getQuery.setSerializer(new BinarySerializer());
237  getQuery.execute();
238  } catch (QueryException ex) {
239  Logger.getLogger(Directory.class.getName()).log(Level.SEVERE, null, ex);
240  }
241  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doUpload()

void org.turro.wd.files.WorkFile.doUpload ( String  comment,
int  commitAction 
)

Definition at line 173 of file WorkFile.java.

173  {
174  try {
175  if((commitAction == SyncTask.COMMIT_DO_NOTHING) || !isUploadable()) return;
176  PostQuery postQuery = new PostQuery(
177  parent.getHost(), parent.getPort(),
178  parent.getContext() + "/pservice/upload", false);
179  postQuery.getParameters().put("user", parent.getUser());
180  postQuery.getParameters().put("path", parent.getAbsolutePath());
181  postQuery.getParameters().put("fileName", getName());
182  postQuery.getParameters().put("fileDate", WdFormats.format(file.lastModified()));
183  postQuery.getParameters().put("comment", comment);
184  postQuery.getParameters().put("lock",
185  (((commitAction == SyncTask.COMMIT_KEEP_LOCK) && isServerLocked()) ? "true" : "false"));
186  postQuery.setSerializer(new FileSerializer());
187  postQuery.setValue(file);
188  postQuery.execute();
189  } catch (ParseException ex) {
190  Logger.getLogger(WorkFile.class.getName()).log(Level.SEVERE, null, ex);
191  } catch (QueryException ex) {
192  Logger.getLogger(WorkFile.class.getName()).log(Level.SEVERE, null, ex);
193  }
194  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDownModification()

Date org.turro.wd.files.WorkFile.getDownModification ( )

Definition at line 51 of file WorkFile.java.

51  {
52  return downModification;
53  }
Here is the caller graph for this function:

◆ getFile()

File org.turro.wd.files.WorkFile.getFile ( )

Definition at line 59 of file WorkFile.java.

59  {
60  return file;
61  }

◆ getName()

String org.turro.wd.files.WorkFile.getName ( )

Definition at line 67 of file WorkFile.java.

67  {
68  return name;
69  }
Here is the caller graph for this function:

◆ getParent()

Directory org.turro.wd.files.WorkFile.getParent ( )

Definition at line 75 of file WorkFile.java.

75  {
76  return parent;
77  }

◆ getServerLocker()

String org.turro.wd.files.WorkFile.getServerLocker ( )

Definition at line 91 of file WorkFile.java.

91  {
92  return serverLocker;
93  }
Here is the caller graph for this function:

◆ getServerOwner()

String org.turro.wd.files.WorkFile.getServerOwner ( )

Definition at line 99 of file WorkFile.java.

99  {
100  return serverOwner;
101  }

◆ getServerOwnerName()

String org.turro.wd.files.WorkFile.getServerOwnerName ( )

Definition at line 107 of file WorkFile.java.

107  {
108  return serverOwnerName;
109  }

◆ getServerSize()

long org.turro.wd.files.WorkFile.getServerSize ( )

Definition at line 115 of file WorkFile.java.

115  {
116  return serverSize;
117  }

◆ getSystemFile()

File org.turro.wd.files.WorkFile.getSystemFile ( )

Definition at line 131 of file WorkFile.java.

131  {
132  return new File(getSystemPath());
133  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSystemName()

String org.turro.wd.files.WorkFile.getSystemName ( )

Definition at line 127 of file WorkFile.java.

127  {
128  return getName();
129  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSystemPath()

String org.turro.wd.files.WorkFile.getSystemPath ( )

Definition at line 123 of file WorkFile.java.

123  {
124  return parent.getSystemPath() + "/" + getSystemName();
125  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDownloadable()

boolean org.turro.wd.files.WorkFile.isDownloadable ( ) throws ParseException

Definition at line 139 of file WorkFile.java.

139  {
140  return (file == null || (getDownModification() != null &&
141  WdFormats.before(downModification, file.lastModified()))) &&
142  parent.isUpdatable();
143  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isExistsOnServer()

boolean org.turro.wd.files.WorkFile.isExistsOnServer ( )

Definition at line 135 of file WorkFile.java.

135  {
136  return getDownModification() != null;
137  }
Here is the call graph for this function:

◆ isServerLocked()

boolean org.turro.wd.files.WorkFile.isServerLocked ( )

Definition at line 83 of file WorkFile.java.

83  {
84  return serverLocked;
85  }
Here is the caller graph for this function:

◆ isUploadable()

boolean org.turro.wd.files.WorkFile.isUploadable ( ) throws ParseException

Definition at line 145 of file WorkFile.java.

145  {
146  return (file != null && (getDownModification() == null ||
147  WdFormats.after(downModification, file.lastModified()))) &&
148  parent.isUpdatable();
149  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readXML()

void org.turro.wd.files.WorkFile.readXML ( Element  root) throws ParseException

Definition at line 151 of file WorkFile.java.

151  {
152  if(root.getAttributeValue("name") != null)
153  setName(root.getAttributeValue("name"));
154  }
void setName(String name)
Definition: WorkFile.java:71
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDownModification()

void org.turro.wd.files.WorkFile.setDownModification ( Date  downModification)

Definition at line 55 of file WorkFile.java.

55  {
56  this.downModification = downModification;
57  }
Here is the caller graph for this function:

◆ setFile()

void org.turro.wd.files.WorkFile.setFile ( File  file)

Definition at line 63 of file WorkFile.java.

63  {
64  this.file = file;
65  }
Here is the caller graph for this function:

◆ setName()

void org.turro.wd.files.WorkFile.setName ( String  name)

Definition at line 71 of file WorkFile.java.

71  {
72  this.name = name;
73  }
Here is the caller graph for this function:

◆ setParent()

void org.turro.wd.files.WorkFile.setParent ( Directory  parent)

Definition at line 79 of file WorkFile.java.

79  {
80  this.parent = parent;
81  }
Here is the caller graph for this function:

◆ setServerLocked()

void org.turro.wd.files.WorkFile.setServerLocked ( boolean  serverLocked)

Definition at line 87 of file WorkFile.java.

87  {
88  this.serverLocked = serverLocked;
89  }
Here is the caller graph for this function:

◆ setServerLocker()

void org.turro.wd.files.WorkFile.setServerLocker ( String  serverLocker)

Definition at line 95 of file WorkFile.java.

95  {
96  this.serverLocker = serverLocker;
97  }
Here is the caller graph for this function:

◆ setServerOwner()

void org.turro.wd.files.WorkFile.setServerOwner ( String  serverOwner)

Definition at line 103 of file WorkFile.java.

103  {
104  this.serverOwner = serverOwner;
105  }
Here is the caller graph for this function:

◆ setServerOwnerName()

void org.turro.wd.files.WorkFile.setServerOwnerName ( String  serverOwnerName)

Definition at line 111 of file WorkFile.java.

111  {
112  this.serverOwnerName = serverOwnerName;
113  }

◆ setServerSize()

void org.turro.wd.files.WorkFile.setServerSize ( long  serverSize)

Definition at line 119 of file WorkFile.java.

119  {
120  this.serverSize = serverSize;
121  }
Here is the caller graph for this function:

◆ writeXML()

void org.turro.wd.files.WorkFile.writeXML ( Element  root)

Definition at line 156 of file WorkFile.java.

156  {
157  Element el = new Element("wfile");
158  el.setAttribute("name", getName());
159  root.addContent(el);
160  }
Here is the call graph for this function:

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