1 16 package com.blandware.atleap.persistence.hibernate.core; 17 18 import com.blandware.atleap.persistence.core.LookupDAO; 19 import com.blandware.atleap.model.core.ActionPage; 20 import com.blandware.atleap.model.core.ContentPage; 21 import com.blandware.atleap.model.core.ContentDocument; 22 import com.blandware.atleap.model.core.ContentImage; 23 import com.blandware.atleap.common.Constants; 24 25 import java.util.List ; 26 27 28 37 public class LookupDAOHibernate extends BaseDAOHibernate implements LookupDAO { 38 39 42 public List listRoleTitles() { 43 if ( log.isDebugEnabled() ) { 44 log.debug("retrieving all role titles..."); 45 } 46 return executeFind("select r.title from Role r order by r.title"); 47 } 48 49 52 public List listRoles() { 53 if ( log.isDebugEnabled() ) { 54 log.debug("retrieving all roles..."); 55 } 56 return executeFind("select r from Role r order by r.title"); 57 } 58 59 62 public List listRolesAssignedToLinkableItems() { 63 if ( log.isDebugEnabled() ) { 64 log.debug("retrieving roles assigned to linkable items..."); 65 } 66 return executeFind("select distinct r from Page as page inner join page.roles as r where page.className != '" + ActionPage.class.getName() + "' and page.className != '" + ContentPage.class.getName() + "' order by r.title"); 67 } 68 69 72 public List listRolesAssignedToContentPages() { 73 if ( log.isDebugEnabled() ) { 74 log.debug("retrieving roles assigned to content pages..."); 75 } 76 return executeFind("select distinct r from ContentPage as page inner join page.roles as r order by r.title"); 77 } 78 79 82 public List listRolesAssignedToDocuments() { 83 if ( log.isDebugEnabled() ) { 84 log.debug("retrieving roles assigned to documents..."); 85 } 86 return executeFind("select distinct r from ContentDocument as document inner join document.roles as r order by r.title"); 87 } 88 89 92 public List listRolesAssignedToFiles() { 93 if ( log.isDebugEnabled() ) { 94 log.debug("retrieving roles assigned to content resources..."); 95 } 96 return executeFind("select distinct r from ContentResource as resource inner join resource.roles as r where resource.type = '" + Constants.RESOURCE_TYPE_FILE + "' order by r.title"); 97 } 98 99 102 public List listRolesAssignedToImages() { 103 if ( log.isDebugEnabled() ) { 104 log.debug("retrieving roles assigned to images..."); 105 } 106 return executeFind("select distinct r from ContentImage as image inner join image.roles as r order by r.title"); 107 } 108 109 112 public List listRolesAssignedToContentResources() { 113 if ( log.isDebugEnabled() ) { 114 log.debug("retrieving roles assigned to content resources..."); 115 } 116 return executeFind("select distinct r from ContentResource as resource inner join resource.roles as r order by r.title"); 117 } 118 119 122 public List listFreeRolesAssignedToUsers() { 123 if ( log.isDebugEnabled() ) { 124 log.debug("retrieving roles assigned to users as free roles..."); 125 } 126 return executeFind("select distinct r from User as u inner join u.rolesAssociations as fra left outer join fra.role as r where fra.group is null order by r.title"); 127 } 128 129 132 public List listRolesAssignedToNewsItems() { 133 if ( log.isDebugEnabled() ) { 134 log.debug("retrieving roles assigned to news items..."); 135 } 136 return executeFind("select distinct r from NewsItem as item inner join item.roles as r order by r.title"); 137 } 138 139 142 public List listGroups() { 143 if ( log.isDebugEnabled() ) { 144 log.debug("retrieving all groups..."); 145 } 146 return executeFind("select g from Group g order by g.title"); 147 } 148 149 152 public List listLayoutNames() { 153 if ( log.isDebugEnabled() ) { 154 log.debug("retrieving all layout names..."); 155 } 156 return executeFind("select l.name from Layout l order by l.name"); 157 } 158 159 162 public List listLayouts() { 163 if ( log.isDebugEnabled() ) { 164 log.debug("retrieving all layouts..."); 165 } 166 return executeFind("select l from Layout l order by l.name"); 167 } 168 169 172 public List listContentResourceTypes() { 173 if ( log.isDebugEnabled() ) { 174 log.debug("retrieving all content resource types..."); 175 } 176 return executeFind("select distinct r.type from ContentResource r order by r.type"); 177 } 178 } 179 | Popular Tags |