Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Custom SLA Condition

Hi there,

 

im trying to create a custom condition for the SD SLA's.

I followed so far the code from the template plugin of the SD Source package.

Including sla-condition-factory in the atlassian-plugin.xml

 

My problem is that i get the following Exception

Plugin module de.company.customfield.sla.metric:custom-field-sla-condition-factory threw exception de.company.sla.factory.CustomFieldTimeMetricConditionFactory cannot be cast to com.atlassian.servicedesk.spi.sla.condition.TimeMetricConditionFactory

 

Thanks for reading this so far
Philipp

2 answers

1 accepted

0 votes
Answer accepted

Found my answer,

it seems that i included the artifact "jira-servicedesk-api" wrong.

scope=provided was the magical setting

Nice one!

Otherwise you will have a plugin jar file including the servicedesk jar ;)

Hi Philip,

Why do you use the xml file instead of UI? Can you share your source for the "code from the template plugin of the SD Source package."

Also, can you give me a bit more information about the custom SLA condition you're trying to implement?

Best,

Gökçe

Hi Gökçe,

im trying to create a condition for a specific Customfield Value.

Even with an empty Factory i get the Exception.

Best regards,

Philipp

 

Addition in the atlassian-plugin.xml

<sla-condition-factory key="custom-field-sla-condition-factory" class="de.company.sla.factory.CustomFieldTimeMetricConditionFactory"/>

and the Factory

package de.company.sla.factory;

import java.util.List;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;

import com.atlassian.jira.project.Project;
import com.atlassian.servicedesk.spi.sla.condition.TimeMetricConditionFactory;
import com.atlassian.servicedesk.spi.sla.condition.TimeMetricHitCondition;
import com.atlassian.servicedesk.spi.sla.condition.TimeMetricMatchCondition;
import com.google.common.collect.Lists;

public class CustomFieldTimeMetricConditionFactory implements TimeMetricConditionFactory {

public static final String FACTORY_ID = "custom-field-sla-condition-factory";

@Autowired
public CustomFieldTimeMetricConditionFactory() {
}

@PostConstruct
public void onSpringContextStarted() {
}

public List<? extends TimeMetricMatchCondition> getAllMatchConditions(Project project) {
return Lists.newArrayList();
}

public List<? extends TimeMetricHitCondition> getAllHitConditions(Project project) {
return Lists.newArrayList();
}

public TimeMetricMatchCondition getMatchCondition(String id) {
return null;
}

public TimeMetricHitCondition getHitCondition(String id) {
return null;
}

}

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

209 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you