@Override public void define(WebService.NewController controller) { NewAction create = controller .createAction("create") .setSince("5.2") .setDescription( "Create a quality profile. Require Administer Quality Profiles permission.") .setPost(true) .setResponseExample(getClass().getResource("example-create.json")) .setHandler(this); create .createParam(PARAM_PROFILE_NAME) .setDescription("The name for the new quality profile.") .setExampleValue("My Sonar way") .setRequired(true); create .createParam(PARAM_LANGUAGE) .setDescription("The language for the quality profile.") .setExampleValue("js") .setPossibleValues(LanguageParamUtils.getLanguageKeys(languages)) .setRequired(true); for (ProfileImporter importer : importers) { create .createParam(getBackupParamName(importer.getKey())) .setDescription(String.format("A configuration file for %s.", importer.getName())); } }
@Override public void define(NewController context) { NewAction changelog = context .createAction("changelog") .setSince("5.2") .setDescription( "Get the history of changes on a quality profile: rule activation/deactivation, change in parameters/severity. " + "Events are ordered by date in descending order (most recent first).") .setHandler(this) .setResponseExample(getClass().getResource("example-changelog.json")); QProfileIdentificationParamUtils.defineProfileParams(changelog, languages); changelog.addPagingParams(50); changelog .createParam(PARAM_SINCE) .setDescription("Start date for the changelog.") .setExampleValue("2011-04-25T01:15:42+0100"); changelog .createParam(PARAM_TO) .setDescription("End date for the changelog.") .setExampleValue("2013-07-25T07:35:42+0200"); }
static void createTemplateKeyParameter(NewAction action) { action .createParam(PARAM_TEMPLATE_KEY) .setRequired(true) .setDescription("Template key") .setExampleValue("developer_template_20150820_170218"); }
static void createUserLoginParameter(NewAction action) { action .createParam(PARAM_USER_LOGIN) .setRequired(true) .setDescription("User login") .setExampleValue("g.hopper"); }
static NewParam createLoginParameter(NewAction action) { return action.createParam(PARAM_LOGIN).setDescription("User login").setExampleValue("g.hopper"); }
private static void createGroupNameParameter(NewAction action) { action .createParam(PARAM_GROUP_NAME) .setDescription("Group name") .setExampleValue("sonar-administrators"); }
private static void createGroupIdParameter(NewAction action) { action.createParam(PARAM_GROUP_ID).setDescription("Group id").setExampleValue("42"); }
static void createProjectKeyParameter(NewAction action) { action .createParam(PARAM_PROJECT_KEY) .setDescription("Project key") .setExampleValue("org.apache.hbas:hbase"); }
static void createProjectUuidParameter(NewAction action) { action .createParam(PARAM_PROJECT_UUID) .setDescription("Project id") .setExampleValue("ce4c03d6-430f-40a9-b777-ad877c00aa4d"); }
static void createGroupNameParameter(NewAction action) { action .createParam(PARAM_GROUP_NAME) .setDescription("Group name or 'anyone' (case insensitive)") .setExampleValue("sonar-administrators"); }
static void createPermissionParameter(NewAction action) { action .createParam(PARAM_PERMISSION) .setDescription(PERMISSION_PARAM_DESCRIPTION) .setRequired(true); }