18 package org.turro.attach.search;
21 import org.turro.attach.db.AttachPU;
22 import org.turro.attach.entity.Attachment;
23 import org.turro.elephant.db.SQLHelper;
24 import org.turro.elephant.db.WhereClause;
25 import org.turro.jpa.Dao;
26 import org.zkoss.lang.Strings;
34 private boolean ckNonValidated =
false, ckExactPath;
35 private String attachValue =
"*", attachPath;
42 ckNonValidated =
false;
48 wc.
addClause(
"select distinct attachment from Attachment as attachment");
51 wc.
addClause(
"order by attachment.fileName, attachment.modification DESC");
58 wc.
addClause(
"select distinct attachment.path from Attachment as attachment");
62 return new PathSet(dao.getResultList(wc), currPath,
true);
67 if(Strings.isEmpty(attachValue)) {
73 }, (attachValue ==
null ?
"" : attachValue.replaceAll(
"\\*",
"%")));
76 wc.
addClause(
"and attachment.validated = false");
79 if(attachPath !=
null) {
80 wc.
addClause(
"and UCASE(attachment.path) " +
81 (ckExactPath ?
"=" :
"like") +
93 this.attachPath = attachPath;
101 this.attachValue = attachValue;
109 this.ckExactPath = ckExactPath;
113 return ckNonValidated;
117 this.ckNonValidated = ckNonValidated;
123 " select count(attachment) " +
124 " from Attachment as attachment" +
125 " where attachment.path like '" + root +
"/%'");
void setCkExactPath(boolean ckExactPath)
void setAttachValue(String attachValue)
void setCkNonValidated(boolean ckNonValidated)
java.util.List< Attachment > getAttachmentList()
boolean isCkNonValidated()
void setAttachPath(String attachPath)
java.util.Set< String > getPathList(String currPath)
static long getCountAttachments(String root)
void addCriteria(WhereClause wc)
static WhereClause getWhereClause(String[] fields, String value)
void addClause(String clause)
void addNamedValue(String name, Object value)
Object getSingleResult(WhereClause wc)