Example usage for org.apache.wicket.util.string StringValue toString

List of usage examples for org.apache.wicket.util.string StringValue toString

Introduction

In this page you can find the example usage for org.apache.wicket.util.string StringValue toString.

Prototype

@Override
public final String toString() 

Source Link

Usage

From source file:org.apache.openmeetings.web.room.SwfPanel.java

License:Apache License

public String getInitFunction(PageParameters pp) {
    String initStr = null;//  w  ww . j  av  a 2  s  .  com
    StringValue type = pp.get(SWF);
    String swf = getFlashFile(type);
    if (!Strings.isEmpty(swf)) {
        String lbls = null;
        if (SWF_TYPE_NETWORK.equals(type.toString())) {
            lbls = getStringLabels("network.test.ms", "network.test.mb", "network.test.sec",
                    "network.test.click.play", "network.test.copy.log", "network.test.report",
                    "network.test.report.start", "network.test.report.error", "network.test.report.con.err",
                    "network.test.ping", "network.test.ping.avg", "network.test.ping.rcv",
                    "network.test.ping.lost", "network.test.ping.load", "network.test.port",
                    "network.test.port.avail", "network.test.port.stopped", "network.test.jitter",
                    "network.test.jitter.avg", "network.test.jitter.min", "network.test.jitter.max",
                    "network.test.dwn", "network.test.dwn.bytes", "network.test.dwn.time",
                    "network.test.dwn.speed", "network.test.upl", "network.test.upl.bytes",
                    "network.test.upl.time", "network.test.upl.speed");
        } else if (SWF_TYPE_SETTINGS.equals(type.toString())) {
            lbls = getStringLabels("448", "449", "450", "451", "758", "447", "52", "53", "1429", "1430", "775",
                    "452", "767", "764", "765", "918", "54", "761", "762", "144", "203", "642", "save.success");
        }
        initStr = String.format("var labels = %s; initSwf(%s);", lbls, new JSONObject()
                .put("src", swf + new PageParametersEncoder().encodePageParameters(pp)).toString());
    }
    return initStr;
}

From source file:org.apache.openmeetings.web.room.SwfPanel.java

License:Apache License

private String getFlashFile(StringValue type) {
    String fmt = "main%s.swf11.swf";
    if (SWF_TYPE_NETWORK.equals(type.toString())) {
        fmt = "networktesting%s.swf10.swf";
    }/*from w  ww.ja v  a 2  s .c o  m*/
    return String.format(fmt, DEVELOPMENT == getApplication().getConfigurationType() ? "debug" : "");
}

From source file:org.apache.openmeetings.web.user.record.RecordingResourceReference.java

License:Apache License

@Override
protected Recording getFileItem(Attributes attributes) {
    PageParameters params = attributes.getParameters();
    StringValue _id = params.get("id");
    Long id = null;/* w  w  w  . j  av a2 s  .  co m*/
    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);
    }
    return null;
}

From source file:org.apache.openmeetings.web.user.rooms.RoomPanel.java

License:Apache License

public RoomPanel(String id, PageParameters pp) {
    super(id);/*from w  w  w  .ja  v  a 2s  .co m*/

    StringValue swfVal = pp.get("swf");
    String swf = (swfVal.isEmpty() ? getFlashFile() : swfVal.toString())
            + new PageParametersEncoder().encodePageParameters(pp);
    add(new Label("init", String.format("initSwf('%s');", swf)).setEscapeModelStrings(false));
}

From source file:org.apache.openmeetings.web.util.BaseUrlAjaxBehavior.java

License:Apache License

@Override
protected void respond(AjaxRequestTarget target) {
    StringValue url = getComponent().getRequestCycle().getRequest().getRequestParameters()
            .getParameterValue("baseUrl");
    String baseUrl = url.toString();
    int index = baseUrl.indexOf('#');
    if (index > 0) {
        baseUrl = baseUrl.substring(0, index);
    }//from w  w w  . j  a v a  2s .  c o  m
    index = baseUrl.indexOf('?');
    if (index > 0) {
        baseUrl = baseUrl.substring(0, baseUrl.lastIndexOf('/') + 1);
    }
    WebSession.get().setBaseUrl(baseUrl);
}

From source file:org.apache.openmeetings.web.util.RecordingResourceReference.java

License:Apache License

private FlvRecording getRecording(Attributes attributes) {
    PageParameters params = attributes.getParameters();
    StringValue idStr = params.get("id");
    Long id = getLong(idStr);//from   ww w. j a  v  a  2s.  c  o  m
    WebSession ws = WebSession.get();
    if (id != null && ws.isSignedIn()) {
        return getRecording(id);
    } else {
        ws.invalidate();
        if (ws.signIn(idStr.toString())) {
            return getRecording(getRecordingId());
        }
    }
    return null;
}

From source file:org.apache.syncope.client.console.pages.ModelerPopupPage.java

License:Apache License

public ModelerPopupPage(final PageParameters parameters) {
    super(parameters);

    StringValue modelId = parameters.get(Constants.MODEL_ID_PARAM);

    WebMarkupContainer refresh = new WebMarkupContainer("refresh");
    // properly parameterize ?modelId=5 with SYNCOPE-1020
    refresh.add(new AttributeModifier("content", "0; url=../../" + parameters.get(Constants.MODELER_CONTEXT)
            + "/index.html#/editor/" + modelId.toString()));
    add(refresh);//from www .  j av a  2 s.  c o  m
}

From source file:org.apache.syncope.client.console.resources.AbstractWorkflowResource.java

License:Apache License

protected WorkflowDefinitionTO getWorkflowDefinition(final Attributes attributes) {
    final StringValue modelId = attributes.getRequest().getQueryParameters()
            .getParameterValue(Constants.MODEL_ID_PARAM);

    WorkflowDefinitionTO workflowDefinition = modelId == null || modelId.isNull() ? null
            : restClient.getDefinitions().stream()
                    .filter(object -> modelId.toString().equals(object.getModelId())).findAny().orElse(null);
    if (workflowDefinition == null) {
        throw new NotFoundException("Workflow definition with modelId " + modelId);
    }/* w  ww .  ja  v  a  2 s  .  co  m*/

    return workflowDefinition;
}

From source file:org.apache.syncope.client.enduser.resources.SecurityQuestionByUsernameResource.java

License:Apache License

@Override
protected AbstractResource.ResourceResponse newResourceResponse(final IResource.Attributes attributes) {
    LOG.debug("List available security questions");

    ResourceResponse response = new AbstractResource.ResourceResponse();
    response.setContentType(MediaType.APPLICATION_JSON);
    try {/*from   www  .  jav a2s.c  om*/
        HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest();

        if (!xsrfCheck(request)) {
            LOG.error("XSRF TOKEN does not match");
            response.setError(Response.Status.BAD_REQUEST.getStatusCode(), "XSRF TOKEN does not match");
            return response;
        }

        PageParameters parameters = attributes.getParameters();
        StringValue username = parameters.get("username");
        if (!username.isEmpty()) {
            final SecurityQuestionTO securityQuestionTO = SyncopeEnduserSession.get()
                    .getService(SecurityQuestionService.class).readByUser(username.toString());
            response.setWriteCallback(new AbstractResource.WriteCallback() {

                @Override
                public void writeData(final IResource.Attributes attributes) throws IOException {
                    attributes.getResponse().write(MAPPER.writeValueAsString(securityQuestionTO));
                }
            });
        }

        response.setContentType(MediaType.APPLICATION_JSON);
        response.setTextEncoding(StandardCharsets.UTF_8.name());
        response.setStatusCode(Response.Status.OK.getStatusCode());
    } catch (Exception e) {
        LOG.error("Error retrieving security questions", e);
        response.setError(Response.Status.BAD_REQUEST.getStatusCode(),
                new StringBuilder().append("ErrorMessage{{ ").append(e.getMessage()).append(" }}").toString());
    }

    return response;
}

From source file:org.apache.syncope.client.enduser.resources.SecurityQuestionResource.java

License:Apache License

@Override
protected AbstractResource.ResourceResponse newResourceResponse(final IResource.Attributes attributes) {

    LOG.debug("List available security questions");

    AbstractResource.ResourceResponse response = new AbstractResource.ResourceResponse();

    try {//from   www.ja  v  a2  s .  co m

        HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest();

        if (!xsrfCheck(request)) {
            LOG.error("XSRF TOKEN does not match");
            response.setError(Response.Status.BAD_REQUEST.getStatusCode(), "XSRF TOKEN does not match");
            return response;
        }

        PageParameters parameters = attributes.getParameters();
        StringValue username = parameters.get("username");
        //if the username is defined then retrieve its security questions, otherwise retrieve all security questions
        if (!username.isEmpty()) {
            final SecurityQuestionTO securityQuestionTO = securityQuestionService
                    .readByUser(username.toString());

            response.setWriteCallback(new AbstractResource.WriteCallback() {

                @Override
                public void writeData(final IResource.Attributes attributes) throws IOException {
                    attributes.getResponse().write(MAPPER.writeValueAsString(securityQuestionTO));
                }
            });
        } else {
            final List<SecurityQuestionTO> securityQuestionTOs = securityQuestionService.list();

            response.setWriteCallback(new AbstractResource.WriteCallback() {

                @Override
                public void writeData(final IResource.Attributes attributes) throws IOException {
                    attributes.getResponse().write(MAPPER.writeValueAsString(securityQuestionTOs));
                }
            });
        }

        response.setStatusCode(Response.Status.OK.getStatusCode());
    } catch (Exception e) {
        LOG.error("Error retrieving security questions", e);
        response.setError(Response.Status.BAD_REQUEST.getStatusCode(),
                new StringBuilder().append("ErrorMessage{{ ").append(e.getMessage()).append(" }}").toString());
    }

    return response;
}