Java Code Examples for org.apache.wicket.util.string.StringValue

The following examples show how to use org.apache.wicket.util.string.StringValue. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: inception   Source File: ConceptFeatureEditor.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public String[] getInputAsArray()
{
    // If the web request includes the additional "identifier" parameter which is supposed
    // to contain the IRI of the selected item instead of its label, then we use that as the
    // value.
    WebRequest request = getWebRequest();
    IRequestParameters requestParameters = request.getRequestParameters();
    StringValue identifier = requestParameters
            .getParameterValue(getInputName() + ":identifier");
    
    if (!identifier.isEmpty()) {
        return new String[] { identifier.toString() };
    }
    
    return super.getInputAsArray();
}
 
Example 2
Source Project: the-app   Source File: DirectBuyRequestCycleListener.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onBeginRequest(RequestCycle cycle) {
    StringValue directBuyParameterValue = cycle.getRequest().getRequestParameters().getParameterValue(DIRECT_BUY_PARAMETER);
    if (!directBuyParameterValue.isEmpty()) {
        try {
            ProductInfo productInfo = productService.findByQuery(ProductQuery.create().withUrlname(directBuyParameterValue.toString()));
            if (productInfo != null) {
                cart.addItem(productInfo);
            } else {
                ShopSession.get().error(String.format("Das Product '%s' konnte nicht gefunden werden.", directBuyParameterValue));
            }
            Url urlWithoutDirectBuy = removeDirectBuyFromUrl(cycle);
            redirectTo(cycle, urlWithoutDirectBuy);
        } catch (Exception e) {
            ShopSession.get().error(DIRECT_BUY_PROCESSING_FAILED_MESSAGE);
            LOGGER.error(DIRECT_BUY_PROCESSING_FAILED_MESSAGE, e);
        }
    }
}
 
Example 3
Source Project: yes-cart   Source File: WicketUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Transform wicket 1.5 page parameter to more traditional map.  Expensive operation.
 *
 * @param pageParameters given parameters to transform.
 * @return parameters transformed to map
 */
public Map<String, List<String>> pageParametersAsMultiMap(final PageParameters pageParameters) {
    final Map<String, List<String>> map = new LinkedHashMap<>();
    if (pageParameters != null) {
        for (String key : pageParameters.getNamedKeys()) {
            if (!commandConfig.isInternalCommandKey(key)) {
                final List<String> vals = new ArrayList<>();
                for (final StringValue value : pageParameters.getValues(key)) {
                    vals.add(value.toString());
                }
                map.put(key, vals);
            }
        }
    }
    return map;
}
 
Example 4
Source Project: yes-cart   Source File: AjaxWlPage.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void onBeforeRender() {

    executeHttpPostedCommands();

    final StringValue skuValue = getPageParameters().get(ShoppingCartCommand.CMD_ADDTOWISHLIST);
    final String sku = skuValue.toString();

    final StringBuilder outJson = new StringBuilder();
    outJson.append("{ \"SKU\": \"").append(sku.replace("\"", "")).append("\" }");

    addOrReplace(new Label("wlAddedObj", outJson.toString()).setEscapeModelStrings(false));
    super.onBeforeRender();

    persistCartIfNecessary();
}
 
Example 5
Source Project: openmeetings   Source File: RecordingResourceReference.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected Recording getFileItem(Attributes attributes) {
	PageParameters params = attributes.getParameters();
	StringValue _id = params.get("id");
	String ruid = params.get("ruid").toString();
	String uid = params.get("uid").toString();
	Long id = null;
	try {
		id = _id.toOptionalLong();
	} catch (Exception e) {
		//no-op expected
	}
	WebSession ws = WebSession.get();
	if (id == null && ws.signIn(_id.toString(), true)) {
		id = getRecordingId();
	}
	if (id != null && ws.isSignedIn()) {
		return getRecording(id, ruid, uid);
	}
	return null;
}
 
Example 6
Source Project: webanno   Source File: CurationPage.java    License: Apache License 2.0 6 votes vote down vote up
public CurationPage()
{
    super();
    LOG.debug("Setting up curation page without parameters");
    commonInit();
    
    Map<String, StringValue> fragmentParameters = Session.get()
            .getMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS);
    if (fragmentParameters != null) {
        // Clear the URL fragment parameters - we only use them once!
        Session.get().setMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS, null);
        
        StringValue project = fragmentParameters.get(PAGE_PARAM_PROJECT_ID);
        StringValue document = fragmentParameters.get(PAGE_PARAM_DOCUMENT_ID);
        StringValue focus = fragmentParameters.get(PAGE_PARAM_FOCUS);
        
        handleParameters(null, project, document, focus, false);
    }
}
 
Example 7
Source Project: webanno   Source File: LoginPage.java    License: Apache License 2.0 6 votes vote down vote up
private void setDefaultResponsePageIfNecessary()
{
    // This does not work because it was Spring Security that intercepted the access, not
    // Wicket continueToOriginalDestination();

    String redirectUrl = getRedirectUrl();
    
    if (redirectUrl == null || redirectUrl.contains(".IBehaviorListener.")
            || redirectUrl.contains("-logoutPanel-")) {
        log.debug("Redirecting to welcome page");
        setResponsePage(getApplication().getHomePage());
    }
    else {
        log.debug("Redirecting to saved URL: [{}]", redirectUrl);
        if (isNotBlank(form.urlfragment) && form.urlfragment.startsWith("!")) {
            Url url = Url.parse("http://dummy?" + form.urlfragment.substring(1));
            UrlRequestParametersAdapter adapter = new UrlRequestParametersAdapter(url);
            LinkedHashMap<String, StringValue> params = new LinkedHashMap<>();
            for (String name : adapter.getParameterNames()) {
                params.put(name, adapter.getParameterValue(name));
            }
            Session.get().setMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS, params);
        }
        throw new NonResettingRestartException(redirectUrl);
    }
}
 
Example 8
Source Project: webanno   Source File: AnnotationPage.java    License: Apache License 2.0 6 votes vote down vote up
public AnnotationPage()
{
    super();
    LOG.debug("Setting up annotation page without parameters");

    setModel(Model.of(new AnnotatorStateImpl(Mode.ANNOTATION)));
    // Ensure that a user is set
    getModelObject().setUser(userRepository.getCurrentUser());

    Map<String, StringValue> fragmentParameters = Session.get()
            .getMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS);
    StringValue focus = StringValue.valueOf(0);
    if (fragmentParameters != null) {
        // Clear the URL fragment parameters - we only use them once!
        Session.get().setMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS, null);

        StringValue project = fragmentParameters.get(PAGE_PARAM_PROJECT_ID);
        StringValue projectName = fragmentParameters.get(PAGE_PARAM_PROJECT_NAME);
        StringValue document = fragmentParameters.get(PAGE_PARAM_DOCUMENT_ID);
        StringValue name = fragmentParameters.get(PAGE_PARAM_DOCUMENT_NAME);
        focus = fragmentParameters.get(PAGE_PARAM_FOCUS);

        handleParameters(project, projectName, document, name, focus, false);
    }
    commonInit(focus);
}
 
Example 9
Source Project: webanno   Source File: AnnotationPage.java    License: Apache License 2.0 6 votes vote down vote up
public AnnotationPage(final PageParameters aPageParameters)
{
    super(aPageParameters);
    LOG.debug("Setting up annotation page with parameters: {}", aPageParameters);

    setModel(Model.of(new AnnotatorStateImpl(Mode.ANNOTATION)));
    // Ensure that a user is set
    getModelObject().setUser(userRepository.getCurrentUser());
    
    StringValue project = aPageParameters.get(PAGE_PARAM_PROJECT_ID);
    StringValue projectName = aPageParameters.get(PAGE_PARAM_PROJECT_NAME);
    StringValue document = aPageParameters.get(PAGE_PARAM_DOCUMENT_ID);
    StringValue name = aPageParameters.get(PAGE_PARAM_DOCUMENT_NAME);
    StringValue focus = aPageParameters.get(PAGE_PARAM_FOCUS);
    if (focus == null) {
        focus = StringValue.valueOf(0);
    }
    
    handleParameters(project, projectName, document, name, focus, true);
    commonInit(focus);
}
 
Example 10
Source Project: wicket-spring-boot   Source File: CustomerEditPage.java    License: Apache License 2.0 6 votes vote down vote up
public CustomerEditPage(PageParameters params){
		super();
		StringValue customerIdParam = params.get(CUSTOMER_ID_PARAM);
		if(customerIdParam.isEmpty() || !StringUtils.isNumeric(customerIdParam.toString())){
			getSession().error(MessageFormat.format(getString("param.customer.id.missing"), customerIdParam));
//			"Missing customer id " + stringValue
			setResponsePage(CustomerListPage.class);
		}
		Long customerId = customerIdParam.toLong();
		Customer customer = service.findById(customerId);
		if(customer == null){
			getSession().error(MessageFormat.format(getString("customer.not-found"), customerId.toString()));
			setResponsePage(CustomerListPage.class);
		}
		
		StringValue pageReferfenceIdParam = params.get(PAGE_REFERENCE_ID);
		if(!pageReferfenceIdParam.isEmpty() || StringUtils.isNumeric(pageReferfenceIdParam.toString())){
			setPageReferenceId(pageReferfenceIdParam.toInteger());
		}
		
		getCustomerModel().setObject(customer);
	}
 
Example 11
Source Project: AppStash   Source File: DirectBuyRequestCycleListener.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onBeginRequest(RequestCycle cycle) {
    StringValue directBuyParameterValue = cycle.getRequest().getRequestParameters().getParameterValue(DIRECT_BUY_PARAMETER);
    if (!directBuyParameterValue.isEmpty()) {
        try {
            ProductInfo productInfo = productService.findByQuery(ProductQuery.create().withUrlname(directBuyParameterValue.toString()));
            if (productInfo != null) {
                cart.addItem(productInfo);
            } else {
                ShopSession.get().error(String.format("Das Product '%s' konnte nicht gefunden werden.", directBuyParameterValue));
            }
            Url urlWithoutDirectBuy = removeDirectBuyFromUrl(cycle);
            redirectTo(cycle, urlWithoutDirectBuy);
        } catch (Exception e) {
            ShopSession.get().error(DIRECT_BUY_PROCESSING_FAILED_MESSAGE);
            LOGGER.error(DIRECT_BUY_PROCESSING_FAILED_MESSAGE, e);
        }
    }
}
 
Example 12
/**
 * @param id
 */
@SuppressWarnings("serial")
public MenuConfig(final String id, final Menu menu, final FavoritesMenu favoritesMenu)
{
  super(id);
  configureLink = new WebMarkupContainer("configureLink");
  add(configureLink);
  configureBehavior = new AbstractDefaultAjaxBehavior() {
    @Override
    protected void respond(final AjaxRequestTarget target)
    {
      final Request request = RequestCycle.get().getRequest();
      final StringValue configuration = request.getPostParameters().getParameterValue("configuration");
      final String xml = configuration.toString("");
      if (log.isDebugEnabled() == true) {
        log.debug(xml);
      }
      favoritesMenu.readFromXml(xml);
      favoritesMenu.storeAsUserPref();
    }
  };
  add(configureBehavior);
  add(new MenuConfigContent("content", menu));
}
 
Example 13
Source Project: inception   Source File: KnowledgeBasePage.java    License: Apache License 2.0 5 votes vote down vote up
public KnowledgeBasePage(PageParameters aPageParameters) {
    super(aPageParameters);

    User user = userRepository.getCurrentUser();

    // Project has been specified when the page was opened
    Project project = null;
    StringValue projectParam = aPageParameters.get(PAGE_PARAM_PROJECT_ID);
    if (!projectParam.isEmpty()) {
        long projectId = projectParam.toLong();
        try {
            project = projectService.getProject(projectId);
            
            // Check access to project
            if (!projectService.isAnnotator(project, user)) {
                error("You have no permission to access project [" + project.getId() + "]");
                abort();
            }
        }
        catch (NoResultException e) {
            error("Project [" + projectId + "] does not exist");
            abort();
        }
    }

    // If a KB id was specified in the URL, we try to get it
    KnowledgeBase kb = null;
    String kbName = aPageParameters.get("kb").toOptionalString();
    if (project != null && kbName != null) {
        kb = kbService.getKnowledgeBaseByName(project, kbName).orElse(null);
    }

    commonInit(project, kb);
}
 
Example 14
Source Project: inception   Source File: DocumentDetailsPage.java    License: Apache License 2.0 5 votes vote down vote up
public DocumentDetailsPage(PageParameters aParameters)
{
    StringValue repositoryIdStringValue = aParameters.get(REPOSITORY_ID);
    StringValue collectionIdStringValue = aParameters.get(COLLECTION_ID);
    StringValue documentIdStringValue = aParameters.get(DOCUMENT_ID);

    if (
            repositoryIdStringValue == null || 
            documentIdStringValue == null || 
            collectionIdStringValue == null
    ) {
        abort();
    }
    
    repo = externalSearchService.getRepository(repositoryIdStringValue.toLong());
    collectionId = collectionIdStringValue.toString();
    documentId = documentIdStringValue.toString();        
    
    // Check access to project
    User currentUser = userRepository.getCurrentUser();
    if (!projectService.isAnnotator(repo.getProject(), currentUser)) {
        abort();
    }
    
    add(new Label("title", LoadableDetachableModel.of(this::getDocumentResult).map(
        r -> r.getDocumentTitle() != null ? r.getDocumentTitle() : r.getDocumentId())));
    add(new Label("text", LoadableDetachableModel.of(this::getDocumentText)));
}
 
Example 15
Source Project: onedev   Source File: RestartResponseAtInterceptPageException.java    License: MIT License 5 votes vote down vote up
/**
 * @return the post parameters of thе request when the interception happened
 * or {@code null} if there was no interception yet
 */
public static Map<String, List<StringValue>> getOriginalPostParameters()
{
	Map<String, List<StringValue>> postParameters = null;
	InterceptData data = InterceptData.get();
	if (data != null)
	{
		postParameters = data.getPostParameters();
	}
	return postParameters;
}
 
Example 16
Source Project: onedev   Source File: RestartResponseAtInterceptPageException.java    License: MIT License 5 votes vote down vote up
public static void set()
{
	Session session = Session.get();
	session.bind();
	InterceptData data = new InterceptData();
	Request request = RequestCycle.get().getRequest();
	data.originalUrl = request.getOriginalUrl();
	data.originalUrl.setHost(null);
	data.originalUrl.setPort(null);
	data.originalUrl.setProtocol(null);
	
	Iterator<QueryParameter> itor = data.originalUrl.getQueryParameters().iterator();
	while (itor.hasNext())
	{
		QueryParameter parameter = itor.next();
		String parameterName = parameter.getName();
		if (WebRequest.PARAM_AJAX.equals(parameterName) ||
			WebRequest.PARAM_AJAX_BASE_URL.equals(parameterName) ||
			WebRequest.PARAM_AJAX_REQUEST_ANTI_CACHE.equals(parameterName))
		{
			itor.remove();
		}
	}

	data.postParameters = new HashMap<String, List<StringValue>>();
	for (String s : request.getPostParameters().getParameterNames())
	{
		if (WebRequest.PARAM_AJAX.equals(s) || WebRequest.PARAM_AJAX_BASE_URL.equals(s) ||
			WebRequest.PARAM_AJAX_REQUEST_ANTI_CACHE.equals(s))
		{
			continue;
		}
		data.postParameters.put(s, new ArrayList<StringValue>(request.getPostParameters()
			.getParameterValues(s)));
	}
	session.setMetaData(key, data);
}
 
Example 17
Source Project: onedev   Source File: FormComponent.java    License: MIT License 5 votes vote down vote up
/**
 * Gets the request parameters for this component as strings.
 * 
 * @return The values in the request for this component
 */
public String[] getInputAsArray()
{
	List<StringValue> list = getRequest().getRequestParameters().getParameterValues(
		getInputName());

	String[] values = null;
	if (list != null)
	{
		values = new String[list.size()];
		for (int i = 0; i < list.size(); ++i)
		{
			values[i] = list.get(i).toString();
		}
	}

	if (!isInputNullable())
	{
		if (values != null && values.length == 1 && values[0] == null)
		{
			// we the key got passed in (otherwise values would be null),
			// but the value was set to null.
			// As the servlet spec isn't clear on what to do with 'empty'
			// request values - most return an empty string, but some null -
			// we have to workaround here and deliberately set to an empty
			// string if the the component is not nullable (text components)
			return EMPTY_STRING_ARRAY;
		}
	}
	return values;
}
 
Example 18
Source Project: the-app   Source File: CartRequestCycleListener.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onBeginRequest(RequestCycle cycle) {
    StringValue cartParameterValue = cycle.getRequest().getRequestParameters().getParameterValue(CART_PARAMETER);
    if (!cartParameterValue.isEmpty()) {
        try {
            selectedRedisMicroserviceCart();
            cart.setCartId(cartParameterValue.toString());
            LOGGER.info(String.format("Session '%s' set cart '%s'", ShopSession.get().getId(), cartParameterValue.toString()));
        } catch (Exception e) {
            LOGGER.error("Cart processing failed:", e);
        }
    }
}
 
Example 19
Source Project: the-app   Source File: ProductDetailPage.java    License: Apache License 2.0 5 votes vote down vote up
private LoadableDetachableModel<ProductInfo> getProductInfoModelByUrlName(final PageParameters pageParameters) {
    return new LoadableDetachableModel<ProductInfo>() {
        @Override
        protected ProductInfo load() {
            StringValue value = pageParameters.get("urlname");
            return productService.findByUrlname(value.toString());
        }
    };
}
 
Example 20
Source Project: yes-cart   Source File: WicketUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Get the filtered request parameters that does not
 * not contain given key and value.
 *
 * @param parameters original request parameters
 * @param key        key part to remove
 * @param value      value part to remove
 * @return new filtered {@link PageParameters}
 */
public PageParameters getFilteredRequestParameters(final PageParameters parameters,
                                                          final String key,
                                                          final String value) {
    final PageParameters rez = getFilteredRequestParameters(parameters);
    final List<StringValue> vals = rez.getValues(key);
    if (vals.size() > 0) {
        rez.remove(key, value);
    } else {
        rez.remove(key);
    }
    return rez;
}
 
Example 21
Source Project: yes-cart   Source File: WicketUtilTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testGetFilteredRequestParametersForSearch() {
    PageParameters parametersToFilter = new PageParameters()
        .add("query", "val1")
        .add("query", "val2")
        .add("query", "val3");
    assertEquals(1, parametersToFilter.getNamedKeys().size());
    assertEquals(3, parametersToFilter.getValues("query").size());
    parametersToFilter.remove("query", "val2");
    assertEquals(2, parametersToFilter.getValues("query").size());
    for (StringValue val : parametersToFilter.getValues("query")) {
        assertFalse("val2".equals(val.toString()));
    }
}
 
Example 22
Source Project: openmeetings   Source File: ActivatePage.java    License: Apache License 2.0 5 votes vote down vote up
public ActivatePage(PageParameters pp) {
	StringValue userHash = pp.get(ACTIVATION_PARAM);
	if (!userHash.isEmpty()) {
		User user = userDao.getByActivationHash(userHash.toString());

		if (user != null && !AuthLevelUtil.hasLoginLevel(user.getRights())) {
			// activate
			user.getRights().add(Right.LOGIN);
			user.setActivatehash(null);
			userDao.update(user, user.getId());
		}
	}
	setResponsePage(Application.get().getSignInPageClass());
}
 
Example 23
Source Project: openmeetings   Source File: BasePage.java    License: Apache License 2.0 5 votes vote down vote up
protected OmUrlFragment getUrlFragment(IRequestParameters params) {
	for (AreaKeys key : AreaKeys.values()) {
		StringValue type = params.getParameterValue(key.name());
		if (!type.isEmpty()) {
			return new OmUrlFragment(key, type.toString());
		}
	}
	return null;
}
 
Example 24
Source Project: openmeetings   Source File: WebSession.java    License: Apache License 2.0 5 votes vote down vote up
public void checkToken(StringValue intoken) {
	Optional<InstantToken> token = cm.getToken(intoken);
	if (token.isPresent()) {
		invalidateNow();
		signIn(userDao.get(token.get().getUserId()));
		log.debug("Cluster:: Token for room {} is found, signedIn ? {}", token.get().getRoomId(), userId != null);
		area = RoomEnterBehavior.getRoomUrlFragment(token.get().getRoomId());
	}
}
 
Example 25
@Override
public IResource getResource() {
	return new FileSystemResource() {
		private static final long serialVersionUID = 1L;

		@Override
		protected String getMimeType() throws IOException {
			return "text/css";
		}

		@Override
		protected ResourceResponse newResourceResponse(Attributes attr) {
			PageParameters params = attr.getParameters();
			StringValue idStr = params.get("id");
			Long id = null;
			try {
				id = idStr.toOptionalLong();
			} catch (NumberFormatException e) {
				//no-op expected
			}
			File file = getGroupCss(id, true);
			if (file != null) {
				ResourceResponse rr = createResourceResponse(attr, file.toPath());
				rr.setFileName(file.getName());
				return rr;
			} else {
				log.debug("Custom CSS was not found");
				return null;
			}
		}
	};
}
 
Example 26
Source Project: openmeetings   Source File: TestUserService.java    License: Apache License 2.0 5 votes vote down vote up
private Long getAndcheckHash(Long adminId) {
	ServiceResult r = login();
	String sid = r.getMessage();
	ServiceResult r1 = getHash(sid, false);
	assertEquals(Type.SUCCESS.name(), r1.getType(), "OM Call should be successful");
	WebSession ws = WebSession.get();
	ws.checkHashes(StringValue.valueOf(r1.getMessage()), StringValue.valueOf(""));
	assertTrue(ws.isSignedIn(), "Login via secure hash should be successful");
	Long userId = WebSession.getUserId();
	assertNotEquals(adminId, userId);
	User u = getBean(UserDao.class).get(userId);
	assertNotNull(u, "User should be created successfuly");
	assertEquals(DUMMY_PICTURE_URL, u.getPictureUri(), "Picture URL should be preserved");
	return userId;
}
 
Example 27
Source Project: openmeetings   Source File: TestPatcher.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void test() throws Exception {
	for (DbType dbType : DbType.values()) {
		ConnectionProperties props = ConnectionPropertiesPatcher.patch(dbType, HOST, PORT, DB, USER, PASS);
		assertEquals(dbType, props.getDbType(), "DB type should match");
		if (DbType.MYSQL == dbType) {
			Url url = Url.parse(props.getURL());
			PageParameters pp = new PageParametersEncoder().decodePageParameters(url);
			StringValue tz = pp.get("serverTimezone");
			assertEquals(TimeZone.getDefault().getID(), tz.toString(), "serverTimezone parameter is mandatory for MySql");
		}
	}
}
 
Example 28
Source Project: openmeetings   Source File: MysqlPatcher.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected String getUrl(String inUrl, String host, String inPort, String inDb) {
	Url url = Url.parse(inUrl);
	url.setHost(host);
	url.setPort((inPort == null) ? 3306 : Integer.valueOf(inPort));
	url.getSegments().set(1, (inDb == null) ? DEFAULT_DB_NAME : inDb);
	PageParameters pp = new PageParametersEncoder().decodePageParameters(url);
	StringValue tz = pp.get(TZ_PARAM);
	if (tz.isEmpty()) {
		url.setQueryParameter(TZ_PARAM, TimeZone.getDefault().getID());
	}
	return url.toString(Url.StringMode.FULL);
}
 
Example 29
Source Project: webanno   Source File: CurationPage.java    License: Apache License 2.0 5 votes vote down vote up
public CurationPage(final PageParameters aPageParameters)
{
    super(aPageParameters);
    LOG.debug("Setting up curation page with parameters: {}", aPageParameters);
    
    commonInit();

    StringValue project = aPageParameters.get(PAGE_PARAM_PROJECT_ID);
    StringValue document = aPageParameters.get(PAGE_PARAM_DOCUMENT_ID);
    StringValue focus = aPageParameters.get(PAGE_PARAM_FOCUS);
    
    handleParameters(null, project, document, focus, true);
}
 
Example 30
Source Project: webanno   Source File: CurationPage.java    License: Apache License 2.0 5 votes vote down vote up
private Project getProjectFromParameters(StringValue projectParam)
{
    Project project = null;
    if (projectParam != null && !projectParam.isEmpty()) {
        long projectId = projectParam.toLong();
        project = projectService.getProject(projectId);
    }
    return project;
}