package com.blueland.bpm.manage.util;

import java.util.Comparator;

import org.activiti.bpmn.model.ExpandProperty;
import org.activiti.bpmn.model.SequenceFlow;

import com.blueland.bpm.engine.util.ProcessDefinitionUtils;


public class ComparatorTransition  implements Comparator<SequenceFlow>{

	@Override
	public int compare(SequenceFlow sequenceFlow1, SequenceFlow sequenceFlow2) {
		ExpandProperty expandProperty1=ProcessDefinitionUtils.findTransitionOrder(sequenceFlow1.getExpandProperties());
		ExpandProperty expandProperty2=ProcessDefinitionUtils.findTransitionOrder(sequenceFlow2.getExpandProperties());
		String val1="99";
		String val2="99";
		if(expandProperty1!=null){
			val1=expandProperty1.getValue();
		}
		if(expandProperty2!=null){
			val2=expandProperty2.getValue();
		}
		return val1.compareTo(val2);
	}

}
