Example usage for java.lang Boolean valueOf

List of usage examples for java.lang Boolean valueOf

Introduction

In this page you can find the example usage for java.lang Boolean valueOf.

Prototype

public static Boolean valueOf(String s) 

Source Link

Document

Returns a Boolean with a value represented by the specified string.

Usage

From source file:nz.net.catalyst.mobile.dds.CapabilityServiceTest.java

/**
 * test for different value type, string, integer and boolean
 *//*from   w  ww. ja  v  a 2 s  .c  o m*/
@Test
public void testGetValues() {
    Map<String, Object> capabilitiesMap = cs.getCapabilitiesForDevice(requestInfo,
            Arrays.asList(new String[] { "device_id", "model_name", "resolution_width", "is_tablet" }));
    assertEquals(new Integer(352), (Integer) capabilitiesMap.get("resolution_width"));
    assertEquals("N90", (String) capabilitiesMap.get("model_name"));
    assertEquals(Boolean.valueOf(false), (Boolean) capabilitiesMap.get("is_tablet"));
}

From source file:org.jasig.portlet.announcements.controller.ApproveAjaxController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    Long annId = Long.valueOf(request.getParameter("annId"));
    Boolean approval = Boolean.valueOf(request.getParameter("approval"));
    Announcement ann = announcementService.getAnnouncement(annId);

    Date startDisplay = ann.getStartDisplay();
    Date endDisplay = ann.getEndDisplay();
    if (endDisplay == null) {
        // Unspecified end date means the announcement does not expire;  we 
        // will substitute a date in the future each time this item is 
        // evaluated.
        long aYearFromNow = System.currentTimeMillis() + Announcement.MILLISECONDS_IN_A_YEAR;
        endDisplay = new Date(aYearFromNow);
    }//from w  w w . j  a  v a 2  s  .  c  o  m

    Date now = new Date();
    int status = 3;
    /**
     * Scheduled = 0
     * Expired   = 1
     * Showing   = 2
     * Pending   = 3
     */
    if (startDisplay.after(now) && endDisplay.after(now) && approval) {
        status = 0;
    } else if (startDisplay.before(now) && endDisplay.after(now) && approval) {
        status = 2;
    } else if (endDisplay.before(now)) {
        status = 1;
    }

    ann.setPublished(approval);
    cm.getCacheManager().getCache("guestAnnouncementCache").flush();

    announcementService.addOrSaveAnnouncement(ann);

    return new ModelAndView("ajaxApprove", "status", status);

}

From source file:co.com.soinsoftware.altablero.bll.ClassRoomBLL.java

public boolean isValidCode(final int idSchool, final int idClassRoom, final String code) throws IOException {
    final String method = MODULE_CLASSROOM + PATH_VALIDATE;
    final StringBuilder urlMethod = new StringBuilder(method);
    urlMethod.append(buildRequestParameter(ADD_PARAMETERS, PARAMETER_SCHOOL_ID, idSchool));
    urlMethod.append(buildRequestParameter(CONCAT, PARAMETER_CODE, code));
    urlMethod.append(buildRequestParameter(CONCAT, PARAMETER_CLASSROOM_ID, idClassRoom));
    final String response = (String) httpRequest.sendGet(urlMethod.toString());
    return Boolean.valueOf(response);
}

From source file:com.fujitsu.dc.engine.rs.DebugResource.java

/**
 * ./*from   w w w  .  j a  v  a2  s  .c  o m*/
 * @param useDebug JavaScript ????????
 * @throws DcEngineException DcEngine
 */
public DebugResource(@QueryParam("useScriptDebug") final String useDebug) throws DcEngineException {
    // http://xxx/yy?useScriptDebug=true ?????useScriptDebug????useDebug?
    super();
    this.useScriptDebug = Boolean.valueOf(useDebug);
    log.info("Create DebugResource. useScriptDebug=" + this.useScriptDebug);
}

From source file:com.blacklocus.qs.worker.aws.AmazonEC2WorkerIdService.java

@Override
public String getWorkerId() {
    String id = ec2id.get();//  ww w. jav a  2  s.  c  o m

    if (null == id) {
        if (!Boolean.valueOf(System.getProperty(PROP_SKIP_EC2_META, "false"))) {
            id = EC2MetadataUtils.getInstanceId();
            ec2id.set(id);
        }
    }

    // Maybe ec2 meta was disabled, maybe it failed. Whatever: fall back.
    if (StringUtils.isBlank(id)) {
        id = fallback.getWorkerId();
    }

    return id;
}

From source file:com.msopentech.odatajclient.engine.data.metadata.edm.FunctionImportDeserializer.java

@Override
public FunctionImport deserialize(final JsonParser jp, final DeserializationContext ctxt)
        throws IOException, JsonProcessingException {

    final FunctionImport funcImp = new FunctionImport();

    for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
        final JsonToken token = jp.getCurrentToken();
        if (token == JsonToken.FIELD_NAME) {
            if ("Name".equals(jp.getCurrentName())) {
                funcImp.setName(jp.nextTextValue());
            } else if ("ReturnType".equals(jp.getCurrentName())) {
                funcImp.setReturnType(jp.nextTextValue());
            } else if ("EntitySet".equals(jp.getCurrentName())) {
                funcImp.setEntitySet(jp.nextTextValue());
            } else if ("EntitySetPath".equals(jp.getCurrentName())) {
                funcImp.setEntitySetPath(jp.nextTextValue());
            } else if ("IsComposable".equals(jp.getCurrentName())) {
                funcImp.setComposable(Boolean.valueOf(jp.nextTextValue()));
            } else if ("IsSideEffecting".equals(jp.getCurrentName())) {
                funcImp.setSideEffecting(Boolean.valueOf(jp.nextTextValue()));
            } else if ("IsBindable".equals(jp.getCurrentName())) {
                funcImp.setBindable(Boolean.valueOf(jp.nextTextValue()));
            } else if ("IsAlwaysBindable".equals(jp.getCurrentName())) {
                funcImp.setAlwaysBindable(Boolean.valueOf(jp.nextTextValue()));
            } else if ("HttpMethod".equals(jp.getCurrentName())) {
                funcImp.setHttpMethod(jp.nextTextValue());
            } else if ("Parameter".equals(jp.getCurrentName())) {
                jp.nextToken();/*w  w  w .j ava2  s. c  o m*/
                funcImp.getParameters().add(jp.getCodec().readValue(jp, Parameter.class));
            }
        }
    }

    return funcImp;
}

From source file:dpfmanager.shell.core.DPFManagerProperties.java

public static boolean getFirstTime() {
    String strVal = getPropertiesValue("firstTime", "true");
    return Boolean.valueOf(strVal);
}

From source file:ru.trett.cis.validators.DeviceModelValidator.java

public void validateModel(DeviceModel deviceModel, ValidationContext context) {
    RequestContext requestContext = RequestContextHolder.getRequestContext();
    Boolean exists = Boolean
            .valueOf(requestContext.getExternalContext().getRequestParameterMap().get("exists"));

    DeviceModel dm = inventoryService.getModelByTypeAndBrandAndModel(deviceModel.getDeviceType().getType(),
            deviceModel.getDeviceBrand().getBrand(), deviceModel.getModel());

    if (dm != null && !exists)
        context.getMessageContext().addMessage(new MessageBuilder().error().source("model").code("not.unique")
                .defaultText("Already present").build());
}

From source file:net.duckling.ddl.service.version.impl.VersionService.java

@Override
public Version get(String project, String type) {
    HttpClient dClient = new HttpClient();
    PostMethod method = new PostMethod(getDupdateUrl());
    method.setParameter("type", type);
    method.setParameter("project", project);
    try {//ww  w. j ava 2  s .  c o m
        dClient.executeMethod(method);
        String response = method.getResponseBodyAsString();
        Map<String, String> map = parseResponse(response);

        Version v = new Version();
        if (map.get("success").equals("true")) {
            v.setVersion(map.get("version"));
            v.setDownloadUrl(map.get("downloadUrl"));
            v.setForcedUpdate(Boolean.valueOf(map.get("forcedUpdate")));
            v.setDescription(map.get("description"));
            v.setCreateTime(map.get("createTime"));
        }
        v.setSuccess(Boolean.valueOf(map.get("success")));
        return v;
    } catch (HttpException e) {
        LOG.error("", e);
    } catch (IOException e) {
        LOG.error("", e);
    } catch (ParseException e) {
        LOG.error("", e);
    }
    return null;
}

From source file:com.devnexus.ting.web.controller.EvaluationController.java

private void prepareReferenceData(ModelMap model) {
    final String reCaptchaEnabled = environment.getProperty("recaptcha.enabled");
    final String recaptchaPublicKey = environment.getProperty("recaptcha.publicKey");
    final String recaptchaPrivateKey = environment.getProperty("recaptcha.privateKey");

    if (Boolean.valueOf(reCaptchaEnabled)) {
        ReCaptcha reCaptcha = ReCaptchaFactory.newReCaptcha(recaptchaPublicKey, recaptchaPrivateKey, false);
        Properties recaptchaProperties = new Properties();
        //recaptchaProperties.put("theme", "clean");
        model.addAttribute("reCaptchaHtml", reCaptcha.createRecaptchaHtml(null, recaptchaProperties));
    }/*w  w w  .j  a  va2s.  c  o  m*/

    model.addAttribute("reCaptchaEnabled", reCaptchaEnabled);

    final Event currentEvent = businessService.getCurrentEvent();
    model.addAttribute("currentEvent", currentEvent);

}