/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/ContentServiceSql.java

https://github.com/sakaiproject/sakai · Java · 209 lines · 40 code · 35 blank · 134 comment · 0 complexity · 31f12fb358d8819fd3c7fcc90cc57f1e MD5 · raw file

  1. /**********************************************************************************
  2. * $URL$
  3. * $Id$
  4. ***********************************************************************************
  5. *
  6. * Copyright (c) 2007, 2008 Sakai Foundation
  7. *
  8. * Licensed under the Educational Community License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.opensource.org/licenses/ECL-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. *
  20. **********************************************************************************/
  21. package org.sakaiproject.content.impl;
  22. /**
  23. * database methods.
  24. */
  25. public interface ContentServiceSql
  26. {
  27. /**
  28. * returns the sql statement which retrieves the body from the specified table (content_resource_body_binary).
  29. */
  30. String getBodySql(String table);
  31. /**
  32. * returns the sql statement which retrieves the collection id from the specified table.
  33. */
  34. String getCollectionIdSql(String table);
  35. /**
  36. * returns the sql statement which deletes content from the specified table (content_resource_body_binary).
  37. */
  38. String getDeleteContentSql(String table);
  39. /**
  40. * returns the sql statement which inserts content into the specified table (content_resource_body_binary).
  41. */
  42. String getInsertContentSql(String table);
  43. /**
  44. * returns the sql statement which retrieves the number of content resources from the content_resource table.
  45. */
  46. String getNumContentResources1Sql();
  47. /**
  48. * returns the sql statement which retrieves the number of content resources from the content_collection table.
  49. */
  50. String getNumContentResources2Sql();
  51. /**
  52. * returns the sql statement which retrieves the number of content resources from the content_resource table.
  53. */
  54. String getNumContentResources3Sql();
  55. /**
  56. * returns the sql statement which retrieves the number of content resources from the content_collection table.
  57. */
  58. String getNumContentResources4Sql();
  59. /**
  60. * returns the sql statement which retrieves resource id from the content_resource table.
  61. */
  62. String getResourceId1Sql();
  63. /**
  64. * returns the sql statement which retrieves the resource id from the content_resource_body_binary table.
  65. */
  66. String getResourceId2Sql();
  67. /**
  68. * returns the sql statement which retrieves the resource id from the specified table.
  69. */
  70. String getResourceId3Sql(String table);
  71. /**
  72. * returns the sql statement which retrieves the resource id and xml fields from the content_resource table.
  73. */
  74. String getResourceIdXmlSql();
  75. /**
  76. * returns the sql statement which retrieves all id's and file paths where the file path is not null.
  77. * This is used for converting storage from one FileSystemHandler to another.
  78. */
  79. public String getResourceIdAndFilePath();
  80. /**
  81. * returns the sql statement which retrieves resource uuid from the content_resource table.
  82. */
  83. String getResourceUuidSql();
  84. /**
  85. * returns the sql statement which updates the resource uuid in the content_resource table for a given resource uuid.
  86. */
  87. String getUpdateContentResource1Sql();
  88. /**
  89. * returns the sql statement which updates the resource uuid in the content_resource table for a given resource id.
  90. */
  91. String getUpdateContentResource2Sql();
  92. /**
  93. * returns the sql statement which updates the file path and xml fields in the content_resource table for a given resource id.
  94. */
  95. String getUpdateContentResource3Sql();
  96. /**
  97. * returns the sql statement which retrieves pairs of individual-dropbox-id and last-update fields from the content_dropbox_changes table for a given site-level dropbox-id.
  98. */
  99. String getSiteDropboxChangeSql();
  100. /**
  101. * returns the sql statement which retrieves the last-update field from the content_dropbox_changes table for a given individual-dropbox-id.
  102. */
  103. String getIndividualDropboxChangeSql();
  104. /**
  105. * returns the sql statement which updates the last-update field in the content_dropbox_changes table for a given site-level dropbox-id and individual-dropbox-id.
  106. */
  107. String getUpdateIndividualDropboxChangeSql();
  108. /**
  109. * returns the sql statement which inserts the individual-dropbox-id, site-level dropbox-id and last-update fields into the content_dropbox_changes table.
  110. */
  111. String getInsertIndividualDropboxChangeSql();
  112. /**
  113. * returns the sql statement to add the FILE_SIZE column to the specified table.
  114. */
  115. String getAddFilesizeColumnSql(String table);
  116. /**
  117. * returns the sql statement to add the CONTEXT column to the specified table.
  118. */
  119. String getAddContextColumnSql(String table);
  120. /**
  121. * returns the sql statement to add an index of the CONTEXT column to the specified table.
  122. */
  123. String getAddContextIndexSql(String table);
  124. /**
  125. * returns the sql statement to add the RESOURCE_TYPE_ID column to the specified table.
  126. */
  127. String getAddResourceTypeColumnSql(String table);
  128. /**
  129. * returns the sql statement to add an index of the RESOURCE_TYPE_ID column to the specified table.
  130. */
  131. String getAddResourceTypeIndexSql(String table);
  132. /**
  133. * returns the sql statement which retrieves the total number of bytes within a site-level collection (context) in the CONTENT_RESOURCE table.
  134. */
  135. String getQuotaQuerySql();
  136. String getDropBoxQuotaQuerySql();
  137. /**
  138. * returns the sql statement which retrieves the total number of bytes within a site-level collection skiping user folders.
  139. * KNL-1084, SAK-22169
  140. */
  141. String getDropBoxRootQuotaQuerySql();
  142. /**
  143. * returns the sql statement which retrieves the RESOURCE_ID and XML values for all entries in the specified table where file-size is null.
  144. */
  145. String getAccessResourceIdAndXmlSql(String table);
  146. /**
  147. * returns the sql statement which updates a row in the specified table with values for CONTEXT, FILE_SIZE and (possibly) RESOURCE_UUID.
  148. */
  149. String getContextFilesizeValuesSql(String table, boolean addingUuid);
  150. String getFilesizeColumnExistsSql();
  151. /**
  152. * returns the sql statement to check if any rows exist with NULL FILE_SIZE values
  153. */
  154. String getFilesizeExistsSql();
  155. /**
  156. * A statement to create a UTF test table based on the name
  157. *
  158. * @param tempTableName
  159. * @return
  160. */
  161. String getCreateTemporaryUTF8TestTable(String tempTableName);
  162. /**
  163. * SQL to drop the table
  164. *
  165. * @param tempTableName
  166. * @return
  167. */
  168. String getDropTemporaryUTF8TestTable(String tempTableName);
  169. /**
  170. * returns the sql statement which retrieves the BINARY_ENTITY and XML values for all entries in the CONTENT_RESOURCE table,
  171. * selecting by the RESOURCE_TYPE_ID with first and last record indexes, and returned in ascending order by RESOURCE_ID.
  172. */
  173. String getSelectByResourceTypeQuerySql();
  174. }