|
static void | addStars (Object entity, int stars, SoftContact contact) |
|
static void | addStars (String path, int stars, SoftContact contact) |
|
static void | removeStars (Object entity, SoftContact contact) |
|
static void | removeStars (String path, SoftContact contact) |
|
static void | changeStars (Object entity, int newStars, SoftContact contact) |
|
static void | changeStars (String path, int newStars, SoftContact contact) |
|
static StarsInfo | stars (Object entity) |
|
static StarsInfo | stars (String path) |
|
static List< StarIt > | allStars (Object entity) |
|
static List< StarIt > | allStars (String path) |
|
static Collection< String > | paths (String path, int fromDays) |
|
- Author
- Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g
Definition at line 37 of file StarItUtil.java.
◆ addStars() [1/2]
static void org.turro.starit.StarItUtil.addStars |
( |
Object |
entity, |
|
|
int |
stars, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 39 of file StarItUtil.java.
40 String path = Entities.getController(entity).getPath();
static void addStars(Object entity, int stars, SoftContact contact)
static StarsInfo stars(Object entity)
◆ addStars() [2/2]
static void org.turro.starit.StarItUtil.addStars |
( |
String |
path, |
|
|
int |
stars, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 46 of file StarItUtil.java.
47 if(!Strings.isBlank(path) && contact !=
null && contact.isValid()) {
48 Dao dao =
new ContactsPU();
49 if(((Long) dao.getSingleResult(
50 " select count(*) from StarIt " +
52 " and (creator = ? or author_ip = ?)",
53 new Object[] { path, contact.getContact(), contact.author_ip }
55 StarIt starIt =
new StarIt();
56 starIt.setCreator((Contact) contact.getContact());
57 starIt.setAuthor_ip(contact.author_ip);
58 starIt.setDateCreation(
new Date());
59 starIt.setStars(
stars);
61 dao.saveObject(starIt);
static void changeStars(Object entity, int newStars, SoftContact contact)
◆ allStars() [1/2]
static List<StarIt> org.turro.starit.StarItUtil.allStars |
( |
Object |
entity | ) |
|
|
static |
Definition at line 150 of file StarItUtil.java.
151 String path = Entities.getController(entity).getPath();
static List< StarIt > allStars(Object entity)
◆ allStars() [2/2]
static List<StarIt> org.turro.starit.StarItUtil.allStars |
( |
String |
path | ) |
|
|
static |
Definition at line 158 of file StarItUtil.java.
159 Dao dao =
new ContactsPU();
160 return dao.getResultList(
161 " select s from StarIt as s " +
163 new Object[] { path }
◆ changeStars() [1/2]
static void org.turro.starit.StarItUtil.changeStars |
( |
Object |
entity, |
|
|
int |
newStars, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 96 of file StarItUtil.java.
97 String path = Entities.getController(entity).getPath();
◆ changeStars() [2/2]
static void org.turro.starit.StarItUtil.changeStars |
( |
String |
path, |
|
|
int |
newStars, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 103 of file StarItUtil.java.
104 if(!Strings.isBlank(path) && contact !=
null && contact.isValid()) {
105 Dao dao =
new ContactsPU();
106 if(contact.getContact() !=
null) {
112 new Object[] { newStars, path, contact.getContact() }
119 " and creator is null and author_ip = ?",
120 new Object[] { newStars, path, contact.author_ip }
◆ paths()
static Collection<String> org.turro.starit.StarItUtil.paths |
( |
String |
path, |
|
|
int |
fromDays |
|
) |
| |
|
static |
Definition at line 167 of file StarItUtil.java.
168 Dao dao =
new ContactsPU();
169 return dao.getResultList(
170 " select g.path from StarIt g " +
171 " where g.path like ? " +
172 " and g.dateCreation >= ?",
173 new Object[] { path +
"/%",
new CheckDate().addDays(-fromDays).getDate() }
◆ removeStars() [1/2]
static void org.turro.starit.StarItUtil.removeStars |
( |
Object |
entity, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 68 of file StarItUtil.java.
69 String path = Entities.getController(entity).getPath();
static void removeStars(Object entity, SoftContact contact)
◆ removeStars() [2/2]
static void org.turro.starit.StarItUtil.removeStars |
( |
String |
path, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 75 of file StarItUtil.java.
76 if(!Strings.isBlank(path) && contact !=
null && contact.isValid()) {
77 Dao dao =
new ContactsPU();
78 if(contact.getContact() !=
null) {
80 " delete from StarIt " +
83 new Object[] { path, contact.getContact() }
87 " delete from StarIt " +
89 " and (creator is null and author_ip = ?)",
90 new Object[] { path, contact.author_ip }
◆ stars() [1/2]
static StarsInfo org.turro.starit.StarItUtil.stars |
( |
Object |
entity | ) |
|
|
static |
Definition at line 126 of file StarItUtil.java.
127 String path = Entities.getController(entity).getPath();
◆ stars() [2/2]
static StarsInfo org.turro.starit.StarItUtil.stars |
( |
String |
path | ) |
|
|
static |
Definition at line 134 of file StarItUtil.java.
135 Dao dao =
new ContactsPU();
136 Object o[] = (Object[]) dao.getSingleResult(
137 " select sum(stars), count(stars) from StarIt " +
139 new Object[] { path }
142 StarsInfo si =
new StarsInfo();
143 si.stars = o[0] ==
null ? 0 : (Long) o[0];
144 si.count = o[1] ==
null ? 0 : (Long) o[1];
The documentation for this class was generated from the following file: