Hi All,
I am writing an add on. I wrote a custom service which should take two parameters from the UI and print it.
But It was taking the first property and ignoring the second property.
Service.class
package com.kworks.timeinstatus.services;
import com.atlassian.configurable.ObjectConfiguration;
import com.atlassian.configurable.ObjectConfigurationException;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.service.AbstractService;
import com.opensymphony.module.propertyset.PropertySet;
import java.io.*;
import com.atlassian.mail.Email;
import com.atlassian.mail.server.MailServerManager;
import com.atlassian.mail.server.SMTPMailServer;
import com.atlassian.jira.component.ComponentAccessor;
import javax.mail.internet.*;
import javax.mail.*;
import javax.activation.*;
import javax.mail.Multipart;
import javax.mail.internet.MimeMultipart;
import java.nio.file.Files;
import java.nio.file.Paths;
public class TimeInStatusService extends AbstractService {
public static final String TUTORIAL = "Tutorial";
public static final String TUTORIAL1 = "Tutorial";
private String jql;
private String subscriber;
@Override
public void init(PropertySet props) throws ObjectConfigurationException {
super.init(props);
if (hasProperty(TUTORIAL)) {
jql = getProperty(TUTORIAL);
} else {
jql = null;
}
if (hasProperty(TUTORIAL1)) {
subscriber = getProperty(TUTORIAL1);
} else {
subscriber = null;
}
}
@Override
public ObjectConfiguration getObjectConfiguration() throws ObjectConfigurationException {
return getObjectConfiguration("MYNEWSERVICE", "com/kworks/services/mytimeinstatusservice.xml", null);
}
@Override
public void run(){
String result = sendmail();
System.out.println("JQL is: "+jql+" Application User is: "+subscriber);
}
@Override
public void destroy() {
System.out.println("Let me do this before destory!");
super.destroy();
}
}
Service.xml
<someservice id="jtricksserviceid">
<description>My New Service</description>
<properties>
<property>
<key>Tutorial</key>
<name>JQL</name>
<type>string</type>
</property>
<property>
<key>Tutorial1</key>
<name>Subscriber</name>
<type>string</type>
</property>
</properties>
</someservice>
Input:
Expected Result:
JQL is: Test Application User is: Kiran
Actual Result:
JQL is: Test Application User is: Test
Please Help me.
Thanks,
Kiran.
Hi @Jonnada Kiran,
I'm sorry I don't know how to help you, but I think you will find more help in the developer community https://community.developer.atlassian.com
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.