コード例 #1
0
 /**
  * Retrieves all related items of any type.
  *
  * @param inItem The item whose related will be retrieved.
  * @return Collection<IItem> of <code>IItem</code>
  * @throws VException
  * @throws SQLException
  */
 public static Collection<ItemWithIcon> getRelatedItems(final IItem inItem)
     throws VException, SQLException {
   // term
   final List<ItemWithIcon> outRelated =
       getItems(
           BOMHelper.getJoinRelatedTerm1Home().select(getKey1(inItem, IItem.TERM)),
           new TermWrapper());
   outRelated.addAll(
       getItems(
           BOMHelper.getJoinRelatedTerm2Home().select(getKey2(inItem, IItem.TERM)),
           new TermWrapper()));
   // text
   outRelated.addAll(
       getItems(
           BOMHelper.getJoinRelatedText1Home().select(getKey1(inItem, IItem.TEXT)),
           new TextWrapper()));
   outRelated.addAll(
       getItems(
           BOMHelper.getJoinRelatedText2Home().select(getKey2(inItem, IItem.TEXT)),
           new TextWrapper()));
   // person
   outRelated.addAll(
       getItems(
           BOMHelper.getJoinRelatedPerson1Home().select(getKey1(inItem, IItem.PERSON)),
           new PersonWrapper()));
   outRelated.addAll(
       getItems(
           BOMHelper.getJoinRelatedPerson2Home().select(getKey2(inItem, IItem.PERSON)),
           new PersonWrapper()));
   // sort
   final Collator lCollator = new ItemCollator();
   lCollator.setStrength(Collator.SECONDARY);
   Collections.sort(outRelated, lCollator);
   return outRelated;
 }
コード例 #2
0
 /**
  * Retrieves all related texts.
  *
  * @param inItem IItem The item the texts are related to.
  * @return Collection<IItemModel>
  * @throws VException
  * @throws SQLException
  */
 public static Collection<ItemWithIcon> getRelatedTexts(final IItem inItem)
     throws VException, SQLException {
   final Collection<ItemWithIcon> outRelated =
       getItems(
           BOMHelper.getJoinRelatedText1Home().select(getKey1(inItem, IItem.TEXT)),
           new TextWrapper());
   outRelated.addAll(
       getItems(
           BOMHelper.getJoinRelatedText2Home().select(getKey2(inItem, IItem.TEXT)),
           new TextWrapper()));
   return outRelated;
 }