Coverage Report - org.kuali.student.lum.lu.dao.impl.LuDaoImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
LuDaoImpl
64%
161/248
42%
12/28
1.292
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.lum.lu.dao.impl;
 17  
 
 18  
 import java.util.Date;
 19  
 import java.util.List;
 20  
 
 21  
 import javax.persistence.EntityManager;
 22  
 import javax.persistence.PersistenceContext;
 23  
 import javax.persistence.Query;
 24  
 
 25  
 import org.kuali.student.common.dao.impl.AbstractSearchableCrudDaoImpl;
 26  
 import org.kuali.student.common.versionmanagement.dto.VersionDisplayInfo;
 27  
 import org.kuali.student.lum.lu.dao.LuDao;
 28  
 import org.kuali.student.lum.lu.entity.Clu;
 29  
 import org.kuali.student.lum.lu.entity.CluCluRelation;
 30  
 import org.kuali.student.lum.lu.entity.CluLoRelation;
 31  
 import org.kuali.student.lum.lu.entity.CluPublication;
 32  
 import org.kuali.student.lum.lu.entity.CluResult;
 33  
 import org.kuali.student.lum.lu.entity.CluResultType;
 34  
 import org.kuali.student.lum.lu.entity.CluSet;
 35  
 import org.kuali.student.lum.lu.entity.Lui;
 36  
 import org.kuali.student.lum.lu.entity.LuiLuiRelation;
 37  
 
 38  
 import edu.emory.mathcs.backport.java.util.Collections;
 39  
 
 40  12
 public class LuDaoImpl extends AbstractSearchableCrudDaoImpl implements LuDao {
 41  
 
 42  
         @PersistenceContext(unitName = "Lu")
 43  
         @Override
 44  
         public void setEm(EntityManager em) {
 45  4
                 super.setEm(em);
 46  4
         }
 47  
 
 48  
         @Override
 49  
         public List<Clu> getClusByIdList(List<String> cluIdList) {
 50  2
                 Query query = em.createNamedQuery("Clu.findClusByIdList");
 51  2
                 query.setParameter("idList", cluIdList);
 52  
                 @SuppressWarnings("unchecked")
 53  2
                 List<Clu> resultList = query.getResultList();
 54  2
                 return resultList;
 55  
         }
 56  
 
 57  
         @Override
 58  
         public List<Clu> getClusByLuType(String luTypeKey, String luState) {
 59  6
                 Query query = em.createNamedQuery("Clu.getClusByLuType");
 60  6
                 query.setParameter("luTypeKey", luTypeKey);
 61  6
                 query.setParameter("luState", luState);
 62  
                 @SuppressWarnings("unchecked")
 63  6
                 List<Clu> resultList = query.getResultList();
 64  6
                 return resultList;
 65  
         }
 66  
 
 67  
         @Override
 68  
         public List<CluSet> getCluSetInfoByIdList(List<String> cluSetIdList) {
 69  7
                 Query query = em.createNamedQuery("CluSet.getCluSetInfoByIdList");
 70  7
                 query.setParameter("cluSetIdList", cluSetIdList);
 71  
                 @SuppressWarnings("unchecked")
 72  7
                 List<CluSet> resultList = query.getResultList();
 73  7
                 return resultList;
 74  
         }
 75  
 
 76  
         @Override
 77  
         public List<Lui> getLuisByIdList(List<String> luiIds) {
 78  2
                 Query query = em.createNamedQuery("Lui.getLuisByIdList");
 79  2
                 query.setParameter("luiIdList", luiIds);
 80  
                 @SuppressWarnings("unchecked")
 81  2
                 List<Lui> luis = query.getResultList();
 82  2
                 return luis;
 83  
         }
 84  
 
 85  
         @Override
 86  
         public List<String> getLuiIdsByCluId(String cluId) {
 87  3
                 Query query = em.createNamedQuery("Lui.getLuiIdsByCluId");
 88  3
                 query.setParameter("cluId", cluId);
 89  
                 @SuppressWarnings("unchecked")
 90  3
                 List<String> luiIds = query.getResultList();
 91  3
                 return luiIds;
 92  
         }
 93  
 
 94  
         @Override
 95  
         public List<Lui> getLuisByRelationType(String luiId,
 96  
                         String luLuRelationTypeId) {
 97  2
                 Query query = em
 98  
                                 .createNamedQuery("LuiLuiRelation.getLuisByRelationType");
 99  2
                 query.setParameter("luiId", luiId);
 100  2
                 query.setParameter("luLuRelationTypeId", luLuRelationTypeId);
 101  
 
 102  
                 @SuppressWarnings("unchecked")
 103  2
                 List<Lui> luis = query.getResultList();
 104  2
                 return luis;
 105  
         }
 106  
 
 107  
         @Override
 108  
         public List<String> getLuiIdsByRelationType(String relatedLuiId,
 109  
                         String luLuRelationTypeId) {
 110  2
                 Query query = em
 111  
                                 .createNamedQuery("LuiLuiRelation.getLuiIdsByRelationType");
 112  2
                 query.setParameter("luiId", relatedLuiId);
 113  2
                 query.setParameter("luLuRelationTypeId", luLuRelationTypeId);
 114  
 
 115  
                 @SuppressWarnings("unchecked")
 116  2
                 List<String> luiIds = query.getResultList();
 117  2
                 return luiIds;
 118  
         }
 119  
 
 120  
         @Override
 121  
         public List<String> getLuiIdsInAtpByCluId(String cluId, String atpKey) {
 122  4
                 Query query = em.createNamedQuery("Lui.getLuiIdsInAtpByCluId");
 123  4
                 query.setParameter("cluId", cluId);
 124  4
                 query.setParameter("atpKey", atpKey);
 125  
                 @SuppressWarnings("unchecked")
 126  4
                 List<String> luiIds = query.getResultList();
 127  4
                 return luiIds;
 128  
         }
 129  
 
 130  
         @Override
 131  
         public Boolean isCluInCluSet(String cluId, String cluSetId) {
 132  4
                 Query query = em.createNamedQuery("CluSet.isCluInCluSet");
 133  4
                 query.setParameter("cluId", cluId);
 134  4
                 query.setParameter("cluSetId", cluSetId);
 135  4
                 Long valid = (Long) query.getSingleResult();
 136  4
                 return valid.intValue() > 0;
 137  
         }
 138  
 
 139  
         @Override
 140  
         public List<LuiLuiRelation> getLuiLuiRelations(String luiId) {
 141  3
                 Query query = em
 142  
                                 .createNamedQuery("LuiLuiRelation.getLuiLuiRelationsByLuiId");
 143  3
                 query.setParameter("luiId", luiId);
 144  
                 @SuppressWarnings("unchecked")
 145  3
                 List<LuiLuiRelation> luiLuiRelations = query.getResultList();
 146  3
                 return luiLuiRelations;
 147  
         }
 148  
 
 149  
         @Override
 150  
         public List<CluCluRelation> getCluCluRelationsByClu(String cluId) {
 151  80
                 Query query = em.createNamedQuery("CluCluRelation.getCluCluRelation");
 152  80
                 query.setParameter("cluId", cluId);
 153  
                 @SuppressWarnings("unchecked")
 154  80
                 List<CluCluRelation> cluCluRelations = query.getResultList();
 155  80
                 return cluCluRelations;
 156  
         }
 157  
 
 158  
         @Override
 159  
         public List<String> getCluIdsByLoId(String loId) {
 160  0
                 Query query = em.createNamedQuery("Clu.getCluIdsByLoId");
 161  0
                 query.setParameter("loId", loId);
 162  
                 @SuppressWarnings("unchecked")
 163  0
                 List<String> cluIds = query.getResultList();
 164  0
                 return cluIds;
 165  
         }
 166  
 
 167  
         @Override
 168  
         public List<String> getRelatedCluIdsByCluId(String cluId,
 169  
                         String luLuRelationTypeId) {
 170  85
                 Query query = em
 171  
                                 .createNamedQuery("CluCluRelation.getRelatedCluIdsByCluId");
 172  85
                 query.setParameter("cluId", cluId);
 173  85
                 query.setParameter("luLuRelationTypeId", luLuRelationTypeId);
 174  
                 @SuppressWarnings("unchecked")
 175  85
                 List<String> relatedCluIds = query.getResultList();
 176  85
                 return relatedCluIds;
 177  
         }
 178  
 
 179  
         @Override
 180  
     public List<String> getCluIdsByRelatedCluId(String relatedCluId, String luLuRelationTypeId) {
 181  17
         Query query = em.createNamedQuery("CluCluRelation.getCluIdsByRelatedCluId");
 182  17
         query.setParameter("relatedCluId", relatedCluId);
 183  17
         query.setParameter("luLuRelationTypeId", luLuRelationTypeId);
 184  
         @SuppressWarnings("unchecked")
 185  17
         List<String> relatedCluIds = query.getResultList();
 186  17
         return relatedCluIds;
 187  
     }
 188  
 
 189  
     @Override
 190  
         public List<Clu> getRelatedClusByCluId(String cluId,
 191  
                         String luLuRelationTypeId) {
 192  64
                 Query query = em
 193  
                                 .createNamedQuery("CluCluRelation.getRelatedClusByCluId");
 194  64
                 query.setParameter("cluId", cluId);
 195  64
                 query.setParameter("luLuRelationTypeId", luLuRelationTypeId);
 196  
                 @SuppressWarnings("unchecked")
 197  64
                 List<Clu> relatedClus = query.getResultList();
 198  64
                 return relatedClus;
 199  
         }
 200  
 
 201  
     @Override
 202  
         public List<Clu> getClusByRelatedCluId(String relatedCluId,
 203  
                         String luLuRelationTypeId) {
 204  0
                 Query query = em
 205  
                                 .createNamedQuery("CluCluRelation.getClusByRelatedCluId");
 206  0
                 query.setParameter("relatedCluId", relatedCluId);
 207  0
                 query.setParameter("luLuRelationTypeId", luLuRelationTypeId);
 208  
                 @SuppressWarnings("unchecked")
 209  0
                 List<Clu> relatedClus = query.getResultList();
 210  0
                 return relatedClus;
 211  
         }
 212  
     
 213  
     
 214  
     
 215  
         @Override
 216  
         public List<String> getRelatedLuiIdsByLuiId(String luiId,
 217  
                         String luLuRelationTypeId) {
 218  1
                 Query query = em
 219  
                                 .createNamedQuery("LuiLuiRelation.getRelatedLuiIdsByLuiId");
 220  1
                 query.setParameter("luiId", luiId);
 221  1
                 query.setParameter("luLuRelationTypeId", luLuRelationTypeId);
 222  
                 @SuppressWarnings("unchecked")
 223  1
                 List<String> relatedLuiIds = query.getResultList();
 224  1
                 return relatedLuiIds;
 225  
         }
 226  
 
 227  
         @Override
 228  
         public List<Lui> getRelatedLuisByLuiId(String luiId,
 229  
                         String luLuRelationTypeId) {
 230  1
                 Query query = em
 231  
                                 .createNamedQuery("LuiLuiRelation.getRelatedLuisByLuiId");
 232  1
                 query.setParameter("luiId", luiId);
 233  1
                 query.setParameter("luLuRelationTypeId", luLuRelationTypeId);
 234  
                 @SuppressWarnings("unchecked")
 235  1
                 List<Lui> relatedLuis = query.getResultList();
 236  1
                 return relatedLuis;
 237  
         }
 238  
 
 239  
         @Override
 240  
         public List<Clu> getClusByRelation(String parentCluId,
 241  
                         String luLuRelationTypeKey) {
 242  3
                 Query query = em.createNamedQuery("Clu.getClusByRelation");
 243  3
                 query.setParameter("parentCluId", parentCluId);
 244  3
                 query.setParameter("luLuRelationTypeKey", luLuRelationTypeKey);
 245  
                 @SuppressWarnings("unchecked")
 246  3
                 List<Clu> resultList = query.getResultList();
 247  3
                 return resultList;
 248  
         }
 249  
 
 250  
         @Override
 251  
         public List<Clu> getClusByRelationSt(String cluId, String luLuRelationTypeId, List<String> luStateList) {
 252  0
                 Query query = em.createNamedQuery("CluCluRelation.getRelatedClusByCluIdSt");
 253  0
                 query.setParameter("cluId", cluId);
 254  0
                 query.setParameter("luLuRelationTypeId", luLuRelationTypeId);
 255  0
                 query.setParameter("luStateList", luStateList);
 256  
                 @SuppressWarnings("unchecked")
 257  0
                 List<Clu> resultList = query.getResultList();
 258  
                 
 259  0
                 query = em.createNamedQuery("CluCluRelation.getClusByRelatedCluIdSt");
 260  0
                 query.setParameter("relatedCluId", cluId);
 261  0
                 query.setParameter("luLuRelationTypeId", luLuRelationTypeId);
 262  0
                 query.setParameter("luStateList", luStateList);                
 263  0
                 List<Clu> resultListRel = query.getResultList();
 264  0
                 if(resultListRel != null)
 265  0
                         for(Clu clu:resultListRel) {
 266  0
                                 if (!resultList.contains(clu))
 267  0
                                         resultList.add(clu);
 268  
                         }
 269  
                 
 270  0
                 return resultList;
 271  
         }
 272  
         
 273  
         @Override
 274  
         public List<CluLoRelation> getCluLoRelationsByClu(String cluId) {
 275  184
                 Query query = em
 276  
                                 .createNamedQuery("CluLoRelation.getCluLoRelationByClu");
 277  184
                 query.setParameter("cluId", cluId);
 278  
                 @SuppressWarnings("unchecked")
 279  184
                 List<CluLoRelation> cluLoRelations = query.getResultList();
 280  184
                 return cluLoRelations;
 281  
         }
 282  
 
 283  
         @Override
 284  
         public List<CluLoRelation> getCluLoRelationsByLo(String loId) {
 285  1
                 Query query = em
 286  
                                 .createNamedQuery("CluLoRelation.getCluLoRelationByLo");
 287  1
                 query.setParameter("loId", loId);
 288  
                 @SuppressWarnings("unchecked")
 289  1
                 List<CluLoRelation> cluLoRelations = query.getResultList();
 290  1
                 return cluLoRelations;
 291  
         }
 292  
 
 293  
         @Override
 294  
         public List<CluLoRelation> getCluLoRelationsByCludIdAndLoId(String cluId,
 295  
                         String loId) {
 296  102
                 Query query = em.createNamedQuery("CluLoRelation.getCluLoRelation");
 297  102
                 query.setParameter("cluId", cluId);
 298  102
                 query.setParameter("loId", loId);
 299  
 
 300  
                 @SuppressWarnings("unchecked")
 301  102
                 List<CluLoRelation> rels = query.getResultList();
 302  102
                 return rels;
 303  
         }
 304  
 
 305  
         @Override
 306  
         public List<String> getAllowedLuLuRelationTypesForLuType(String luTypeId,
 307  
                         String relatedLuTypeId) {
 308  0
                 Query query = em
 309  
                                 .createNamedQuery("AllowedLuLuRelationType.getAllowedTypesByLuTypes");
 310  0
                 query.setParameter("luTypeId", luTypeId);
 311  0
                 query.setParameter("relatedLuTypeId", relatedLuTypeId);
 312  
                 @SuppressWarnings("unchecked")
 313  0
                 List<String> resultList = query.getResultList();
 314  0
                 return resultList;
 315  
         }
 316  
 
 317  
         @Override
 318  
         public List<String> getAllowedCluLoRelationTypesForLuType(String luTypeId) {
 319  0
                 Query query = em
 320  
                                 .createNamedQuery("AllowedCluLoRealtionType.getAllowedTypesByLuType");
 321  0
                 query.setParameter("luTypeId", luTypeId);
 322  
                 @SuppressWarnings("unchecked")
 323  0
                 List<String> resultList = query.getResultList();
 324  0
                 return resultList;
 325  
         }
 326  
 
 327  
         @Override
 328  
         public List<String> getAllowedResultUsageTypesForLuType(String luTypeId) {
 329  0
                 Query query = em
 330  
                                 .createNamedQuery("AllowedResultUsageLuType.getAllowedTypesByLuType");
 331  0
                 query.setParameter("luTypeId", luTypeId);
 332  
                 @SuppressWarnings("unchecked")
 333  0
                 List<String> resultList = query.getResultList();
 334  0
                 return resultList;
 335  
         }
 336  
 
 337  
         @Override
 338  
         public List<String> getAllowedResultComponentTypesForResultUsageType(
 339  
                         String resultUsageType) {
 340  0
                 Query query = em
 341  
                                 .createNamedQuery("AllowedResultComponentUsageType.getAllowedComponentsByUsageType");
 342  0
                 query.setParameter("resultUsageType", resultUsageType);
 343  
                 @SuppressWarnings("unchecked")
 344  0
                 List<String> resultList = query.getResultList();
 345  0
                 return resultList;
 346  
         }
 347  
 
 348  
         @Override
 349  
         public List<CluResultType> getAllowedCluResultTypesForLuType(String luTypeId) {
 350  0
                 Query query = em
 351  
                                 .createNamedQuery("AllowedCluResultLuType.getAllowedTypesByLuType");
 352  0
                 query.setParameter("luTypeId", luTypeId);
 353  
                 @SuppressWarnings("unchecked")
 354  0
                 List<CluResultType> resultList = query.getResultList();
 355  0
                 return resultList;
 356  
         }
 357  
 
 358  
         @Override
 359  
         public List<String> getCluIdsByResultUsageType(String resultUsageTypeKey) {
 360  0
                 Query query = em
 361  
                                 .createNamedQuery("CluResult.getCluIdByResultUsageType");
 362  0
                 query.setParameter("resultUsageType", resultUsageTypeKey);
 363  
                 @SuppressWarnings("unchecked")
 364  0
                 List<String> resultList = query.getResultList();
 365  0
                 return resultList;
 366  
         }
 367  
 
 368  
         @Override
 369  
         public List<String> getCluIdsByResultComponentId(String resultComponentId) {
 370  0
                 Query query = em
 371  
                                 .createNamedQuery("CluResult.getCluIdByResultComponentId");
 372  0
                 query.setParameter("resultComponentId", resultComponentId);
 373  
                 @SuppressWarnings("unchecked")
 374  0
                 List<String> resultList = query.getResultList();
 375  0
                 return resultList;
 376  
         }
 377  
 
 378  
         @Override
 379  
         public List<String> getAllowedLuLuRelationTypesByLuiId(String luiId,
 380  
                         String relatedLuiId) {
 381  0
                 Query query = em
 382  
                                 .createNamedQuery("LuiLuiRelation.getRelationTypeByLuiId");
 383  0
                 query.setParameter("luiId", luiId);
 384  0
                 query.setParameter("relatedLuiId", relatedLuiId);
 385  
                 @SuppressWarnings("unchecked")
 386  0
                 List<String> resultList = query.getResultList();
 387  0
                 return resultList;
 388  
         }
 389  
 
 390  
         @Override
 391  
         public List<String> getAllowedLuLuRelationTypesByCluId(String cluId,
 392  
                         String relatedCluId) {
 393  0
                 Query query = em
 394  
                                 .createNamedQuery("CluCluRelation.getRelationTypeByCluId");
 395  0
                 query.setParameter("cluId", cluId);
 396  0
                 query.setParameter("relatedCluId", relatedCluId);
 397  
                 @SuppressWarnings("unchecked")
 398  0
                 List<String> resultList = query.getResultList();
 399  0
                 return resultList;
 400  
         }
 401  
 
 402  
         @Override
 403  
         public List<CluResult> getCluResultByClu(String cluId) {
 404  124
                 Query query = em
 405  
                                 .createNamedQuery("CluResult.getCluResultByCluId");
 406  124
                 query.setParameter("cluId", cluId);
 407  
                 @SuppressWarnings("unchecked")
 408  124
                 List<CluResult> resultList = query.getResultList();
 409  124
                 return resultList;
 410  
         }
 411  
 
 412  
     @Override
 413  
     public Clu getLatestCluVersion(String cluVersionIndId) {
 414  18
         Query query = em.createNamedQuery("Clu.findLatestClu");
 415  18
         query.setParameter("versionIndId", cluVersionIndId);
 416  18
         Clu clu = (Clu)query.getSingleResult();
 417  18
         return clu;
 418  
     }
 419  
 
 420  
         @Override
 421  
         public Clu getCurrentCluVersion(String cluVersionIndId) {
 422  203
         Query query = em.createNamedQuery("Clu.findCurrentClu");
 423  203
         query.setParameter("versionIndId", cluVersionIndId);
 424  203
         query.setParameter("currentTime", new Date());
 425  203
         Clu clu = (Clu)query.getSingleResult();
 426  203
         return clu;
 427  
         }
 428  
 
 429  
         @Override
 430  
         public VersionDisplayInfo getCurrentCluVersionInfo(String cluVersionIndId, String objectTypeURI) {
 431  36
         Query query = em.createNamedQuery("Clu.findCurrentVersionInfo");
 432  36
         query.setParameter("versionIndId", cluVersionIndId);
 433  36
         query.setParameter("currentTime", new Date());
 434  36
         VersionDisplayInfo versionDisplayInfo = (VersionDisplayInfo)query.getSingleResult();
 435  33
         versionDisplayInfo.setObjectTypeURI(objectTypeURI);
 436  33
         return versionDisplayInfo;
 437  
         }
 438  
 
 439  
         @Override
 440  
         public VersionDisplayInfo getCurrentVersionOnDate(String versionIndId,
 441  
                         String objectTypeURI, Date date) {
 442  3
         Query query = em.createNamedQuery("Clu.findCurrentVersionOnDate");
 443  3
         query.setParameter("versionIndId", versionIndId);
 444  3
         query.setParameter("date", date);
 445  3
         VersionDisplayInfo versionDisplayInfo = (VersionDisplayInfo)query.getSingleResult();
 446  3
         versionDisplayInfo.setObjectTypeURI(objectTypeURI);
 447  3
         return versionDisplayInfo;
 448  
         }
 449  
 
 450  
         @Override
 451  
         public VersionDisplayInfo getFirstVersion(String versionIndId,
 452  
                         String objectTypeURI) {
 453  1
         Query query = em.createNamedQuery("Clu.findFirstVersion");
 454  1
         query.setParameter("versionIndId", versionIndId);
 455  1
         VersionDisplayInfo versionDisplayInfo = (VersionDisplayInfo)query.getSingleResult();
 456  1
         versionDisplayInfo.setObjectTypeURI(objectTypeURI);
 457  1
         return versionDisplayInfo;
 458  
         }
 459  
 
 460  
         @Override
 461  
         public VersionDisplayInfo getLatestVersion(String versionIndId,
 462  
                         String objectTypeURI) {
 463  0
         Query query = em.createNamedQuery("Clu.findLatestVersion");
 464  0
         query.setParameter("versionIndId", versionIndId);
 465  0
         VersionDisplayInfo versionDisplayInfo = (VersionDisplayInfo)query.getSingleResult();
 466  0
         versionDisplayInfo.setObjectTypeURI(objectTypeURI);
 467  0
         return versionDisplayInfo;
 468  
         }
 469  
 
 470  
         @Override
 471  
         public VersionDisplayInfo getVersionBySequenceNumber(String versionIndId,
 472  
                         String objectTypeURI, Long sequenceNumber) {
 473  1
         Query query = em.createNamedQuery("Clu.findVersionBySequence");
 474  1
         query.setParameter("versionIndId", versionIndId);
 475  1
         query.setParameter("sequenceNumber", sequenceNumber);
 476  1
         VersionDisplayInfo versionDisplayInfo = (VersionDisplayInfo)query.getSingleResult();
 477  1
         versionDisplayInfo.setObjectTypeURI(objectTypeURI);
 478  1
         return versionDisplayInfo;
 479  
         }
 480  
 
 481  
         @Override
 482  
         public List<VersionDisplayInfo> getVersions(String versionIndId,
 483  
                         String objectTypeURI) {
 484  2
         Query query = em.createNamedQuery("Clu.findVersions");
 485  2
         query.setParameter("versionIndId", versionIndId);
 486  2
         List<VersionDisplayInfo> versionDisplayInfos = (List<VersionDisplayInfo>)query.getResultList();
 487  2
         if(versionDisplayInfos==null){
 488  0
                 versionDisplayInfos = Collections.emptyList();
 489  
         }
 490  2
         for(VersionDisplayInfo versionDisplayInfo:versionDisplayInfos){
 491  3
                 versionDisplayInfo.setObjectTypeURI(objectTypeURI);
 492  
         }
 493  2
         return versionDisplayInfos;
 494  
         }
 495  
 
 496  
         @Override
 497  
         public List<VersionDisplayInfo> getVersionsInDateRange(String versionIndId,
 498  
                         String objectTypeURI, Date from, Date to) {
 499  8
                 if(from==null&&to==null){
 500  0
                         throw new IllegalArgumentException("from and to dates can not both be null");
 501  
                 }
 502  
                 Query query;
 503  8
                 if(from==null){
 504  0
                         query = em.createNamedQuery("Clu.findVersionsBeforeDate");
 505  0
                 query.setParameter("versionIndId", versionIndId);
 506  0
                 query.setParameter("date", to);                        
 507  8
                 }else if(to==null){
 508  7
                         query = em.createNamedQuery("Clu.findVersionsAfterDate");
 509  7
                 query.setParameter("versionIndId", versionIndId);
 510  7
                 query.setParameter("date", from);
 511  
                 }else{
 512  1
                         query = em.createNamedQuery("Clu.findVersionsInDateRange");
 513  1
                 query.setParameter("versionIndId", versionIndId);
 514  1
                 query.setParameter("from", from);
 515  1
                 query.setParameter("to", to);
 516  
                 }
 517  
                 
 518  8
         List<VersionDisplayInfo> versionDisplayInfos = (List<VersionDisplayInfo>)query.getResultList();
 519  8
         if(versionDisplayInfos==null){
 520  0
                 versionDisplayInfos = Collections.emptyList();
 521  
         }
 522  8
         for(VersionDisplayInfo versionDisplayInfo:versionDisplayInfos){
 523  1
                 versionDisplayInfo.setObjectTypeURI(objectTypeURI);
 524  
         }
 525  8
         return versionDisplayInfos;
 526  
         }
 527  
 
 528  
         @Override
 529  
         public List<CluPublication> getCluPublicationsByType(
 530  
                         String luPublicationTypeKey) {
 531  1
         Query query = em.createNamedQuery("CluPublication.findCluPublicationsByType");
 532  1
         query.setParameter("luPublicationTypeKey", luPublicationTypeKey);
 533  1
         List<CluPublication> cluPublications = query.getResultList();
 534  1
         return cluPublications;
 535  
         }
 536  
 
 537  
         @Override
 538  
         public List<CluPublication> getCluPublicationsByCluId(String cluId) {
 539  185
         Query query = em.createNamedQuery("CluPublication.findPublicationsByCluId");
 540  185
         query.setParameter("cluId", cluId);
 541  185
         List<CluPublication> cluPublications = query.getResultList();
 542  185
         return cluPublications;
 543  
         }
 544  
 
 545  
         @Override
 546  
         public List<CluSet> getCluSetsByCluVersionIndId(List<String> cluVersionIndIds) {
 547  0
         Query query = em.createNamedQuery("CluSet.findCluSetsByCluVersionIndIds");
 548  0
         query.setParameter("cluVersionIndIds", cluVersionIndIds);
 549  0
         List<CluSet> cluSetIds = query.getResultList();
 550  0
         return cluSetIds;
 551  
         }
 552  
 
 553  
         @Override
 554  
         public List<CluSet> getAllDynamicCluSets() {
 555  0
         Query query = em.createNamedQuery("CluSet.findAllDynamicCluSets");
 556  0
         List<CluSet> cluSetIds = query.getResultList();
 557  0
         return cluSetIds;
 558  
         }
 559  
 
 560  
         @Override
 561  
         public List<Clu> getCrossListedClusByCodes(List<String> crossListedCodes) {
 562  0
                 if(crossListedCodes!=null && crossListedCodes.isEmpty()){
 563  0
                         crossListedCodes.add(""); //Add a blank param value because jpql IN(:var) has problems with empty lists
 564  
                 }
 565  0
         Query query = em.createNamedQuery("Clu.getCrossListedClusByCodes");
 566  0
         query.setParameter("crossListedCodes", crossListedCodes);
 567  0
         List<Clu> clus = query.getResultList();
 568  0
         return clus;
 569  
         }
 570  
         
 571  
 }