Rev 1814 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
203 | jmachado | 1 | package pt.estgp.estgweb.domain.dao.impl; |
2 | |||
1814 | jmachado | 3 | import pt.estgp.estgweb.domain.RepositoryFileVersion; |
4 | |||
5 | import java.util.List; |
||
6 | |||
7 | import static org.hibernate.criterion.Restrictions.eq; |
||
8 | import static org.hibernate.criterion.Restrictions.isNull; |
||
9 | import static org.hibernate.criterion.Restrictions.not; |
||
10 | |||
203 | jmachado | 11 | /** |
12 | * @author Jorge Machado |
||
13 | * @date 28/Fev/2008 |
||
14 | * @time 2:51:06 |
||
15 | * @see pt.estgp.estgweb.domain.dao.impl |
||
16 | */ |
||
17 | public class RepositoryFileVersionDaoImpl extends RepositoryFileVersionDao |
||
18 | { |
||
19 | private RepositoryFileVersionDaoImpl() |
||
20 | { |
||
21 | } |
||
22 | |||
23 | public static RepositoryFileVersionDaoImpl getInstance() |
||
24 | { |
||
25 | if (myInstance == null) |
||
26 | myInstance = new RepositoryFileVersionDaoImpl(); |
||
27 | return (RepositoryFileVersionDaoImpl) myInstance; |
||
28 | } |
||
29 | |||
1814 | jmachado | 30 | /** |
31 | * Find the real fileVersion for Md5Mirror |
||
32 | * @param md5 |
||
33 | * @return |
||
34 | */ |
||
1830 | jmachado | 35 | public RepositoryFileVersion findIdFromPhisicalMirror4Md5(1.5.0/docs/api/java/lang/String.html">String md5,1.5.0/docs/api/java/lang/Long.html">Long myId) |
1814 | jmachado | 36 | { |
37 | List<RepositoryFileVersion> repoFileVersions = createCriteria() |
||
38 | .add(eq("md5checksum",md5)) |
||
1830 | jmachado | 39 | .add(isNull("mirrorRepositoryFileVersion")) |
1814 | jmachado | 40 | .add(not(eq("id",myId))) |
41 | .list(); |
||
42 | if(repoFileVersions.size() > 0) |
||
43 | { |
||
1830 | jmachado | 44 | return repoFileVersions.get(0); |
1814 | jmachado | 45 | } |
46 | return null; |
||
47 | } |
||
203 | jmachado | 48 | |
1814 | jmachado | 49 | |
203 | jmachado | 50 | } |