From: <rv...@us...> - 2010-02-15 15:06:07
|
Revision: 503 http://treebase.svn.sourceforge.net/treebase/?rev=503&view=rev Author: rvos Date: 2010-02-15 15:05:38 +0000 (Mon, 15 Feb 2010) Log Message: ----------- Added getPurl() method. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/PhyloWSPath.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/PhyloWSPath.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/PhyloWSPath.java 2010-02-15 15:01:00 UTC (rev 502) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/PhyloWSPath.java 2010-02-15 15:05:38 UTC (rev 503) @@ -1,5 +1,8 @@ package org.cipres.treebase; +import java.net.MalformedURLException; +import java.net.URL; + import org.cipres.treebase.domain.TBPersistable; public class PhyloWSPath { @@ -16,9 +19,27 @@ public String getPath() { return getPath(new StringBuilder()).toString(); - } + } /** + * This method constructs a permanent url based on the + * treebase.purl.domain property (as computed by TreebaseUtil.getPurlDomain()), + * the phylows path and the namespaced GUID for the object. + * @return the permanent url for the object + */ + public URL getPurl () { + StringBuilder sb = new StringBuilder(TreebaseUtil.getPurlDomain()); + sb = getPath(sb).append(mNamespacedGUID.toString()); + URL url = null; + try { + url = new URL(sb.toString()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + return url; + } + + /** * */ public String toString() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |