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.

OrganizationMapper.java 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2021 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program 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. * This program 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.db.organization;
  21. import java.util.List;
  22. import javax.annotation.CheckForNull;
  23. import org.apache.ibatis.annotations.Param;
  24. import org.sonar.db.Pagination;
  25. import org.sonar.db.component.BranchType;
  26. import org.sonar.db.permission.template.DefaultTemplates;
  27. public interface OrganizationMapper {
  28. void insert(@Param("organization") OrganizationDto organization, @Param("newProjectPrivate") boolean newProjectPrivate);
  29. int countByQuery(@Param("query") OrganizationQuery organizationQuery);
  30. List<OrganizationDto> selectByQuery(@Param("query") OrganizationQuery organizationQuery,
  31. @Param("pagination") Pagination pagination);
  32. @CheckForNull
  33. OrganizationDto selectByKey(@Param("key") String key);
  34. @CheckForNull
  35. OrganizationDto selectByUuid(@Param("uuid") String uuid);
  36. List<OrganizationDto> selectByUuids(@Param("uuids") List<String> uuids);
  37. List<OrganizationDto> selectByPermission(@Param("userUuid") String userUuid, @Param("permission") String permission);
  38. List<String> selectAllUuids();
  39. DefaultTemplates selectDefaultTemplatesByUuid(@Param("uuid") String uuid);
  40. String selectDefaultGroupUuidByUuid(@Param("uuid") String uuid);
  41. boolean selectNewProjectPrivateByUuid(@Param("uuid") String uuid);
  42. /**
  43. * Update the organization with UUID specified by {@link OrganizationDto#getUuid()}.
  44. * <p>
  45. * This method ignores {@link OrganizationDto#getCreatedAt()} and {@link OrganizationDto#getKey()}
  46. * (they are not updated).
  47. * </p>
  48. */
  49. int update(@Param("organization") OrganizationDto organization);
  50. void updateDefaultTemplates(@Param("organizationUuid") String organizationUuid,
  51. @Param("defaultTemplates") DefaultTemplates defaultTemplates, @Param("now") long now);
  52. void updateDefaultGroupUuid(@Param("organizationUuid") String organizationUuid,
  53. @Param("defaultGroupUuid") String defaultGroupUuid, @Param("now") long now);
  54. void updateDefaultQualityGate(@Param("organizationUuid") String organizationUuid,
  55. @Param("defaultQualityGateUuid") String defaultQualityGateUuid, @Param("now") long now);
  56. void updateNewProjectPrivate(@Param("organizationUuid") String organizationUuid, @Param("newProjectPrivate") boolean newProjectPrivate, @Param("now") long now);
  57. int deleteByUuid(@Param("uuid") String uuid);
  58. List<OrganizationWithNclocDto> selectOrganizationsWithNcloc(
  59. @Param("ncloc") String ncloc,
  60. @Param("organizationUuids") List<String> organizationUuids,
  61. @Param("branchType") BranchType branchType);
  62. }