public void addStatement() { if (statements.isEmpty()) { statements.add(new StatementWrapper(ImejiFactory.newStatement(), profile.getId())); } else { statements.add( getStatementPosition() + 1, new StatementWrapper(ImejiFactory.newStatement(), profile.getId())); } }
public void loadtemplates() { profilesMenu = new ArrayList<SelectItem>(); profilesMenu.add(new SelectItem(null, sessionBean.getLabel("profile_select_template"))); try { for (MetadataProfile mdp : pc.search()) { if (mdp.getId().toString() != profile.getId().toString()) { profilesMenu.add(new SelectItem(mdp.getId().toString(), mdp.getTitle())); } } } catch (Exception e) { BeanHelper.error(sessionBean.getMessage("error_profile_template_load")); } }
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(); }
public void initBeanObjects(MetadataProfile mdp) { statements.clear(); for (Statement st : mdp.getStatements()) { statements.add(new StatementWrapper(st, mdp.getId())); } }
public String getEncodedId() throws UnsupportedEncodingException { if (profile != null && profile.getId() != null) { return URLEncoder.encode(profile.getId().toString(), "UTF-8"); } else return ""; }