@Override public Collection<Message> doUpgrade() throws Exception { Set<String> issueKeys = ao.executeInTransaction(new TransactionCallback<Set<String>>() { @Override public Set<String> doInTransaction() { IssueMapping[] mappings = ao.find(IssueMapping.class, Query.select().where(ISSUE_KEY + " IS NOT NULL")); return Sets.newHashSet(Lists.transform(Arrays.asList(mappings), new Function<IssueMapping, String>() { @Override public String apply(IssueMapping input) { return input != null ? input.getIssueKey() : null; } })); } }); for (String issueKey : issueKeys) { try { if (issueKey != null && issueManager.getIssueObject(issueKey) == null) { LOGGER.info("Found deleted issue {}. Removing it form the build index", issueKey); issueDao.unlinkForIssueKey(issueKey); } } catch (DataAccessException e) { LOGGER.error("Failed to retrieve issue by key [{}]; {}", issueKey, e.getMessage()); } } return Collections.emptyList(); }
protected void populateVelocityParams(Map params) { params.put("action", this); params.put("worklog", this.getWorklog()); params.put("content", worklog.getComment()); params.put("userformats", userFormats); try { final FieldLayoutItem fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue).getFieldLayoutItem(IssueFieldConstants.WORKLOG); if (fieldLayoutItem != null) { params.put("content", rendererManager.getRenderedContent(fieldLayoutItem.getRendererType(), worklog.getComment(), issue.getIssueRenderContext())); } } catch (DataAccessException e) { log.error(e.getMessage(), e); } }
/** * This will populate the passed in map with this object referenced as "action" and the rendered comment body as * "renderedContent". * @param params map of params to populate */ protected void populateVelocityParams(Map params) { params.put("action", this); params.put("velocityhelper", new JiraVelocityHelper(ComponentAccessor.getFieldManager())); params.put("requestContext", new DefaultVelocityRequestContextFactory(ComponentAccessor.getApplicationProperties()).getJiraVelocityRequestContext()); params.put("userformat", ComponentAccessor.getComponent(UserFormatManager.class)); params.put("textutils", new TextUtils()); try { FieldLayoutItem fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue.getProjectObject(), issue.getIssueTypeId()).getFieldLayoutItem(IssueFieldConstants.COMMENT); if (fieldLayoutItem != null) { params.put("renderedContent", rendererManager.getRenderedContent(fieldLayoutItem.getRendererType(), comment.getBody(), issue.getIssueRenderContext())); } } catch (DataAccessException e) { log.error(e.getMessage(), e); } }
@Override public HealthStatus check() { // any SELECT will do, as long as we hit the database. try { final OfBizListIterator rows = ofBizDelegator.findListIteratorByCondition(ENTITY_NAME, null, null, null, null, EntityFindOptions.findOptions().fetchSize(1)); try { for (final GenericValue row : rows) { // make sure we consume all the results to keep all db drivers happy log.trace("addHealthCheckInfo: select from {} limit 1: {}", ENTITY_NAME, row); } } finally { rows.close(); } return healthStatusFactory.healthy(); } catch (DataAccessException e) { return healthStatusFactory.failed(e.getMessage()); } } }
@RequiresXsrfCheck protected String doExecute() throws Exception { try { getSchemeManager().copyScheme(getSchemeObject()); } catch (DataAccessException e) { addErrorMessage(e.getMessage()); } return getRedirect(getRedirectURL()); } }
errorCollection.addErrorMessage(i18nBean.getText("admin.errors.project.exception.removing", e.getMessage())); return new DeleteProjectResult(errorCollection);