/** * Clear bootstrap state. This should only be called in tests. */ @VisibleForTesting void clear() { Transactionals.execute(transactional, dsContext -> { MetadataStoreDataset ds = get(dsContext, datasetFramework); ds.delete(KEY); }); }
/** * Clear bootstrap state. This should only be called in tests. */ @VisibleForTesting void clear() { Transactionals.execute(transactional, dsContext -> { MetadataStoreDataset ds = get(dsContext, datasetFramework); ds.delete(KEY); }); }
/** * Remove an assignment from the profile. * * @param profileId the profile id * @param entityId the entity to remove from the assignment * @throws NotFoundException if the profile is not found */ public void removeProfileAssignment(ProfileId profileId, EntityId entityId) throws NotFoundException { Profile profile = table.get(getProfileRowKey(profileId), Profile.class); if (profile == null) { throw new NotFoundException(profileId); } table.delete(getEntityIndexRowKey(profileId, entityId)); }
/** * Remove an assignment from the profile. * * @param profileId the profile id * @param entityId the entity to remove from the assignment * @throws NotFoundException if the profile is not found */ public void removeProfileAssignment(ProfileId profileId, EntityId entityId) throws NotFoundException { Profile profile = table.get(getProfileRowKey(profileId), Profile.class); if (profile == null) { throw new NotFoundException(profileId); } table.delete(getEntityIndexRowKey(profileId, entityId)); }
/** * Deletes the profile from the profile store * * @param profileId the id of the profile to delete * @throws NotFoundException if the profile is not found * @throws ProfileConflictException if the profile is enabled */ public void deleteProfile(ProfileId profileId) throws NotFoundException, ProfileConflictException { MDSKey rowKey = getProfileRowKey(profileId); Profile value = table.get(rowKey, Profile.class); if (value == null) { throw new NotFoundException(profileId); } if (value.getStatus() == ProfileStatus.ENABLED) { throw new ProfileConflictException( String.format("Profile %s in namespace %s is currently enabled. A profile can " + "only be deleted if it is disabled", profileId.getProfile(), profileId.getNamespace()), profileId); } table.delete(getProfileRowKey(profileId)); }
/** * Deletes the profile from the profile store * * @param profileId the id of the profile to delete * @throws NotFoundException if the profile is not found * @throws ProfileConflictException if the profile is enabled */ public void deleteProfile(ProfileId profileId) throws NotFoundException, ProfileConflictException { MDSKey rowKey = getProfileRowKey(profileId); Profile value = table.get(rowKey, Profile.class); if (value == null) { throw new NotFoundException(profileId); } if (value.getStatus() == ProfileStatus.ENABLED) { throw new ProfileConflictException( String.format("Profile %s in namespace %s is currently enabled. A profile can " + "only be deleted if it is disabled", profileId.getProfile(), profileId.getNamespace()), profileId); } table.delete(getProfileRowKey(profileId)); }