示例#1
0
  /**
   * 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 Stirng sType, the type of this link.
   * @param String sOriginalID, the original ID of this link if/when imported.
   * @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,
      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, 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);
    }
    return link;
  }
示例#2
0
 /**
  * Remove the given link from the link list.
  *
  * @param Link link, the link to remove from the link list.
  */
 public static void removeLinkSummaryListItem(Link link) {
   String id = link.getId();
   int count = linkSummaryList.size();
   for (int i = 0; i < count; i++) {
     if (id.equals(((Link) linkSummaryList.elementAt(i)).getId())) {
       linkSummaryList.removeElementAt(i);
       return;
     }
   }
 }