The following script fills in the custom field See Also of type Task, with a list of tasks similar to the created one:
HashMap set = AdapterManager.getInstance().getSecuredTaskAdapterManager() .findSimilar(task.getSecure(),task.getId()); String similar=""; if (set!=null && !set.isEmpty()) { for (Iterator i = set.keySet().iterator(); i.hasNext();) { SecuredTaskBean s = (SecuredTaskBean) i.next(); Float ratio = (Float) set.get(s); if (ratio.floatValue()>0.75f) { similar+="#"+s.getNumber()+"; " ; } } } if (similar.length()>0) { similar=similar.substring(0,similar.length()-2); AdapterManager.getInstance().getSecuredUDFAdapterManager().setTaskUDFValueSimple( task.getSecure(), task.getId(), "See Also", similar); } return task;
Copyright (c) 2002-2006. All rights reserved.
|