/** * 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; }
/** * Retrieves all related terms. * * @param inItem IItem The item the terms are related to. * @return Collection<ItemWithIcon> * @throws VException * @throws SQLException */ public static Collection<ItemWithIcon> getRelatedTerms(final IItem inItem) throws VException, SQLException { final Collection<ItemWithIcon> outRelated = getItems( BOMHelper.getJoinRelatedTerm1Home().select(getKey1(inItem, IItem.TERM)), new TermWrapper()); outRelated.addAll( getItems( BOMHelper.getJoinRelatedTerm2Home().select(getKey2(inItem, IItem.TERM)), new TermWrapper())); return outRelated; }