/** * Delete either global, user, component or component per user properties. * <p>Behaves in exactly the same way as {@link #selectByQuery(PropertyQuery, DbSession)} but deletes rather than * selects</p> * * Used by Governance. */ public int deleteByQuery(DbSession dbSession, PropertyQuery query) { return getMapper(dbSession).deleteByQuery(query); }
public List<PropertyDto> selectByKeyAndMatchingValue(DbSession session, String key, String value) { return getMapper(session).selectByKeyAndMatchingValue(key, value); }
public void deleteByKeyAndValue(DbSession dbSession, String key, String value) { getMapper(dbSession).deleteByKeyAndValue(key, value); }
public List<PropertyDto> selectProjectProperties(DbSession session, String projectKey) { return getMapper(session).selectProjectProperties(projectKey); }
public void deleteProjectProperty(String key, Long projectId, DbSession session) { getMapper(session).deleteProjectProperty(key, projectId); }
public List<PropertyDto> selectByQuery(PropertyQuery query, DbSession session) { return getMapper(session).selectByQuery(query); }
public void deleteGlobalProperty(String key, DbSession session) { getMapper(session).deleteGlobalProperty(key); }
public List<PropertyDto> selectGlobalProperties(DbSession session) { return getMapper(session).selectGlobalProperties(); }
public List<PropertyDto> selectPropertiesByComponentIds(DbSession session, Set<Long> componentIds) { return executeLargeInputs(componentIds, getMapper(session)::selectByComponentIds); }
public void deleteProjectProperties(String key, String value, DbSession session) { getMapper(session).deleteProjectProperties(key, value); }
public void renamePropertyKey(String oldKey, String newKey) { checkArgument(!Strings.isNullOrEmpty(oldKey), "Old property key must not be empty"); checkArgument(!Strings.isNullOrEmpty(newKey), "New property key must not be empty"); if (!newKey.equals(oldKey)) { try (DbSession session = mybatis.openSession(false)) { getMapper(session).renamePropertyKey(oldKey, newKey); session.commit(); } } }
public void deleteByOrganizationAndMatchingLogin(DbSession dbSession, String organizationUuid, String login, List<String> propertyKeys) { List<Long> ids = getMapper(dbSession).selectIdsByOrganizationAndMatchingLogin(organizationUuid, login, propertyKeys); executeLargeInputsWithoutOutput(ids, list -> getMapper(dbSession).deleteByIds(list)); }
public void saveGlobalProperties(Map<String, String> properties) { try (DbSession session = mybatis.openSession(false)) { PropertiesMapper mapper = getMapper(session); properties.entrySet().forEach(entry -> { mapper.deleteGlobalProperty(entry.getKey()); save(mapper, entry.getKey(), null, null, entry.getValue()); }); session.commit(); } }
/** * Returns the logins of users who have subscribed to the given notification dispatcher with the given notification channel. * If a resource ID is passed, the search is made on users who have specifically subscribed for the given resource. * * Note that {@link UserRole#USER} permission is not checked here, filter the results with * {@link org.sonar.db.permission.AuthorizationDao#keepAuthorizedLoginsOnProject} * * @return the list of Subscriber (maybe be empty - obviously) */ public Set<Subscriber> findUsersForNotification(String notificationDispatcherKey, String notificationChannelKey, @Nullable String projectKey) { try (DbSession session = mybatis.openSession(false)) { return getMapper(session).findUsersForNotification(NOTIFICATION_PREFIX + notificationDispatcherKey + "." + notificationChannelKey, projectKey); } }
@CheckForNull public PropertyDto selectGlobalProperty(DbSession session, String propertyKey) { return getMapper(session).selectByKey(new PropertyDto().setKey(propertyKey)); }
public List<PropertyDto> selectPropertiesByKeysAndComponentIds(DbSession session, Set<String> keys, Set<Long> componentIds) { return executeLargeInputs(keys, partitionKeys -> executeLargeInputs(componentIds, partitionComponentIds -> getMapper(session).selectByKeysAndComponentIds(partitionKeys, partitionComponentIds))); }
@CheckForNull public PropertyDto selectProjectProperty(DbSession dbSession, long componentId, String propertyKey) { return getMapper(dbSession).selectByKey(new PropertyDto().setKey(propertyKey).setResourceId(componentId)); }
public int delete(DbSession dbSession, PropertyDto dto) { return getMapper(dbSession).delete(dto.getKey(), dto.getUserId(), dto.getResourceId()); }
/** * Saves the specified property and its value. * <p> * If {@link PropertyDto#getValue()} is {@code null} or empty, the properties is persisted as empty. * </p> * * @throws IllegalArgumentException if {@link PropertyDto#getKey()} is {@code null} or empty */ public void saveProperty(DbSession session, PropertyDto property) { save(getMapper(session), property.getKey(), property.getUserId(), property.getResourceId(), property.getValue()); }