本文整理汇总了Java中org.apache.wicket.util.string.StringValue类的典型用法代码示例。如果您正苦于以下问题:Java StringValue类的具体用法?Java StringValue怎么用?Java StringValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringValue类属于org.apache.wicket.util.string包,在下文中一共展示了StringValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AllFacetValuesPage
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
public AllFacetValuesPage(PageParameters params) {
super(params);
this.selectionModel = Model.of(parametersConverter.fromParameters(params));
final StringValue facetValue = params.get(SELECTED_FACET_PARAM);
if (facetValue.isEmpty()) {
Session.get().error("No facet provided for all values page");
throw new RestartResponseException(new FacetedSearchPage(selectionModel));
}
final String facet = facetParamMapper.getFacet(facetValue.toString());
if (vloConfig.getFacetsInSearch().contains(facet)) {
// create a new model so that all values will be retrieved
setModel(new FacetFieldModel(facet, facetFieldsService, selectionModel)); // gets all facet values
}
if (getModelObject() == null) {
Session.get().error(String.format("Facet '%s' could not be found", facet));
ErrorPage.triggerErrorPage(ErrorPage.ErrorType.PAGE_NOT_FOUND, params);
}
addComponents();
}
示例2: processTheme
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
/**
* Sets the theme from the page parameters if applicable. An present but
* empty theme value will reset the theme (by unsetting the style).
*
* @param parameters page parameters to process
* @see VloWebAppParameters#THEME
* @see Session#setStyle(java.lang.String)
*/
private void processTheme(PageParameters parameters) {
final StringValue themeValue = parameters.get(VloWebAppParameters.THEME);
if (!themeValue.isNull()) {
if (themeValue.isEmpty()) {
// empty string resets theme
logger.debug("Resetting theme");
Session.get().setStyle(null);
} else {
// theme found, set it as style in the session
final String theme = themeValue.toString().toLowerCase();
logger.debug("Setting theme to {}", theme);
Session.get().setStyle(theme);
}
/*
* Remove theme parameter to prevent it from interfering with
* further processing, specifically the parameters check in
* the simple page search
*/
parameters.remove(VloWebAppParameters.THEME, themeValue.toString());
}
}
示例3: loadTasksSearchDto
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
private TasksSearchDto loadTasksSearchDto() {
TasksStorage storage = getSessionStorage().getTasks();
TasksSearchDto dto = storage.getTasksSearch();
if (dto == null) {
dto = new TasksSearchDto();
dto.setShowSubtasks(false);
}
if (getPageParameters() != null) {
StringValue category = getPageParameters().get(SELECTED_CATEGORY);
if (category != null && category.toString() != null && !category.toString().isEmpty()) {
dto.setCategory(category.toString());
}
}
if (dto.getStatus() == null) {
dto.setStatus(TaskDtoExecutionStatusFilter.ALL);
}
return dto;
}
示例4: onBeforeRender
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
@Override
protected void onBeforeRender() {
super.onBeforeRender();
if (!initialized) {
PageParameters params = getPageParameters();
StringValue val = params.get(SELECTED_TAB_INDEX);
String value = null;
if (val != null && !val.isNull()) {
value = val.toString();
}
int index = StringUtils.isNumeric(value) ? Integer.parseInt(value) : CONFIGURATION_TAB_BASIC;
getTabPanel().setSelectedTab(index);
initialized = true;
}
}
示例5: loadReport
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
private ReportDto loadReport() {
StringValue reportOid = getPageParameters().get(OnePageParameterEncoder.PARAMETER);
Task task = createSimpleTask(OPERATION_LOAD_REPORT);
OperationResult result = task.getResult();
PrismObject<ReportType> prismReport = WebModelServiceUtils.loadObject(ReportType.class, reportOid.toString(),
this, task, result);
if (prismReport == null) {
LOGGER.error("Couldn't load report.");
throw new RestartResponseException(PageReports.class);
}
return new ReportDto(prismReport.asObjectable());
// return prismReport;
}
示例6: getOidFromParameter
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
private String getOidFromParameter(PageParameters params){
if (params == null || params.isEmpty()) {
LOGGER.error("No page paraeters found for account activation. No user to activate his/her accounts");
return null;
}
StringValue userValue = params.get(SchemaConstants.USER_ID);
if (userValue == null || userValue.isEmpty()) {
LOGGER.error("No user defined in the page parameter. Expected user=? attribute filled but didmn't find one.");
return null;
}
return userValue.toString();
}
示例7: fromParameters
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
@Override
public QueryFacetsSelection fromParameters(PageParameters params) {
// Get query string from params
final String query = params.get(QUERY).toOptionalString();
final List<StringValue> facetSelectionTypes = params.getValues(FILTER_QUERY_TYPE);
final List<StringValue> facetValues = params.getValues(FILTER_QUERY);
final HashMap<String, FacetSelection> selection = Maps.newHashMapWithExpectedSize(facetValues.size());
// Get selection type from params
for (StringValue selectionType : facetSelectionTypes) {
if (!selectionType.isEmpty()) {
applySelectionTypeFromParameter(selectionType, selection);
}
}
// Get facet selections from params
for (StringValue facetValue : facetValues) {
if (!facetValue.isEmpty()) {
applyFacetValueFromParameter(facetValue, selection);
}
}
return new QueryFacetsSelection(query, selection);
}
示例8: applySelectionTypeFromParameter
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
private void applySelectionTypeFromParameter(StringValue selectionType, final HashMap<String, FacetSelection> selection) {
final List<String> fqType = FILTER_SPLITTER.splitToList(selectionType.toString());
if (fqType.size() == 2) {
final String facet = facetParamMapper.getFacet(fqType.get(0));
final String type = fqType.get(1).toUpperCase();
if (isAllowedFacetName(facet)) {
try {
final FacetSelectionType facetSelectionType = FacetSelectionType.valueOf(type);
selection.put(facet, new FacetSelection(facetSelectionType));
} catch (IllegalArgumentException ex) {
logger.warn("Unknown selection type passed into query parameter {}: {}", FILTER_QUERY_TYPE, type);
}
}
} else {
logger.info("Illegal query parameter value for {}: {}", FILTER_QUERY_TYPE, selectionType);
}
}
示例9: encodePageParameters
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
@Override
protected Url encodePageParameters(Url url, PageParameters pageParameters, IPageParametersEncoder encoder) {
//get special page parameter that encodes the page fragment/anchor
final StringValue fragment = pageParameters.get(FRAGMENT_PAGE_PARAMETER);
if (fragment.isEmpty()) {
//business as usual
return super.encodePageParameters(url, pageParameters, encoder);
} else {
//we have a fragment parameter, remove from normal parameters and do post-processing
pageParameters.remove(FRAGMENT_PAGE_PARAMETER);
final Url result = super.encodePageParameters(url, pageParameters, encoder);
//set the fragment on the resulting URL
result.setFragment(fragment.toString());
return result;
}
}
示例10: testToParameters
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
/**
* Test of toParameters method, of class
* QueryFacetsSelectionParametersConverter.
*/
@Test
public void testToParameters() {
final String query = "query";
final Map<String, FacetSelection> map = Maps.newHashMapWithExpectedSize(3);
map.put("facet1", new FacetSelection(FacetSelectionType.OR, Arrays.asList("valueA", "valueB")));
map.put("facet2", new FacetSelection(FacetSelectionType.AND, Collections.singleton("value:C")));
map.put("facet3", new FacetSelection(FacetSelectionType.NOT_EMPTY));
QueryFacetsSelection selection = new QueryFacetsSelection(query, map);
PageParameters result = instance.toParameters(selection);
assertThat(result.get("q"), equalTo(StringValue.valueOf("query")));
final List<StringValue> fq = result.getValues("fq");
assertNotNull(fq);
assertThat(fq, hasItem(StringValue.valueOf("facet1:valueA")));
assertThat(fq, hasItem(StringValue.valueOf("facet1:valueB")));
assertThat(fq, hasItem(StringValue.valueOf("facet2:value:C")));
final List<StringValue> fqType = result.getValues("fqType");
assertNotNull(fqType);
assertThat(fqType, hasItem(StringValue.valueOf("facet1:or")));
//facet 2 is AND, which is default and should not be encoded
assertThat(fqType, hasItem(StringValue.valueOf("facet3:not_empty")));
}
示例11: getFileItem
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
@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;
}
示例12: respond
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
@Override
protected void respond(AjaxRequestTarget target) {
try {
String uid = getRequest().getRequestParameters().getParameterValue(PARAM_UID).toString();
if (Strings.isEmpty(uid)) {
return;
}
Client.Activity a = Client.Activity.valueOf(getRequest().getRequestParameters().getParameterValue(PARAM_ACTIVITY).toString());
StringValue podStr = getRequest().getRequestParameters().getParameterValue(PARAM_POD);
Pod pod = podStr.isEmpty() ? Pod.none : Pod.valueOf(podStr.toString());
Client c = getOnlineClient(uid);
toggleActivity(c, a, pod);
} catch (Exception e) {
log.error("Unexpected exception while toggle 'activity'", e);
}
}
示例13: actionDoAction
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
private Object actionDoAction(AjaxRequestTarget aTarget, IRequestParameters request, JCas jCas,
VID paramId)
throws IOException
{
StringValue layerParam = request.getParameterValue(PARAM_SPAN_TYPE);
if (!layerParam.isEmpty()) {
long layerId = Long.parseLong(layerParam.beforeFirst('_'));
AnnotationLayer layer = annotationService.getLayer(layerId);
if (!StringUtils.isEmpty(layer.getOnClickJavascriptAction())) {
// parse the action
List<AnnotationFeature> features = annotationService.listAnnotationFeature(layer);
AnnotationFS anno = WebAnnoCasUtil.selectByAddr(jCas, paramId.getId());
Map<String, Object> functionParams = OnClickActionParser.parse(layer, features,
getModelObject().getDocument(), anno);
// define anonymous function, fill the body and immediately execute
String js = String.format("(function ($PARAM){ %s })(%s)",
layer.getOnClickJavascriptAction(), JSONUtil.toJsonString(functionParams));
aTarget.appendJavaScript(js);
}
}
return null;
}
示例14: setDefaultResponsePageIfNecessary
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
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);
}
}
示例15: AnnotationPage
import org.apache.wicket.util.string.StringValue; //导入依赖的package包/类
public AnnotationPage()
{
super();
LOG.debug("Setting up annotation 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);
}
}