From: arnaiz <oli...@us...> - 2009-03-05 09:26:28
|
Update of /cvsroot/gmod/apollo/src/java/apollo/editor In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14825/src/java/apollo/editor Modified Files: AnnotationEditor.java Log Message: +Added option 'CheckOwnership' (default false) which check if the user can modify an annotation. Only the owner of the annotation can modify it. Index: AnnotationEditor.java =================================================================== RCS file: /cvsroot/gmod/apollo/src/java/apollo/editor/AnnotationEditor.java,v retrieving revision 1.167 retrieving revision 1.168 diff -C2 -d -r1.167 -r1.168 *** AnnotationEditor.java 3 Apr 2008 19:30:58 -0000 1.167 --- AnnotationEditor.java 5 Mar 2009 09:25:48 -0000 1.168 *************** *** 497,504 **** return false; } ! return true; } - /** --- 497,511 ---- return false; } ! if(!goodOwner(tran1.getOwner()) || !goodOwner(tran2.getOwner())) ! return false; ! ! return true; ! } ! ! private boolean goodOwner(String owner) { ! if(Config.getCheckOwnership() && owner != null && !owner.equals(UserName.getUserName())) ! return false; return true; } /** *************** *** 3722,3725 **** --- 3729,3736 ---- if (annotSet.getTranscripts().size() != 1) return false; if (annotSet.getLeafFeatures().size() <= 1) return false; + + for(int i=0; i<annotSet.getTranscripts().size(); i++) + if(!goodOwner(annotSet.getTranscript(i).getOwner())) + return false; // should there be a gene check? return true; *************** *** 3926,3929 **** --- 3937,3942 ---- if (annotSet.getTranscripts().size() == 1 && annotSet.getLeafFeatures().size() == 2) { + if(!goodOwner(annotSet.getTranscript(0).getOwner())) + return false; return checkAdjacent(annotSet.getTranscript(0), annotSet.getLeafFeatures()); *************** *** 4209,4212 **** --- 4222,4226 ---- if (!(annotSet.getLeafFeat(0) instanceof ExonI)) return false; if (basePosition == -1) return false; + if(!goodOwner(annotSet.getTranscript(0).getOwner())) return false; return true; } *************** *** 4308,4312 **** } ! /** * The default deleteSelectedFeatures which deletes any features in the --- 4322,4335 ---- } ! /** True if can delete selection */ ! public boolean deleteSelectionAllowed() { ! if (annotSet.getLeafFeatures().size() == 0) return false; ! //logger.info(annotSet.getLeafFeatures()); ! for(int i=0; i<annotSet.getTranscripts().size(); i++) ! if(!goodOwner(annotSet.getTranscript(i).getOwner())) ! return false; ! return true; ! } ! /** * The default deleteSelectedFeatures which deletes any features in the |