public void rollbackApplicationLinkConfiguration(ApplicationLink applicationLink) { // try to clean up local state changes, so the user can retry the connection after manually clearing state // from the target JIRA instance (as per the troubleshooting guide) try { if (applicationLink != null) { applicationLinkService.deleteApplicationLink(applicationLink); } // TODO: How to delete the reverse application link? LOG.info("Rolled back 2-way application link to JIRA."); } catch (Exception rollbackException) { // this is possibly what caused the original failure necessitating the rollback, log & ignore LOG.error("Failed to rollback local UAL/Crowd configuration", rollbackException); } }
public void deleteApplicationLink(ApplicationId applicationId) { try { final MutableApplicationLink applicationLink = applinkservice.getApplicationLink(applicationId); if (applicationLink != null) { applinkservice.deleteApplicationLink(applicationLink); } } catch (TypeNotInstalledException e) { //ignore } }
@Override public void hastaLaVistaAppLinks() { for (ApplicationLink applicationLink : applicationLinkService.getApplicationLinks()) { applicationLinkService.deleteApplicationLink(applicationLink); } } }
@Override public void deleteAppLink(final String key) throws NotConnectAddonException { final ApplicationLink link = getAppLink(key); if (link != null) { transactionTemplate.execute(() -> { log.info("Removing application link for {}", key); applicationLinkService.deleteApplicationLink(link); return null; }); } else { log.debug("Could not remove application link for {}", key); } }
@DELETE @Path("{applinkid}") public Response delete(@PathParam("applinkid") String applinkId) throws ServiceException { permissionValidationService.validateAdmin(); ApplicationLink applink = applinkHelper.getApplicationLink(restApplicationIdParser.parse(applinkId)); applicationLinkService.deleteApplicationLink(applink); return Response.noContent().build(); }
@DELETE @WebSudoNotRequired public Response cleanAll(DeleteAllRequestEntity request) { int count = 0; for (ApplicationLink link : linkService.getApplicationLinks()) { if (request.reciprocal) { try { linkService.deleteReciprocatedApplicationLink(link); } catch (Exception e) { linkService.deleteApplicationLink(link); } } else { linkService.deleteApplicationLink(link); } count++; } return Response.ok(new DeleteAllResponseEntity(count)).build(); }
private void deleteOldAppLinks(String pluginKey, ApplicationId appId) { ApplicationLink link; try { link = applicationLinkService.getApplicationLink(appId); } catch (TypeNotInstalledException ex) { log.warn("Link found for '{}' but the type cannot be found, deleting...", pluginKey); manuallyDeleteApplicationId(appId); return; } if (null != link) { if (pluginKey.equals(link.getProperty(PLUGIN_KEY_PROPERTY))) { // This shouldn't happen in normal operation as we delete the applink when we uninstall an addon // and we uninstall the old addon when we install a new version log.warn("Application link for remote plugin container '{}' already exists. Deleting", pluginKey); applicationLinkService.deleteApplicationLink(link); } else { throw new IllegalStateException("Application link already exists for id '" + appId + "' but it isn't the target " + " plugin '" + pluginKey + "': unexpected plugin key is: " + link.getProperty(PLUGIN_KEY_PROPERTY)); } } else { // try to find link with old display url for (final ApplicationLink otherLink : applicationLinkService.getApplicationLinks(RemotePluginContainerApplicationType.class)) { if (pluginKey.equals(otherLink.getProperty(PLUGIN_KEY_PROPERTY))) { log.debug("Old application link for this plugin '{}' found with different display url '{}', removing", pluginKey, otherLink.getDisplayUrl()); applicationLinkService.deleteApplicationLink(otherLink); } } } }
/** * Deletes all local applinks and stored trusted apps certificates. * Does not require login. * Not very RESTful with a GET, but easier to get to with selenium. */ @GET public Response execute() { /** * {@link MutatingApplicationLinkService#deleteApplicationLink(com.atlassian.applinks.api.ApplicationLink)} * deletes all Trusted Apps and OAuth related state for its applink, * but let's also make sure we remove any orphaned state. */ cleanTrustedApplications(); // Do the same for any left-over OAuth state. cleanOAuth(); for (final ApplicationLink link : ImmutableList.copyOf(linkService.getApplicationLinks())) { linkService.deleteApplicationLink(link); } // delete all charlies: pluginSettingsFactory.createGlobalSettings().remove(CHARLIE_KEYS); return Response.ok().build(); }
applinkservice.deleteApplicationLink(applicationLink); applicationLink = applinkservice.addApplicationLink(id, applicationType, linkDetails);
@DELETE @WebSudoNotRequired @Path("{id}") public Response deleteApplicationLink(@PathParam("id") final String idString, @QueryParam("reciprocate") final Boolean reciprocate) throws TypeNotInstalledException { final ApplicationId id = new ApplicationId(idString); final MutableApplicationLink link = applicationLinkService.getApplicationLink(id); if (link == null) { return notFound(i18nResolver.getText("applinks.notfound", id.get())); } // only a sysadmin can delete a system link. if (link.isSystem() && !userManager.isSystemAdmin(userManager.getRemoteUsername())) { return forbidden(i18nResolver.getText("applinks.error.only.sysadmin.operation")); } if (reciprocate != null && reciprocate) { try { applicationLinkService.deleteReciprocatedApplicationLink(link); } catch (final CredentialsRequiredException e) { return credentialsRequired(i18nResolver); } catch (final ReciprocalActionException e) { return serverError(i18nResolver.getText("applinks.remote.delete.failed", e.getMessage())); } } else { applicationLinkService.deleteApplicationLink(link); } return ok(i18nResolver.getText("applinks.deleted", id.get())); }
applicationLinkService.deleteApplicationLink(link);