private String getRestResource(ApplicationLink appLink) { return appLink.getUrl() + CRUCIBLE_ADMIN_REST_ENDPOINT + appLink.getRemoteKey(); }
private String getRemoteKey(final AppLinksManager appLinksManager, final Application application, final String localName) { final ApplicationLink linkToRemoteProject = appLinksManager.getLinkedApplication(application.toString(), localName); if (linkToRemoteProject != null) { return linkToRemoteProject.getRemoteKey(); } return localName; }
Request<?> createRequest(ApplicationLink localLink, String restUrl) { return requestFactory.createRequest(Request.MethodType.POST, restUrl + "?key=" + localLink.getRemoteKey() + "&application=" + Application.CONFLUENCE.name()); } ///CLOVER:ON
private void createProjectLink(final String key, final String applicationType, final ApplicationLink applicationLink, final boolean deleteExisting) { final Application app = Application.fromString(applicationType); final KeyAssociations associations = appLinksManager.getKeyAssociations(app, key); if (deleteExisting) { associations.removeAll(); } associations.setPrimary(applicationLink.getName(), applicationLink.getRemoteKey()); }
public void execute(Map transientVars, Map args, PropertySet propertySet) throws WorkflowException { Issue issue = (Issue) transientVars.get("issue"); String projectKey = issue.getProjectObject().getKey(); ApplicationLink crucible = appLinksManager.getLinkedApplication(Application.CRUCIBLE.name(), projectKey); Request<?> request = requestFactory.createRequest(Request.MethodType.POST, crucible.getUrl() + CREATE_REVIEW_PATH + "?key=" + crucible.getRemoteKey() + "&issueKey=" + issue.getKey()); request.addTrustedTokenAuthentication(); try { request.execute(); } catch (ResponseException re) { log.error("Error creating code review on Crucible", re); } } }
@SuppressWarnings("unchecked") public Collection<Project> getProjects() { Collection<Project> projects = new ArrayList<Project>(); Collection<GenericValue> projectGvs = projectManager.getProjects(); for (GenericValue gv : projectGvs) { Project project = projectFactory.getProject(gv); if (permissionManager.hasPermission(Permissions.PROJECT_ADMIN, project, getRemoteUser()) || permissionManager.hasPermission(Permissions.ADMINISTER, getRemoteUser())) { // We have permission, but check that it has a project link ApplicationLink appLink = appLinksManager.getLinkedApplication(Application.CRUCIBLE.name(), project.getKey()); if (appLink != null && appLink.getRemoteKey() != null) { projects.add(project); } } } return projects; }
if (confluence != null) jiraProject.setConfluenceSpace(confluence.getRemoteKey()); jiraProject.setFisheyeRepository(fisheye.getRemoteKey()); jiraProject.setCrucibleProject(crucible.getRemoteKey()); jiraProject.setBambooProject(bamboo.getRemoteKey()); jiraProject.setSvnPath(svn.getRemoteKey());
if (appLink != null && appLink.getRemoteKey() != null) appLink.getUrl() + FISHEYE_SUBSCRIPTION_URL + appLink.getRemoteKey() + "/commit"); request.addRequestParameters("url", JIRA_NOTIFICIATION_URL, "authenticationType", "TRUSTED_APPS", "username", ctx.getUser().getName());
if (appLink != null && appLink.getRemoteKey() != null) appLink.getUrl() + FISHEYE_SUBSCRIPTION_URL + appLink.getRemoteKey() + "/commit"); final String baseUrl = ComponentLocator.getComponent(ApplicationProperties.class).getBaseUrl(); request.addRequestParameters("url", baseUrl + JIRA_NOTIFICIATION_URL);
public String doSynchronize() { final ApplicationLink localLink = appLinksManager.getLinkedApplication(app, getKey()); final String restUrl = localLink.getUrl() + "/plugins/servlet/applinks/projectlinks"; final Request<?> request = requestFactory.createRequest(Request.MethodType.POST, restUrl + "?key=" + localLink.getRemoteKey() + "&application=JIRA"); final ApplicationLink remoteLink = new DefaultApplicationLink("jira", getKey(), null, null); request.setRequestBody(XStreamUtils.toXML(remoteLink)); request.addTrustedTokenAuthentication(); try { request.execute(); } catch (final ResponseException re) { return getRedirect("ViewProject.jspa?message=editprojectlinks.error.synchronize&pid=" + getPid()); } return getRedirect("ViewProject.jspa?message=editprojectlinks.result.synchronized&pid=" + getPid()); }
if (appLink == null || !TextUtils.stringSet(appLink.getRemoteKey()))
@Override protected void doValidation() { if (!TextUtils.stringSet(key)) { addErrorMessage(getText("crucible.admin.error.no.key")); } ApplicationLink appLink = appLinksManager.getLinkedApplication(Application.CRUCIBLE.name(), key); if (appLink == null || !TextUtils.stringSet(appLink.getRemoteKey())) { addErrorMessage(getText("crucible.admin.error.no.linked.project", key)); } // Create the project config projectConfig = new CrucibleProjectConfig(); if (TextUtils.stringSet(defaultModerator)) { projectConfig.setDefaultModerator(defaultModerator); } projectConfig.setDefaultReviewers(commaSeparatedToSet(defaultReviewers)); projectConfig.setDefaultReviewerGroups(arrayToSet(defaultReviewerGroups)); projectConfig.setAllowedReviewers(commaSeparatedToSet(allowedReviewers)); projectConfig.setAllowedReviewerGroups(arrayToSet(allowedReviewerGroups)); // Check that everyone exists validateUserExists(projectConfig.getDefaultModerator()); validateUsersExist(projectConfig.getDefaultReviewers()); validateUsersExist(projectConfig.getAllowedReviewers()); validateGroupsExist(projectConfig.getDefaultReviewerGroups()); validateGroupsExist(projectConfig.getAllowedReviewerGroups()); }