From: <rv...@us...> - 2012-01-19 22:41:46
|
Revision: 1015 http://treebase.svn.sourceforge.net/treebase/?rev=1015&view=rev Author: rvos Date: 2012-01-19 22:41:40 +0000 (Thu, 19 Jan 2012) Log Message: ----------- In the previous revision, line 73 assumed that all objects are studies, such that we can check whether they are under embargo. This doesn't make sense as this controller operates on any object, whether study or otherwise. Hence I've added getStudy() methods to all domain objects, which either return the containing study or null in the case that the focal object doesn't logically belong to a study (e.g. in the case of a genetic code symbol). If the object does belong to a study we can then test whether it is published or not. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java 2012-01-19 22:38:16 UTC (rev 1014) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AnyObjectAsRDFController.java 2012-01-19 22:41:40 UTC (rev 1015) @@ -70,7 +70,8 @@ TBPersistable theObject = getStudyService().findByID(theClass, treebaseIDString.getId()); if ( null != theObject ) { - if (! getStudyService().findByID(treebaseIDString.getId()).isPublished()) { + Study theContainingStudy = theObject.getStudy(); + if (null != theContainingStudy && ! theContainingStudy.isPublished()) { response.setContentType("text/plain"); response.setStatus(HttpServletResponse.SC_SEE_OTHER); response.setHeader("Location", "/treebase-web/accessviolation.html"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |