Hello,
i am trying to register a service which has a paramter field just like script runner does:
I have defined a field in the properties xml file but the field does not appear.
XML:
<importcsvservice id="importcsvservice">
<description>Dieser Dienst importiert Sollzeiten für den Multi-Timetracker</description>
<properties>
<key>input-file</key>
<name>admin.service.fileimport.sourcefile</name>
<type>string</type>
</properties>
</importcsvservice>
Java Code:
package aptis.plugins.meetingTime.presence;
import com.atlassian.configurable.ObjectConfiguration;
import com.atlassian.configurable.ObjectConfigurationException;
import com.atlassian.jira.service.AbstractService;
import java.util.Map;
public class ImportFromFileJob extends AbstractService {
private ActiveObjects activeObjects;
@Override
public void run() {
try {
ObjectConfiguration objectConfiguration = this.getObjectConfiguration();
Map fieldValues = objectConfiguration.getFieldValues("admin.service.fileimport.sourcefile");
} catch (ObjectConfigurationException e) {
e.printStackTrace();
}
}
@Override
public ObjectConfiguration getObjectConfiguration() throws ObjectConfigurationException {
return getObjectConfiguration("importcsvservice", "xml/presence-service-properties.xml", null);
}
}
Any Ideas where the problem is?
Thanks in advance!
Jens
Hi Jens,
try to correct the service xml configuration:
<importcsvservice id="importcsvservice">
<description>Dieser Dienst importiert Sollzeiten für den Multi-Timetracker</description>
<properties>
<key>input-file</key>
<name>admin.service.fileimport.sourcefile</name>
<type>string</type>
</properties>
</importcsvservice>
to the following one (you missed the property element):
<importcsvservice id="importcsvservice">
<description>Dieser Dienst importiert Sollzeiten für den Multi-Timetracker</description>
<properties>
<property>
<key>input-file</key>
<name>admin.service.fileimport.sourcefile</name>
<type>string</type>
</property>
</properties>
</importcsvservice>
and properties can be easily accessed in the init method
public void init(PropertySet props) throws ObjectConfigurationException {
......
}
Regards Götz
Thanks for your answer, unfortunately im not working on this project any more and can't try this out (the jira instance doesnt exist any more)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.