public MdProfileBean() { collectionSession = (CollectionSessionBean) BeanHelper.getSessionBean(CollectionSessionBean.class); sessionBean = (SessionBean) BeanHelper.getSessionBean(SessionBean.class); if (collectionSession.getProfile() == null) { collectionSession.setProfile(new MetadataProfile()); } profile = collectionSession.getProfile(); statements = new ArrayList<StatementWrapper>(); pc = new ProfileController(sessionBean.getUser()); initMenus(); }
public void addConstraint() { Statement st = ((List<StatementWrapper>) statements).get(getStatementPosition()).getAsStatement(); if (getConstraintPosition() >= st.getLiteralConstraints().size()) { ((List<String>) st.getLiteralConstraints()).add(""); } else { ((List<String>) st.getLiteralConstraints()).add(getConstraintPosition() + 1, ""); } collectionSession.setProfile(profile); }
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(); }
public void reset() { profile.getStatements().clear(); statements.clear(); collectionSession.setProfile(profile); }
public void removeConstraint() { Statement st = ((List<StatementWrapper>) statements).get(getStatementPosition()).getAsStatement(); ((List<String>) st.getLiteralConstraints()).remove(getConstraintPosition()); collectionSession.setProfile(profile); }