* @param abbreviatedLabel a {@link java.lang.String} object.
*/
public void setTerm(String text, String label, String abbreviatedLabel) {
-
- try {
- if(getTerm() == null){
- term = (T) termClass.newInstance();
-
- term.addRepresentation(new Representation(text, label, abbreviatedLabel, CdmStore.getDefaultLanguage()));
- }else{
- Representation representation = term.getPreferredRepresentation(CdmStore.getDefaultLanguage());
- representation.setText(text);
- representation.setLabel(label);
- representation.setAbbreviatedLabel(abbreviatedLabel);
- }
-
- } catch (InstantiationException e) {
- StoreUtil.error(this.getClass(), "InstantiationException when setting term", e);
- } catch (IllegalAccessException e) {
- StoreUtil.error(this.getClass(), "IllegalAccessException when setting term", e);
- }
-
+ Representation representation = getTerm().getRepresentation(CdmStore.getDefaultLanguage());
+ representation.setText(text);
+ representation.setLabel(label);
+ representation.setAbbreviatedLabel(abbreviatedLabel);
}
/**
* @return the term
*/
public T getTerm() {
+ if(term == null){
+ try {
+ term = (T) termClass.newInstance();
+
+ term.addRepresentation(Representation.NewInstance("", "", "", CdmStore.getDefaultLanguage()));
+ } catch (InstantiationException e) {
+ StoreUtil.error(this.getClass(), "InstantiationException when setting term", e);
+ } catch (IllegalAccessException e) {
+ StoreUtil.error(this.getClass(), "IllegalAccessException when setting term", e);
+ }
+ }
return term;
}
- public Representation getRepresentation(){
- return term != null ? term.getRepresentation(CdmStore.getDefaultLanguage()) : null;
+ public Representation getRepresentation(){
+ return getTerm().getRepresentation(CdmStore.getDefaultLanguage());
}
/**