protected String applySLA(SecuredTaskBean task,
			SecuredPriorityBean usedPriority, List<SecuredUDFValueBean> udfvalues)
			throws GranException {
		String deadline = null;
		if (usedPriority!=null){
		for (SecuredUDFValueBean udf : udfvalues) {
		    if (udf.getCaption().equals("SLA - " + usedPriority.getName().trim())) {
		        // use this one for parameters
		        Object o = udf.getValue();
		        if (o != null) {
		            int hoursAdvance = 0;
		            String sla = o.toString();
		            String slaPattern = "([0-9]*)\\s?(\\(\\s?([0-9]*)\\s?\\))?";
		            Pattern slaPat = Pattern.compile(slaPattern);
		            Matcher patternMat = slaPat.matcher(sla);
		            if (patternMat.find()) {
		                String longTerm = patternMat.group(1);
		                String shortTerm = patternMat.group(3);
		                Calendar time = null;
		                if (longTerm != null && longTerm.length() > 0) {
		                    hoursAdvance = Integer.parseInt(longTerm);
		                    Calendar longCal = (Calendar)task.getSubmitdate().clone();
		                    longCal.add(Calendar.HOUR, hoursAdvance);
		                    
		                    deadline = task.getSecure().getUser().getDateFormatter().parse(longCal);
		                    time = longCal;
		                }
		                if (shortTerm != null && shortTerm.length() > 0) {
		                    hoursAdvance = Integer.parseInt(shortTerm);
		                    Calendar shortCal = (Calendar)task.getSubmitdate().clone();
		                    shortCal.add(Calendar.HOUR, hoursAdvance);
		                    time = shortCal;
		                    
		                }
		                updateDeadlineAndPriority(task, usedPriority.getId(), time);
		            }
		        }

		        break;
		    }
		}
		}
		return deadline;
	}