/** * Return a link object with the given id and details. If a link with the given id has already * been created in this session, update its data and return that, else create a new one, and add * it to the list. * * @param String sLinkID, the unique identifier for this Link. * @param java.util.Date dCreationDate, the date the Link was created. * @param java.util.Date dModificationDate, the date the link was last modified. * @param String sAuthor, the name of the porson who created this Link. * @param String sType, the type of this link. * @param String sOriginalID, the original ID of this link if/when imported. * @param NodeSummary oFrom, the node the Link is coming from. * @param NodeSummary oTo, the node the Link is going to. * @param sLabel, the label for this Link. */ public static Link getLink( String sLinkID, java.util.Date dCreationDate, java.util.Date dModificationDate, String sAuthor, String sType, String sOriginalID, NodeSummary oFrom, NodeSummary oTo, String sLabel) { int i = 0; for (i = 0; i < linkSummaryList.size(); i++) { if (sLinkID.equals(((Link) linkSummaryList.elementAt(i)).getId())) { break; } } Link link = null; if (i == linkSummaryList.size()) { link = new Link( sLinkID, dCreationDate, dModificationDate, sAuthor, sType, sOriginalID, oFrom, oTo, sLabel); linkSummaryList.addElement(link); } else { link = (Link) linkSummaryList.elementAt(i); // UPDATE THE DETAILS link.setTypeLocal(sType); link.setAuthorLocal(sAuthor); link.setOriginalIDLocal(sOriginalID); link.setLabelLocal(sLabel); link.setCreationDateLocal(dCreationDate); link.setModificationDateLocal(dModificationDate); link.setToLocal(oTo); link.setFromLocal(oFrom); } return link; }
/** * Sets this link's destination node, in the local data ONLY. * * @param NodeSummary node, The destination node of this link */ public void setTo(NodeSummary node) { if (node == oTo) return; setToLocal(node); }