@Override public Map<String, Object> getContextMap(Map<String, Object> context) { final Issue issue = (Issue) context.get("issue"); final Action action = (Action) context.get("action"); Map<String, Object> paramsBuilder = MapBuilder.newBuilder(context).toMutableMap(); paramsBuilder.put("commentHtml", getCommentHtml(issue, action)); return paramsBuilder; }
public String getCustomFieldHtml(FieldLayoutItem fieldLayoutItem, CustomField field, Issue issue) { // We can pass a null action because none of the searchers views use the action that is passed in. It should // probably be removed from the API as it does not make a ton of sense for the view html to try to attach // errors to the action. Action action = null; final Map<String, Object> displayParams = MapBuilder.<String, Object>newBuilder("textOnly", Boolean.TRUE).toMutableMap(); return field.getViewHtml(fieldLayoutItem, action, issue, displayParams); }
@Nonnull public Map<String, Object> getVelocityParameters(final Issue issue, final CustomField field, final FieldLayoutItem fieldLayoutItem) { return MapBuilder.<String, Object> newBuilder().add("issueGv", issue != null ? issue.getGenericValue() : null).toMutableMap(); }
@Override public Map<String, Object> getContextMap(Map<String, Object> context) { Map<String, Object> returnContext = MapBuilder.newBuilder(context).toMutableMap(); for (ContextProvider provider : ctxProviders) { returnContext = CompositeMap.of(returnContext, provider.getContextMap(context)); } return returnContext; }
@Override public Map<String, Object> getContextMap(final Map<String, Object> context) { Map<String, Object> returnContext = MapBuilder.newBuilder(context).toMutableMap(); for (ContextProvider provider : contextProviders) { returnContext = CompositeMap.of(returnContext, provider.getContextMap(context)); } return returnContext; } }
public Map<String, Object> getContextParams() { final Map<String, Object> newParams = MapBuilder.<String, Object> newBuilder(). add("project", project). add("request", request). toMutableMap(); return CompositeMap.of(newParams, params); }
/** * Given a base map, we add in extra information about the current {@link webwork.view.taglib.IteratorStatus} of the * field being rendered. This allows us to pass along information about the position of the field on the {@link com.atlassian.jira.issue.fields.screen.FieldScreenTab} * in relation to other fields. * * @param fieldStatus the status from the <code>iterator</code> tag that is relevant to the current field * @param baseDisplayParams the <code>displayParameters</code> map that was passed in to the JSP include as a parameter * @return a map which can be passed along as the "displayParameters" map to the field rendering code */ public Map<String, Object> computeDisplayParams(final IteratorStatus fieldStatus, final Map<String, Object> baseDisplayParams) { final MapBuilder<String, Object> builder = MapBuilder.newBuilder(baseDisplayParams); builder.add("isFirstField", fieldStatus.isFirst()); builder.add("isLastField", fieldStatus.isLast()); return builder.toMutableMap(); } }
public String getFieldViewHtml(final OrderableField orderableField) { // There is a validation that will not allow an edit to occur on a field that has different renderer types // defined in the field layout item so if we get here then we know it is safe to grab the first layout // item we can find for the field and that this will imply the correct renderer type. FieldLayoutItem layoutItem = null; if (!getBulkEditBean().getFieldLayouts().isEmpty()) { layoutItem = ((FieldLayout) getBulkEditBean().getFieldLayouts().iterator().next()) .getFieldLayoutItem(orderableField); } // Let the fields know they are being shown as part of the Preview for Bulk Transition. For example, the comment // field needs to display the user group its been retsricted to, not just the comment text final Map<String, Object> displayParams = MapBuilder.<String, Object>newBuilder("readonly", Boolean.TRUE) .add("nolink", Boolean.TRUE) .add("bulkoperation", getBulkEditBean().getOperationName()) .add("prefix", "new_").toMutableMap(); return orderableField .getViewHtml(layoutItem, this, (Issue) getBulkEditBean().getSelectedIssues().iterator().next(), getBulkEditBean().getFieldValues().get(orderableField.getId()), displayParams); }
public void createFieldScreen(FieldScreen fieldScreen) { Map<String, Object> params = MapBuilder.<String, Object>newBuilder() .add("name", fieldScreen.getName()) .add("description", fieldScreen.getDescription()) .toMutableMap(); if (fieldScreen.getId() != null) { params.put("id", fieldScreen.getId()); } GenericValue fieldScreenGV = ofBizDelegator.createValue(FieldScreenStore.FIELD_SCREEN_ENTITY_NAME, params); fieldScreen.setGenericValue(fieldScreenGV); }
/** * Renders the input control for the Contact administrators message. * * @return the HTML of the input control to be displayed on the form. */ public String getContactAdministratorsMessageEditHtml() { try { final JiraRendererModuleDescriptor rendererDescriptor = rendererManager.getRendererForType(AtlassianWikiRenderer.RENDERER_TYPE).getDescriptor(); final Map<Object,Object> rendererParams = MapBuilder.newBuilder().add("rows", "10").add("cols", "60").add("wrap", "virtual").add("class", "long-field").toMutableMap(); return rendererDescriptor.getEditVM(getContactAdministratorsMessage(), null, AtlassianWikiRenderer.RENDERER_TYPE, "contactAdministratorsMessage", "contactAdministratorsMessage", rendererParams, false); } catch (DataAccessException e) { log.error("Could not render edit template for Contact Administrators Message", e); return ""; } }
@Override protected String getContentHtml(Project project, ApplicationUser user) { MapBuilder<String, Object> params = MapBuilder.newBuilder("key", project.getKey(), "jfpTextutils", new JiraFisheyeEscapeTools()); PerforceConfig p4config = perforceConfigStore.getConfig(project); if (p4config != null) { params.add("p4config", p4config); } params.add("hasEditPerms", permissionManager.hasPermission(Permissions.ADMINISTER, user)); return getDescriptorHtml(params.toMutableMap()); } }
public String getFieldViewHtml(final OrderableField orderableField) { // There is a validation that will not allow an edit to occur on a field that has different renderer types // defined in the field layout item so if we get here then we know it is safe to grab the first layout // item we can find for the field and that this will imply the correct renderer type. FieldLayoutItem layoutItem = null; if (!getBulkEditBean().getFieldLayouts().isEmpty()) { layoutItem = getBulkEditBean().getFieldLayouts().iterator().next().getFieldLayoutItem(orderableField); } final Map<String, Object> displayParams = MapBuilder.<String, Object>newBuilder("readonly", Boolean.TRUE) .add("nolink", Boolean.TRUE) .add("bulkoperation", getBulkEditBean().getOperationName()) .add("prefix", "new_").toMutableMap(); Option<BulkEditMultiSelectFieldOption> changeMode = getChangeModeForField(orderableField); if (isChangeModeSelectionAllowed(orderableField) && changeMode.isDefined() && !changeMode.get().getFieldValuesToAdd(orderableField, getBulkEditBean().getFieldValuesHolder()).isEmpty()) { displayParams.put("bulkEditNewValues", changeMode.get().getFieldValuesToAdd(orderableField, getBulkEditBean().getFieldValuesHolder())); } return orderableField.getViewHtml(layoutItem, this, getBulkEditBean().getSelectedIssues().iterator().next(), getBulkEditBean().getFieldValues().get(orderableField.getId()), displayParams); }
public String getOldViewHtml(OrderableField field) { FieldLayout fieldLayout = fieldLayoutManager.getFieldLayout(getIssueObject()); FieldLayoutItem fieldLayoutItem = fieldLayout.getFieldLayoutItem(field); final Map<String, Object> displayParams = MapBuilder.<String, Object>newBuilder("nolink", Boolean.TRUE) .add("readonly", Boolean.TRUE) .add("prefix", "old_").toMutableMap(); return field.getViewHtml(fieldLayoutItem, this, getIssueObject(getIssue()), displayParams); }
/** * Gets the old view of the field before update * * @param field Field to display * @return HTML to insert */ public String getOldViewHtml(OrderableField field) { FieldLayout fieldLayout = fieldLayoutManager.getFieldLayout(getIssue()); FieldLayoutItem fieldLayoutItem = fieldLayout.getFieldLayoutItem(field); final Map<String, Object> displayParams = MapBuilder.<String, Object>newBuilder("readonly", Boolean.TRUE) .add("nolink", Boolean.TRUE) .add("prefix", "old_").toMutableMap(); return field.getViewHtml(fieldLayoutItem, this, getIssue(), displayParams); }
public String getFieldViewHtml(final OrderableField orderableField) { final Map<String, Object> displayParams = MapBuilder.<String, Object>newBuilder("readonly", Boolean.TRUE) .add("nolink", Boolean.TRUE) .add("bulkoperation", getBulkEditBean().getOperationName()).toMutableMap(); // Use the layout item of where we are going since we are moving to that space final FieldLayoutItem layoutItem = getBulkEditBean().getTargetFieldLayout().getFieldLayoutItem(orderableField); return orderableField.getViewHtml(layoutItem, this, getBulkEditBean().getFirstTargetIssueObject(), getBulkEditBean().getFieldValues().get(orderableField.getId()), displayParams); }
public String getNewViewHtml(OrderableField field) { MutableIssue updatedIssue = getMoveIssueBean().getUpdatedIssue(); FieldLayout fieldLayout = fieldLayoutManager.getFieldLayout(updatedIssue.getProjectObject(), updatedIssue.getIssueTypeId()); FieldLayoutItem fieldLayoutItem = fieldLayout.getFieldLayoutItem(field); final Map<String, Object> displayParams = MapBuilder.<String, Object>newBuilder("nolink", Boolean.TRUE) .add("readonly", Boolean.TRUE) .add("prefix", "new_").toMutableMap(); return field.getViewHtml(fieldLayoutItem, this, updatedIssue, displayParams); }
@Override protected String getContentHtml(Project project, ApplicationUser user) { MapBuilder<String, Object> params = MapBuilder.newBuilder( "id", project.getId(), "jfpTextutils", new JiraFisheyeEscapeTools() ); String pKey = project.getKey(); if (repositoryPathStore.hasRepositoryPath(pKey)) { RepositoryPath rp = repositoryPathStore.getRepositoryPath(pKey); params.add("browseUrl", rp.toBrowseUrl()); } params.add("hasEditPerms", permissionManager.hasPermission(Permissions.ADMINISTER, user)); return getDescriptorHtml(params.toMutableMap()); } }
/** * Renders the input control for the Work Description (i.e. Comment) of the Log Work form. The control will be different * depending on which renderer is chosen for the Log Work field for this specific issue context. * * @return the HTML of the input control to be displayed on the form. */ public String getWorkDescriptionEditHtml() { try { final FieldLayoutItem worklogFieldLayoutItem = fieldLayoutManager.getFieldLayout(getIssueObject()).getFieldLayoutItem(IssueFieldConstants.WORKLOG); final String rendererType = (worklogFieldLayoutItem != null) ? worklogFieldLayoutItem.getRendererType() : null; final JiraRendererModuleDescriptor rendererDescriptor = rendererManager.getRendererForType(rendererType).getDescriptor(); final Map<Object,Object> rendererParams = MapBuilder.newBuilder().add("rows", "10").add("cols", "60").add("wrap", "virtual").add("class", "long-field").toMutableMap(); return rendererDescriptor.getEditVM(getComment(), getIssueObject().getKey(), rendererType, "comment", "comment", rendererParams, false); } catch (DataAccessException e) { log.error("Could not render edit template for work description", e); return ""; } }
private Map<String, Object> getTemplateVariables(final Action action, final Version version, final ApplicationUser user, final Project project) { final List<IssuesByType> issueTypes = newArrayList(); for (final IssueType issueType : constantsManager.getAllIssueTypeObjects()) { issueTypes.add(new IssuesByType(issueType, user, version.getId())); } return MapBuilder.<String,Object>newBuilder(). add("action", action). add("req", ExecutingHttpRequest.get()). add("issueTypes", issueTypes). add("appProps", applicationProperties). add("version", version.getName()). add("versionObj", version). add("project", project.getName()). add("textUtils", new TextUtils()). add("requestContext", new DefaultVelocityRequestContextFactory(applicationProperties).getJiraVelocityRequestContext()). add("constantsManager", constantsManager). add("customFieldManager", customFieldManager). toMutableMap(); }
protected void doUpdate(ApplicationUser user, MutableIssue issue, GenericValue originalIssueGV, DefaultIssueChangeHolder issueChangeHolder, UpdateIssueRequest updateRequest) { final EventDispatchOption dispatchOption = updateRequest.getEventDispatchOption(); IssueUpdateBean issueUpdateBean = new IssueUpdateBean(issue.getGenericValue(), originalIssueGV, dispatchOption.getEventTypeId(), user, updateRequest.isSendMail(), true); issueUpdateBean.setComment(issueChangeHolder.getComment()); issueUpdateBean.setChangeItems(issueChangeHolder.getChangeItems()); issueUpdateBean.setDispatchEvent(dispatchOption.isEventBeingSent()); issueUpdateBean.setHistoryMetadata(updateRequest.getHistoryMetadata()); issueUpdateBean.setParams(MapBuilder.newBuilder("eventsource", IssueEventSource.ACTION).toMutableMap()); issueUpdater.doUpdate(issueUpdateBean, false); }