private PluginSettings getSettings() { return pluginSettingsFactory.createSettingsForKey(PLUGIN_STORAGE_KEY); } }
private PluginSettings getSettings() { return pluginSettingsFactory.createSettingsForKey(PLUGIN_STORAGE_KEY); }
public PluginSettings getSettings(){ return pluginSettings.createSettingsForKey(PLUGIN_STORAGE_KEY); } }
public Object getKeyedPluginSetting(String settingsKey, String dataKey) { PluginSettings pluginSettings = pluginSettingsFactory.createSettingsForKey(settingsKey); return pluginSettings.get(dataKey); } }
public void restrictPermissionToGroups(@Nonnull String projectKey, @Nonnull Iterable<String> groups) { PluginSettings settingsForProject = pluginSettingsFactory.createSettingsForKey(projectKey); settingsForProject.put(ALLOWED_GROUPS_KEY, ImmutableList.copyOf(groups)); }
public DefaultSlackSettingsService(PluginSettingsFactory pluginSettingsFactory, PermissionValidationService validationService) { this.validationService = validationService; this.pluginSettings = pluginSettingsFactory.createSettingsForKey(PluginMetadata.getPluginKey()); }
@Override public String[] getDefaultFieldValue(final String projectKey, final String fieldId, final String issueType) { PluginSettings settingsForProject = pluginSettingsFactory.createSettingsForKey(projectKey); List<String> valueList = (List) settingsForProject.get(createKey(fieldId, issueType)); if (valueList != null) { String[] strings = new String[valueList.size()]; return valueList.toArray(strings); } return null; }
/** * * @param user * @return immutable list of recently selected projects */ @Nonnull public List<SelectedProject> getRecentProjects(ApplicationUser user) { PluginSettings settings = pluginSettingsFactory .createSettingsForKey("user." + checkNotNull(user).getKey()); List<SelectedProject> recentlyUsed = null; try { recentlyUsed = new ObjectMapper().readValue( (String) settings.get(CPJI_RECENTLY_USED_PROJECTS), new TypeReference<List<SelectedProject>>() {}); } catch (Exception e) { log.debug("Unable to read recently used projects", e); } return recentlyUsed == null ? Collections.<SelectedProject>emptyList() : recentlyUsed; } }
public void addProject(ApplicationUser user, SelectedProject project) { PluginSettings settings = pluginSettingsFactory .createSettingsForKey("user." + checkNotNull(user).getKey()); List<SelectedProject> recentlyUsed = Lists.newArrayList(getRecentProjects(user)); if (recentlyUsed.contains(project)) { recentlyUsed.remove(project); } recentlyUsed.add(0, project); if (recentlyUsed.size() > REMEMBER_COUNT) { recentlyUsed = recentlyUsed.subList(0, REMEMBER_COUNT); } try { settings.put(CPJI_RECENTLY_USED_PROJECTS, new ObjectMapper().writeValueAsString(recentlyUsed)); } catch (IOException e) { log.debug("Unable to write recently used projects", e); } }
/** * Removes all subscriptions for a particular resource name and event * * @param resourceName The resource name * @param notificationEvent The notification event type */ public void removeSubscriptions(final String resourceName, final String notificationEvent) { removeSubscriptionFromCache(resourceName, notificationEvent); final PluginSettings pluginSettings = pluginSettingsFactory.createSettingsForKey(resourceName); pluginSettings.remove(PLUGIN_SETTINGS_PREFIX + notificationEvent); }
@Override public void clearDefaultValue(final String projectKey, final String fieldId, final String issueType) { PluginSettings settingsForProject = pluginSettingsFactory.createSettingsForKey(projectKey); settingsForProject.remove(createKey(fieldId, issueType)); }
@Override public void persistDefaultFieldValue(final String projectKey, final String fieldId, final String issueType, final Object fieldValue) { PluginSettings settingsForProject = pluginSettingsFactory.createSettingsForKey(projectKey); if (fieldValue.getClass().isArray()) { String[] strValues = (String[]) fieldValue; List<String> values = new ArrayList<>(); Collections.addAll(values, strValues); settingsForProject.put(createKey(fieldId, issueType), values); log.debug("Persisted default value for field '" + fieldId + "' value ='" + fieldValue + "'"); } else { settingsForProject.put(CPJI_DEFAULT_KEY + fieldId, fieldValue); log.debug("Persisted default value for field '" + fieldId + "' value ='" + fieldValue + "'"); } }
/** * Getter for the {@link PluginSettings} for the given {@link Plan} * * @param plan the {@link Plan} to get the {@link PluginSettings} for * @return {@link Plan} Specific {@link PluginSettings} is the Plan is not <code>null</code>, the global * {@link PluginSettings} are returned otherwise */ private PluginSettings getPluginSettings(ImmutablePlan plan) { if (plan != null) { return settingsFactory.createSettingsForKey(plan.getKey()); } else { return settingsFactory.createGlobalSettings(); } }
protected KeyAssociations getKeyAssociations(final Application app, final String projName, final ApplicationInstances instances) { KeyAssociations result = null; try { result = new KeyAssociations(app, instances, getKeyAssociationListenersForApp(app), pluginSettingsFactory.createSettingsForKey(projName), transactionTemplate); } catch (final IllegalArgumentException ex) { log.debug("Unable to find project '" + projName + "'", ex); // Unable to find project } return result; }
public EntityReference toEntityReference(final String key, final Class<? extends EntityType> type) { final String name = (String) pluginSettingsFactory.createSettingsForKey(key).get("charlie.name"); return new DefaultEntityReference(key, name, checkNotNull(typeAccessor.getEntityType(RefAppCharlieEntityType.class), "Couldn't load RefAppCharlieEntityType")); }
protected KeyAssociations getKeyAssociations(Application app, String projName, ApplicationInstances instances) { KeyAssociations result = null; try { result = new KeyAssociations(app, instances, getKeyAssociationListenersForApp(app), getPluginSettingsFactory().createSettingsForKey(projName)); } catch (IllegalArgumentException ex) { log.debug("Unable to find project " + projName, ex); // Unable to find project } return result; }
public void clearPermissionForProject(@Nonnull String projectKey) { PluginSettings settingsForProject = pluginSettingsFactory.createSettingsForKey(projectKey); settingsForProject.remove(ALLOWED_GROUPS_KEY); settingsForProject.remove(createOldKey(projectKey)); }
private String getPublicSvnUrl(final String repname) { final PluginSettings projectSettings = pluginSettingsFactory.createSettingsForKey(repname); final String publicSvnUrl = (String) projectSettings.get(ApplicationInstance.PUBLIC_SVN_URL); if(StringUtils.isBlank(publicSvnUrl)) { final ApplicationInstance primarySvn = appLinksManager.getPrimaryApplicationInstance(Application.SVN.toString()); return primarySvn.getUrl(); } return publicSvnUrl; }
/** * * @param projectKey * @return list of group names or empty list if there are no groups configured */ @Nonnull public List<String> getConfiguredGroups(String projectKey) { PluginSettings settingsForProject = pluginSettingsFactory.createSettingsForKey(projectKey); List<String> groups = (List<String>) settingsForProject.get(ALLOWED_GROUPS_KEY); if (groups != null) { return groups; } // check if the old setting is set and migrate it if it's set final String oldKey = createOldKey(projectKey); final Object value = settingsForProject.get(oldKey); if (value != null) { restrictPermissionToGroups(projectKey, ImmutableList.of(value.toString())); settingsForProject.remove(oldKey); return getConfiguredGroups(projectKey); } return Collections.emptyList(); }
public CommentSecurityLevel getCommentSecurityLevel(final Project project) { Assertions.notNull("project", project); final PluginSettings settings = pluginSettingsFactory.createSettingsForKey(project.getKey()); String commentSecurityLevelId = (String) settings.get(createKeyForSecurityLevel(project.getKey())); String commentSecurityLevelType = (String) settings.get(createKeyForSecurityLevel(project.getKey()) + TYPE); if (commentSecurityLevelId == null || commentSecurityLevelType == null) { return null; } else { CommentSecurityType commentSecurityType = CommentSecurityType.valueOf(commentSecurityLevelType); if (commentSecurityType == null) { throw new IllegalStateException("Invalid comment security type '" + commentSecurityLevelType + "' specified."); } return findCommentSecurityLevel(new CommentSecurityLevel(commentSecurityLevelId, "", commentSecurityType), project); } }