Commits

Wojciech Seliga committed e8d0178

NONE polishing tutorial code - version sync with the version ready for proof-reading.

  • Participants
  • Parent commits 13cb5a9

Comments (0)

Files changed (5)

File src/main/java/com/atlassian/jira/plugins/mailhandlerdemo/EditDemoHandlerDetailsWebAction.java

 
 import java.util.Map;
 
-/**
- * TODO: Document this class / interface here
- *
- * @since v5.0
- */
 public class EditDemoHandlerDetailsWebAction extends AbstractEditHandlerDetailsWebAction {
 	private final IssueKeyValidator issueKeyValidator;
 
 		return issueKey;
 	}
 
+    public void setIssueKey(String issueKey) {
+        this.issueKey = issueKey;
+    }
+
+    // this method is called to let us populate our variables (or action state) with current handler settings
+    // managed by associated service (file or mail).
 	@Override
 	protected void copyServiceSettings(JiraServiceContainer jiraServiceContainer) throws ObjectConfigurationException {
 		final String params = jiraServiceContainer.getProperty(AbstractMessageHandlingService.KEY_HANDLER_PARAMS);
 		issueKeyValidator.validateIssue(issueKey, new WebWorkErrorCollector());
 	}
 
-	@Override
-	public String doDefault() throws Exception
-	{
-		String result = super.doDefault();
-
-
-		if (configuration == null || descriptor == null) {
-			return returnCompleteWithInlineRedirect("EditServerDetails!default.jspa");
-		}
-
-		if (configuration.getServiceId() != null) {
-			JiraServiceContainer serviceContainer = getService(configuration.getServiceId());
-			if (serviceContainer != null) {
-				copyServiceSettings(serviceContainer);
-			} else {
-				return returnCompleteWithInlineRedirect("IncomingMailServers.jspa");
-			}
-		}
 
-		return result;
-	}
-
-	public void setIssueKey(String issueKey) {
-		this.issueKey = issueKey;
-	}
 }

File src/main/java/com/atlassian/jira/plugins/mailhandlerdemo/IssueKeyValidator.java

 
 import com.atlassian.jira.issue.Issue;
 import com.atlassian.jira.issue.IssueManager;
-import com.atlassian.jira.issue.MutableIssue;
 import com.atlassian.jira.service.util.handler.MessageHandlerErrorCollector;
 import org.apache.commons.lang.StringUtils;
 
 			return null;
 		}
 
-		final MutableIssue issue = issueManager.getIssueObject(issueKey);
+		final Issue issue = issueManager.getIssueObject(issueKey);
 		if (issue == null) {
 			collector.error("Cannot add a comment from mail to issue '" + issueKey + "'. The issue does not exist.");
 			return null;

File src/main/resources/atlassian-plugin.xml

     <component key="issue-key-validator" class="com.atlassian.jira.plugins.mailhandlerdemo.IssueKeyValidator"/>
 
     <message-handler i18n-name-key="demohandler.name"
-                  key="demoHandler" class="com.atlassian.jira.plugins.mailhandlerdemo.DemoHandler"
-            add-edit-url="/secure/admin/EditHandlerDetailsUsingParams!default.jspa"
-                  weight="0"/>
+            key="demoHandler" class="com.atlassian.jira.plugins.mailhandlerdemo.DemoHandler"
+            add-edit-url="/secure/admin/EditDemoHandlerDetails!default.jspa"
+            weight="0"/>
 
     <webwork1 key="actions" name="Actions" class="java.lang.Object">
         <actions>

File src/main/resources/com/atlassian/jira/plugins/mailhandlerdemo/messages.properties

-demohandler.name=My Demo Mail Handler
+demohandler.name=My Demo Mail Handler
+demohandler.issue.key=Issue Key

File src/main/resources/view/editDemoHandlerDetails.vm

 <html>
 <head>
     <title>$action.handlerName</title>
-    $webResourceManager.requireResource("com.atlassian.jira.jira-mail-plugin:edit-handler-details-page")
 </head>
 <body>
     <form class="aui" action="EditDemoHandlerDetails.jspa" method="POST" name="mailHandlerForm" id="mailHandlerForm">
                 #end
             </span>
             <input type="hidden" name="atl_token" value="$atl_token">
-            <label for="issue-key">Issue Key</label>
+            <label for="issue-key">$i18n.getText('demohandler.issue.key')</label>
             <input type="text" class="text" id="issue-key" name="issueKey" value="$!textutils.htmlEncode($issueKey)">
 
 
         <div class="buttons-container form-footer">
             <div class="buttons">
-                <div class="test-placeholder"></div>
-                <span class="icon throbber"></span>
-                <input id="testButton" type="submit" disabled class="button" value="$i18n.getText('admin.common.words.test')">
                 #if ($action.editing)
                     #set ($addButtonLabel = $i18n.getText('common.words.save'))
                 #else