You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DeprecatedDao.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * SonarQube, open source software quality management tool.
  3. * Copyright (C) 2008-2014 SonarSource
  4. * mailto:contact AT sonarsource DOT com
  5. *
  6. * SonarQube is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * SonarQube is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.server.db;
  21. import java.io.Serializable;
  22. import java.util.Collection;
  23. import java.util.Date;
  24. import java.util.Map;
  25. import javax.annotation.CheckForNull;
  26. import javax.annotation.Nullable;
  27. import org.sonar.db.DbSession;
  28. import org.sonar.db.Dto;
  29. public interface DeprecatedDao<DTO extends Dto<KEY>, KEY extends Serializable> {
  30. /**
  31. * Get a DTO by its key. Return <code>null</code> if the key does not exist.
  32. */
  33. @CheckForNull
  34. DTO getNullableByKey(DbSession session, KEY key);
  35. /**
  36. * Get a DTO by its key.
  37. *
  38. * @throws org.sonar.server.exceptions.NotFoundException if the key does not exist
  39. */
  40. DTO getByKey(DbSession session, KEY key);
  41. /**
  42. * Update a table row. DTO id must be set. The field updatedAt
  43. * is changed by this method.
  44. */
  45. DTO update(DbSession session, DTO dto);
  46. /**
  47. * Update one or more table rows. Note that the returned DTO is only
  48. * the first updated one.
  49. */
  50. DTO update(DbSession session, DTO dto, DTO... others);
  51. Collection<DTO> update(DbSession session, Collection<DTO> dtos);
  52. DTO insert(DbSession session, DTO dto);
  53. /**
  54. * Insert one or more database rows. Note
  55. * that the returned DTO is only the first inserted one.
  56. */
  57. DTO insert(DbSession session, DTO dto, DTO... others);
  58. Collection<DTO> insert(DbSession session, Collection<DTO> dtos);
  59. void delete(DbSession session, DTO dto);
  60. /**
  61. * Delete one or more table rows.
  62. */
  63. void delete(DbSession session, DTO dto, DTO... others);
  64. void delete(DbSession session, Collection<DTO> dtos);
  65. void deleteByKey(DbSession session, KEY key);
  66. void synchronizeAfter(final DbSession session);
  67. void synchronizeAfter(DbSession session, @Nullable Date date);
  68. void synchronizeAfter(DbSession session, @Nullable Date date, Map<String, String> params);
  69. }