/** * Gets a description spec representing the <code>description</code> in the dialect specified by * the <code>dialectNid</code>. * * @param description the description to represent * @param dialectNid specifying the dialect of the description spec * @param viewCoordinate specifying which version of the description to use * @return the generated description spec for the specified dialect * @throws UnsupportedDialectOrLanguage indicates an unsupported dialect or language * @throws IOException signals that an I/O exception has occurred */ public static DescriptionSpec getDescriptionSpecForDialect( DescriptionVersionBI<?> description, int dialectNid, ViewCoordinate viewCoordinate) throws UnsupportedDialectOrLanguage, IOException { try { lazyInit(dialectNid); String variantText = makeTextForDialect(description.getText(), dialectNid); UUID descUuid = UuidT5Generator.getDescUuid( description.getText(), AppContext.getService(TerminologyStoreDI.class) .getConcept(dialectNid) .getPrimordialUuid(), AppContext.getService(TerminologyStoreDI.class) .getConcept(description.getConceptNid()) .getPrimordialUuid()); DescriptionSpec ds = new DescriptionSpec( new UUID[] {descUuid}, SpecFactory.get( AppContext.getService(TerminologyStoreDI.class) .getConcept(description.getConceptNid()), viewCoordinate), SpecFactory.get( AppContext.getService(TerminologyStoreDI.class) .getConcept(description.getTypeNid()), viewCoordinate), variantText); ds.setLangText(description.getLang()); return ds; } catch (NoSuchAlgorithmException ex) { throw new IOException(ex); } catch (UnsupportedEncodingException ex) { throw new IOException(ex); } }