public String getDescription() { return (String) descriptor.getMetaAttributes().get(JiraWorkflow.WORKFLOW_DESCRIPTION_ATTRIBUTE); }
public void setDescription(final String description) { descriptor.getMetaAttributes().put(JiraWorkflow.WORKFLOW_DESCRIPTION_ATTRIBUTE, description); }
private static void convertAuthorUsernameToUserKey(WorkflowDescriptor descriptor) { Map<String, String> meta = descriptor.getMetaAttributes(); String username = meta.remove(META_UPDATE_AUTHOR_NAME); if (username != null) { String userKey = IdentifierUtils.toLowerCase(username); meta.put(META_UPDATE_AUTHOR_KEY, userKey != null ? userKey : username); } }
public Map getMetaAttributes() { return getNullSafeUnmodifableMap(delegate.getMetaAttributes()); }
private WorkflowDescriptor copyAndUpdateWorkflowDescriptorMetaAttributes(WorkflowDescriptor parentWorkflow, ApplicationUser author) throws FactoryException { final String parentWorkflowXML = convertDescriptorToXML(parentWorkflow); final WorkflowDescriptor workflowDescriptor = convertXMLtoWorkflowDescriptor(parentWorkflowXML); workflowDescriptor.getMetaAttributes().put(JiraWorkflow.JIRA_META_UPDATE_AUTHOR_KEY, author.getKey()); workflowDescriptor.getMetaAttributes().put(JiraWorkflow.JIRA_META_UPDATED_DATE, Long.toString(System.currentTimeMillis())); return workflowDescriptor; }
public Date getUpdatedDate() { final Map metaAttributes = descriptor.getMetaAttributes(); if (metaAttributes != null) { final String updateDateStr = (String) metaAttributes.get(JIRA_META_UPDATED_DATE); if (updateDateStr != null) { try { final long timeInMillis = Long.parseLong(updateDateStr); return new Date(timeInMillis); } catch (final NumberFormatException e) { log.error("The workflow '" + getName() + "' is storing a invalid updated date string '" + updateDateStr + "'.", e); } } } return null; }
private void addAuditInfo(ApplicationUser user, JiraWorkflow workflow) { if (workflow == null) { return; } WorkflowDescriptor descriptor = workflow.getDescriptor(); log.info("User '" + user + "' updated workflow '" + workflow.getName() + "' at '" + new Date() + "'"); // If a non-logged in user is storing the workflow then we will store it as an empty string if (user != null) { descriptor.getMetaAttributes().put(JiraWorkflow.JIRA_META_UPDATE_AUTHOR_KEY, user.getKey()); } else { descriptor.getMetaAttributes().put(JiraWorkflow.JIRA_META_UPDATE_AUTHOR_KEY, ""); } descriptor.getMetaAttributes().put(JiraWorkflow.JIRA_META_UPDATED_DATE, Long.toString(System.currentTimeMillis())); }
public ApplicationUser getUpdateAuthor(){ String updateAuthor = null; final Map metaAttributes = descriptor.getMetaAttributes(); if (metaAttributes != null) { updateAuthor = (String) metaAttributes.get(JIRA_META_UPDATE_AUTHOR_KEY); } return ComponentAccessor.getUserManager().getUserByKeyEvenWhenUnknown(updateAuthor); }
final Object existingDraftAuthor = existingDescriptor.getMetaAttributes().get(JiraWorkflow.JIRA_META_UPDATE_AUTHOR_KEY); if (existingDraftAuthor != null) updatedDescriptor.getMetaAttributes().put(JiraWorkflow.JIRA_META_UPDATE_AUTHOR_KEY, existingDraftAuthor); final Object existingDraftUpdateDate = existingDescriptor.getMetaAttributes().get(JiraWorkflow.JIRA_META_UPDATED_DATE); if (existingDraftUpdateDate != null) updatedDescriptor.getMetaAttributes().put(JiraWorkflow.JIRA_META_UPDATED_DATE, existingDraftUpdateDate);
private String createClassicWorkflow() throws FactoryException, IOException { WorkflowDescriptor descriptor = WorkflowUtil.convertXMLtoWorkflowDescriptor(defaultClassicXml()); String workflowName = uniqueWorkflowName(); descriptor.getMetaAttributes().put("jira.description", workflowDescription()); // Using the store instead of talking directly to the db because we need the store to put it in its cache. descriptorStore.saveWorkflow(workflowName, descriptor, false); // Add information about the visual layout of the workflow, so it doesn't appear all jumbled. Long layoutEntryKey = ofBizDelegator.createValue("OSPropertyEntry", ImmutableMap.<String, Object>of("entityName", "com.atlassian.jira.plugins.jira-workflow-designer", "entityId", 1, "propertyKey", layoutKey(workflowName), "type", 6)).getLong("id"); ofBizDelegator.createValue("OSPropertyText", ImmutableMap.<String, Object>of("id", layoutEntryKey, "value", defaultLayoutJson())); return workflowName; }
descriptor.getMetaAttributes().put(JiraWorkflow.WORKFLOW_DESCRIPTION_ATTRIBUTE, newDescription); updateWorkflow(user, workflow);