BrightSide Workbench Full Report + Source Code
org.turro.attach.search.AttachResults Class Reference

Public Member Functions

 AttachResults ()
 
void markAll ()
 
boolean isPublicOnly ()
 
void setPublicOnly (boolean publicOnly)
 
java.util.List< AttachmentgetAttachmentList ()
 
java.util.List< AttachmentgetVersionedAttachmentList ()
 
java.util.Set< String > getPathList (String currPath)
 
void addCriteria (WhereClause wc)
 
String getAttachPath ()
 
void setAttachPath (String attachPath)
 
String getAttachValue ()
 
void setAttachValue (String attachValue)
 
IContact getByParticipant ()
 
void setByParticipant (IContact byParticipant)
 
boolean isCkExactPath ()
 
void setCkExactPath (boolean ckExactPath)
 
boolean isCkNonValidated ()
 
void setCkNonValidated (boolean ckNonValidated)
 
boolean isCkOthers ()
 
void setCkOthers (boolean ckOthers)
 

Static Public Member Functions

static long getCountAttachments (String root)
 

Detailed Description

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

Definition at line 37 of file AttachResults.java.

Constructor & Destructor Documentation

◆ AttachResults()

org.turro.attach.search.AttachResults.AttachResults ( )

Definition at line 45 of file AttachResults.java.

45  {
46  }

Member Function Documentation

◆ addCriteria()

void org.turro.attach.search.AttachResults.addCriteria ( WhereClause  wc)

Definition at line 94 of file AttachResults.java.

94  {
95 
96  if(Strings.isEmpty(attachValue) || (ckOthers && app!= null && !app.isInRole("attach-show:all"))) {
97  return;
98  }
99 
100  if(byParticipant == null) {
101  byParticipant = Authentication.getIContact();
102  }
103 
104  wc = SQLHelper.getWhereClause(wc, new String[] {
105  "attachment.fileName"
106  }, (attachValue == null ? "" : attachValue.replaceAll("\\*", "%")));
107 
108  if(!(ckOthers && app!= null && app.isInRole("attach-show:all")) && byParticipant != null) {
109  wc.addClause("and (");
110 
111  wc.addClause("attachment.onlyOwner = false");
112 
113  wc.addClause("or");
114 
115  wc.addClause("(attachment.onlyOwner = true and attachment.owner = :idOwner)");
116  wc.addNamedValue("idOwner", byParticipant.getId());
117 
118  wc.addClause(")");
119  }
120 
121  if(ckNonValidated) {
122  wc.addClause("and attachment.validated = false");
123  }
124 
125  if(publicOnly) {
126  wc.addClause("and attachment.publishable = true");
127  }
128 
129  if(attachPath != null) {
130  wc.addClause("and UCASE(attachment.path) " +
131  (ckExactPath ? "=" : "like") +
132  " UCASE(:path)");
133  wc.addNamedValue("path", attachPath);
134  }
135  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAttachmentList()

java.util.List<Attachment> org.turro.attach.search.AttachResults.getAttachmentList ( )

Definition at line 62 of file AttachResults.java.

62  {
63  Dao dao = new AttachPU();
64  WhereClause wc = new WhereClause();
65  wc.addClause("select distinct attachment from Attachment as attachment");
66  wc.addClause("where 1=1");
67  addCriteria(wc);
68  wc.addClause("order by attachment.fileName, attachment.modification DESC");
69  return new AttachmentList(dao.getResultList(wc), ckOthers && app!= null && app.isInRole("attach-show:all"));
70  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAttachPath()

String org.turro.attach.search.AttachResults.getAttachPath ( )

Definition at line 137 of file AttachResults.java.

137  {
138  return attachPath;
139  }

◆ getAttachValue()

String org.turro.attach.search.AttachResults.getAttachValue ( )

Definition at line 145 of file AttachResults.java.

145  {
146  return attachValue;
147  }

◆ getByParticipant()

IContact org.turro.attach.search.AttachResults.getByParticipant ( )

Definition at line 153 of file AttachResults.java.

153  {
154  return byParticipant;
155  }

◆ getCountAttachments()

static long org.turro.attach.search.AttachResults.getCountAttachments ( String  root)
static

Definition at line 185 of file AttachResults.java.

185  {
186  Dao dao = new AttachPU();
187  return (Long) dao.getSingleResult(
188  " select count(attachment) " +
189  " from Attachment as attachment" +
190  " where attachment.path like '" + root + "/%'");
191  }
Here is the call graph for this function:

◆ getPathList()

java.util.Set<String> org.turro.attach.search.AttachResults.getPathList ( String  currPath)

Definition at line 84 of file AttachResults.java.

84  {
85  Dao dao = new AttachPU();
86  WhereClause wc = new WhereClause();
87  wc.addClause("select distinct attachment.path from Attachment as attachment");
88  wc.addClause("where 1=1");
89  addCriteria(wc);
90  wc.addClause("order by attachment.path");
91  return new PathSet(dao.getResultList(wc), currPath, ckOthers && app!= null && app.isInRole("attach-show:all"));
92  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVersionedAttachmentList()

java.util.List<Attachment> org.turro.attach.search.AttachResults.getVersionedAttachmentList ( )

Definition at line 72 of file AttachResults.java.

72  {
73  AttachVersionMap avm = new AttachVersionMap();
74  for(Attachment a : getAttachmentList()) {
75  avm.addAttachment(a);
76  }
77  ArrayList<Attachment> list = new ArrayList<>();
78  for(AttachVersionSet avs : avm.values()) {
79  list.add(avs.first());
80  }
81  return list;
82  }
java.util.List< Attachment > getAttachmentList()
Here is the call graph for this function:

◆ isCkExactPath()

boolean org.turro.attach.search.AttachResults.isCkExactPath ( )

Definition at line 161 of file AttachResults.java.

161  {
162  return ckExactPath;
163  }

◆ isCkNonValidated()

boolean org.turro.attach.search.AttachResults.isCkNonValidated ( )

Definition at line 169 of file AttachResults.java.

169  {
170  return ckNonValidated;
171  }

◆ isCkOthers()

boolean org.turro.attach.search.AttachResults.isCkOthers ( )

Definition at line 177 of file AttachResults.java.

177  {
178  return ckOthers;
179  }

◆ isPublicOnly()

boolean org.turro.attach.search.AttachResults.isPublicOnly ( )

Definition at line 54 of file AttachResults.java.

54  {
55  return publicOnly;
56  }

◆ markAll()

void org.turro.attach.search.AttachResults.markAll ( )

Definition at line 48 of file AttachResults.java.

48  {
49  attachValue = "*";
50  ckOthers = app != null && app.isInRole("attach-show:all");
51  ckNonValidated = false;
52  }
Here is the call graph for this function:

◆ setAttachPath()

void org.turro.attach.search.AttachResults.setAttachPath ( String  attachPath)

Definition at line 141 of file AttachResults.java.

141  {
142  this.attachPath = attachPath;
143  }
Here is the caller graph for this function:

◆ setAttachValue()

void org.turro.attach.search.AttachResults.setAttachValue ( String  attachValue)

Definition at line 149 of file AttachResults.java.

149  {
150  this.attachValue = attachValue;
151  }
Here is the caller graph for this function:

◆ setByParticipant()

void org.turro.attach.search.AttachResults.setByParticipant ( IContact  byParticipant)

Definition at line 157 of file AttachResults.java.

157  {
158  this.byParticipant = byParticipant;
159  }

◆ setCkExactPath()

void org.turro.attach.search.AttachResults.setCkExactPath ( boolean  ckExactPath)

Definition at line 165 of file AttachResults.java.

165  {
166  this.ckExactPath = ckExactPath;
167  }
Here is the caller graph for this function:

◆ setCkNonValidated()

void org.turro.attach.search.AttachResults.setCkNonValidated ( boolean  ckNonValidated)

Definition at line 173 of file AttachResults.java.

173  {
174  this.ckNonValidated = ckNonValidated;
175  }
Here is the caller graph for this function:

◆ setCkOthers()

void org.turro.attach.search.AttachResults.setCkOthers ( boolean  ckOthers)

Definition at line 181 of file AttachResults.java.

181  {
182  this.ckOthers = ckOthers;
183  }

◆ setPublicOnly()

void org.turro.attach.search.AttachResults.setPublicOnly ( boolean  publicOnly)

Definition at line 58 of file AttachResults.java.

58  {
59  this.publicOnly = publicOnly;
60  }
Here is the caller graph for this function:

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