public MetadataFormPage(final PageParameters parameters) { setPageTitle(ResourceUtils.getModel("pageTitle.metadata.new")); add(new ButtonPageMenu("leftMenu", ExperimentsPageLeftMenu.values())); StringValue value = parameters.get(DEFAULT_PARAM_ID); if (value.isEmpty() || value.isNull()) { throw new RestartResponseAtInterceptPageException(ListTemplatePage.class); } int experimentId = value.toInt(); Experiment exp = expFacade.getExperimentForDetail(experimentId); add( new MetadataForm( "metadata-form", new Model<Section>(exp.getElasticExperiment().getMetadata()), experimentId)); getFeedback().setFilter(new ComponentFeedbackMessageFilter(this)); }
/** * Specialized constructor which loads experiments based on given properties * * @param facade ExperimentsFacade which will be used to load experiments * @param person person object used for filtering * @param owner search by isOwner (related to the person parameter) * @param subject search by isSubject (related to the person parameter) */ public ListExperimentsDataProvider( ExperimentsFacade facade, Person person, boolean owner, boolean subject) { super("experimentId", SortOrder.ASCENDING); List<Experiment> list; int size; if (owner) { size = facade.getCountForExperimentsWhereOwnerOrExperimenter(person); list = facade.getMyExperiments(person, (int) 0, size); } else if (subject) { size = facade.getCountForExperimentsWhereSubject(person); list = facade.getExperimentsWhereSubject(person, (int) 0, size); } else { size = facade.getCountForAllExperimentsForUser(person); list = facade.getAllExperimentsForUser(person, (int) 0, size); } super.listModel.setObject(list); }