public void templateListener(ValueChangeEvent event) throws Exception { if (event != null && event.getNewValue() != event.getOldValue()) { this.template = event.getNewValue().toString(); MetadataProfile tp = ObjectCachedLoader.loadProfile(URI.create(this.template)); profile.getStatements().clear(); profile.setStatements(tp.getStatements()); collectionSession.setProfile(profile); initBeanObjects(profile); } }
public String changeTemplate() throws Exception { profile.getStatements().clear(); MetadataProfile tp = ObjectLoader.loadProfile(URI.create(this.template), sessionBean.getUser()); if (!tp.getStatements().isEmpty()) { profile.setStatements(tp.getStatements()); } else { profile.getStatements().add(ImejiFactory.newStatement()); } for (Statement s : profile.getStatements()) { s.setId( URI.create( s.getId().toString().replace(tp.getId().toString(), profile.getId().toString()))); } collectionSession.setProfile(profile); initBeanObjects(profile); return getNavigationString(); }