WorkflowDescriptor cloneDescriptor(WorkflowDescriptor workflowDescriptor) throws FactoryException { return WorkflowUtil.convertXMLtoWorkflowDescriptor(WorkflowUtil.convertDescriptorToXML(workflowDescriptor)); }
/** * Exposed for testing - to escape from testing internals of that bloody static WorkflowUtil.getCallerKey */ @VisibleForTesting protected String getCallerKey(final Map transientVars) { return WorkflowUtil.getCallerKey(transientVars); } }
/** * Get the next usable ID value for a given list of descriptors. */ public static int getNextId(final List descriptors) { return getNextId(descriptors, 1); }
WorkflowDescriptor convertXMLtoWorkflowDescriptor(String parentWorkflowXML) throws FactoryException { return WorkflowUtil.convertXMLtoWorkflowDescriptor(parentWorkflowXML); }
String convertDescriptorToXML(final WorkflowDescriptor descriptor) { return WorkflowUtil.convertDescriptorToXML(descriptor); }
/** * Get the i18n'ed name of a workflow action (eg. 'Start Progress'). * * @param descriptor Descriptor eg. from {@link com.atlassian.jira.workflow.JiraWorkflow#getDescriptor()} */ public String getWorkflowTransitionDisplayName(final ActionDescriptor descriptor) { return WorkflowUtil.getWorkflowTransitionDisplayName(descriptor); }
private void initializeAndFilterAttributes() { metaAtrributes = Maps.newLinkedHashMap(); // Remove reserved meta attributes from the map - as they should not be shown for (final Map.Entry<String, String> entry : getEntityMetaAttributes().entrySet()) { final String key = entry.getKey(); if (!WorkflowUtil.isReservedKey(key)) { metaAtrributes.put(key, entry.getValue()); } } }
sendMail = ((Boolean)transientVars.get("sendBulkNotification")).booleanValue(); ApplicationUser caller = WorkflowUtil.getCallerUser(transientVars); getIssueEventManager().dispatchRedundantEvent(eventTypeId, updatedIssue, caller, comment, null, changeGroup, params, sendMail);
private String getWorkflowTransitionDescription(final ActionDescriptor descriptor) { return StringUtils.trimToNull(WorkflowUtil.getWorkflowTransitionDescription(descriptor)); }
private static boolean isAcceptableNameInt(String workflowName, @Nullable String fieldName, @Nullable ErrorCollection errorCollection) { if (org.apache.commons.lang.StringUtils.isBlank(workflowName)) { addError(errorCollection, fieldName, "admin.errors.you.must.specify.a.workflow.name"); return false; } else if (!StringUtils.isStringAllASCII(workflowName)) { addError(errorCollection, fieldName, "admin.errors.please.use.only.ascii.characters"); return false; } else if (!workflowName.trim().equals(workflowName)) { // JRA-29521 in MSSQL and MySQL (in postgresql and oracle this does not happen) comparison between char and varchar // does not take into account trailing spaces so in those databases 'a' = 'a ' // However those databases returns values for varchar according to ANSI specification with trailing spaces. // Because in JIRA workflow are identified by name when user copied workflow that was only different by // trailing space the java implementation though that this is different name but when OfBizWorkflowDescriptorStore // tried to get the workflow from db it go the original. So when the copy was saved the original was lost // and the data was corrupted. Issues and schema had assigned workflow that no longer exists (the one without space). addError(errorCollection, fieldName, "admin.errors.workflow.name.cannot.contain.leading.or.trailing.whitespaces"); return false; } return true; }
private boolean checkInvalidCharacters(final String fieldKey, final String fieldValue, Errors errors) { SimpleErrorCollection errorCollection = new SimpleErrorCollection(); // This is needed due to http://jira.opensymphony.com/browse/WF-476. We should consider removing this // if we upgrade osworkflow to a version that fixes WF-476. WorkflowUtil.checkInvalidCharacters(fieldValue, fieldKey, errorCollection); errors.addErrorCollection(errorCollection); return !errorCollection.hasAnyErrors(); }
WorkflowDescriptor convertXMLtoWorkflowDescriptor(final String parentWorkflowXML) throws FactoryException { return WorkflowUtil.convertXMLtoWorkflowDescriptor(parentWorkflowXML); }
String convertDescriptorToXML(WorkflowDescriptor descriptor) { return WorkflowUtil.convertDescriptorToXML(descriptor); }
/** * Get the i18n'ed name of a workflow action (eg. 'Start Progress'). * * @param descriptor Descriptor eg. from {@link com.atlassian.jira.workflow.JiraWorkflow#getDescriptor()} */ private String getWorkflowTransitionDisplayName(final ActionDescriptor descriptor) { return WorkflowUtil.getWorkflowTransitionDisplayName(descriptor); }
private boolean validateDelete(String key, Errors errors) { boolean validate = true; key = normaliseKey(key); if (key == null) { errors.addError(getNameKey(), VALIDATION_FAILED, "admin.errors.workflows.attribute.key.must.be.set"); validate = false; } else if (WorkflowUtil.isReservedKey(key)) { errors.addError(getNameKey(), VALIDATION_FAILED, "admin.errors.workflows.cannot.remove.reserved.attribute"); validate = false; } return validate; }
ApplicationUser author = WorkflowUtil.getCallerUser(transientVars);
String getWorkflowTransitionDescription(final ActionDescriptor descriptor) { return StringUtils.trimToNull(WorkflowUtil.getWorkflowTransitionDescription(descriptor)); }
WorkflowDescriptor convertGVToDescriptor(final GenericValue gv) throws FactoryException { WorkflowDescriptor descriptor = WorkflowUtil.convertXMLtoWorkflowDescriptor(gv.getString(DESCRIPTOR_ENTITY_FIELD)); descriptor.setEntityId(gv.getLong("id").intValue()); return descriptor; } }
private void updateWorkflow(GenericValue workflow, String entityName) { final WorkflowDescriptor descriptor; try { descriptor = WorkflowUtil.convertXMLtoWorkflowDescriptor(workflow.getString(DESCRIPTOR_ENTITY_FIELD)); } catch (FactoryException fe) { log.error("Unable to update username references in corrupted workflow: " + fe); return; } convertAuthorUsernameToUserKey(descriptor); convertAssigneeFieldValueToUserKey(descriptor); String postConversionDescriptor = WorkflowUtil.convertDescriptorToXML(descriptor); final Update.WhereContext query = Update.into(entityName) .set(DESCRIPTOR_ENTITY_FIELD, postConversionDescriptor) .whereIdEquals(workflow.getLong("id")); entityEngine.execute(query); }
String convertDescriptorToXML(final WorkflowDescriptor descriptor) { return WorkflowUtil.convertDescriptorToXML(descriptor); }