Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom SLA Condition

Philipp Kriegel
Contributor
August 28, 2020

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
Philipp Kriegel
Contributor
August 28, 2020

Found my answer,

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

scope=provided was the magical setting

Tuncay Senturk _Snapbytes_
Community Champion
August 28, 2020

Nice one!

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

0 votes
Gökçe Gürsel {Appfire}
Atlassian Partner
August 28, 2020

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

Philipp Kriegel
Contributor
August 28, 2020

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
AUG Leaders

Atlassian Community Events