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:com.zanshang.services.author.AuthorVerifiedActor.java

@Override
public void onReceive(Object o) throws Exception {
    //o is uid/*  w  w w .j av  a2 s .  c o m*/
    Future<Object> askPerson = Patterns.ask(personActor, o.toString(), ActorConstant.DEFAULT_TIMEOUT);
    ActorRef sender = getSender();
    ActorRef self = getSelf();
    askPerson.onSuccess(new OnSuccess<Object>() {
        @Override
        public void onSuccess(Object personInformation) throws Throwable {
            if (personInformation != null) {
                Person information = (Person) personInformation;
                //                    if (StringUtils.isEmpty(information.getIdentityCode()) ||
                //                            StringUtils.isEmpty(information.getIdentityFront()) ||
                //                            StringUtils.isEmpty(information.getIdentityBack()) ||
                //                            StringUtils.isEmpty(information.getLegalName())) {
                //                        sender.tell(Boolean.FALSE, self);
                //                    } else {
                AuthorInformationIndexByIdentity byIdentity = getMongoTemplate()
                        .findById(information.getIdentityCode(), AuthorInformationIndexByIdentity.class);
                sender.tell(Boolean.valueOf(byIdentity != null), self);
                //                    }
            } else {
                Future<Object> askCompany = Patterns.ask(companyActor, o.toString(),
                        ActorConstant.DEFAULT_TIMEOUT);
                askCompany.onSuccess(new OnSuccess<Object>() {
                    @Override
                    public void onSuccess(Object companyInformation) throws Throwable {
                        if (companyInformation != null) {
                            Company information = (Company) companyInformation;
                            if (StringUtils.isEmpty(information.getCompanyCode())
                                    || StringUtils.isEmpty(information.getLicense())
                                    || StringUtils.isEmpty(information.getContactPhone())) {
                                sender.tell(Boolean.FALSE, self);
                            } else {
                                AuthorInformationIndexByIdentity byIdentity = getMongoTemplate().findById(
                                        information.getCompanyCode(), AuthorInformationIndexByIdentity.class);
                                sender.tell(Boolean.valueOf(byIdentity != null), self);
                            }
                        } else {
                            Exception exception = new Exception("Found user neither has Person information nor "
                                    + "Company " + "information:" + o);
                            sender.tell(new Status.Failure(exception), self);
                            throw exception;
                        }
                    }
                }, getContext().dispatcher());
            }
        }
    }, getContext().dispatcher());
}

From source file:gobblin.source.extractor.extract.kafka.ConfigStoreUtils.java

public static Optional<String> getConfigStoreUri(Properties properties) {
    Optional<String> configStoreUri = StringUtils
            .isNotBlank(properties.getProperty(ConfigurationKeys.CONFIG_MANAGEMENT_STORE_URI))
                    ? Optional.of(properties.getProperty(ConfigurationKeys.CONFIG_MANAGEMENT_STORE_URI))
                    : Optional.<String>absent();
    if (!Boolean.valueOf(properties.getProperty(ConfigurationKeys.CONFIG_MANAGEMENT_STORE_ENABLED,
            ConfigurationKeys.DEFAULT_CONFIG_MANAGEMENT_STORE_ENABLED))) {
        configStoreUri = Optional.<String>absent();
    }//from  w  w w .j av a 2  s .com
    return configStoreUri;
}

From source file:net.nan21.dnet.core.api.Settings.java

@Override
public boolean getAsBoolean(String key) {
    return Boolean.valueOf(this.get(key));
}

From source file:bg.neutrino.GoogleLogin.java

public User login() throws Exception {
    DeviceProperties dp = new DeviceProperties();
    String CLIENT_ID = dp.get().getProperty("google.oauth2.api.key");

    GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(transport, jacksonFactory)
            .setAudience(Collections.singletonList(CLIENT_ID))
            // Or, if multiple clients access the backend:
            // .setAudience(Arrays.asList(CLIENT_ID_1, CLIENT_ID_2,
            // CLIENT_ID_3))
            .build();/*from   www .  jav  a2  s. c o m*/

    // (Receive idTokenString by HTTPS POST)
    //System.out.println(idTokenString);

    GoogleIdToken idToken = null;
    try {
        idToken = verifier.verify(idTokenString);
    } catch (GeneralSecurityException | IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    if (idToken != null) {
        Payload payload = idToken.getPayload();

        // Print user identifier
        String userId = payload.getSubject();
        //System.out.println("User ID: " + userId);

        // Get profile information from payload
        String email = payload.getEmail();
        boolean emailVerified = Boolean.valueOf(payload.getEmailVerified());
        String name = (String) payload.get("name");
        String pictureUrl = (String) payload.get("picture");
        String locale = (String) payload.get("locale");
        String familyName = (String) payload.get("family_name");
        String givenName = (String) payload.get("given_name");

        User user = new User();
        user.setId(userId);
        user.setEmail(email);
        user.setName(name);
        user.setIsGuest(false);

        return user;

    } else {
        throw new Exception("Invalid ID token.");
    }
}

From source file:cn.bzvs.excel.imports.base.ImportBaseService.java

/**
 * ?//from   ww w.j  a  v  a2 s .  c o m
 * 
 * @param targetId
 * @param field
 * @param excelEntity
 * @param pojoClass
 * @param getMethods
 * @param temp
 * @throws Exception
 */
public void addEntityToMap(String targetId, Field field, ExcelImportEntity excelEntity, Class<?> pojoClass,
        List<Method> getMethods, Map<String, ExcelImportEntity> temp) throws Exception {
    Excel excel = field.getAnnotation(Excel.class);
    excelEntity = new ExcelImportEntity();
    excelEntity.setType(excel.type());
    excelEntity.setSaveUrl(excel.savePath());
    excelEntity.setSaveType(excel.imageType());
    excelEntity.setReplace(excel.replace());
    excelEntity.setDatabaseFormat(excel.databaseFormat());
    excelEntity.setSuffix(excel.suffix());
    excelEntity.setImportField(
            Boolean.valueOf(PoiPublicUtil.getValueByTargetId(excel.isImportField(), targetId, "false")));
    getExcelField(targetId, field, excelEntity, excel, pojoClass);
    if (getMethods != null) {
        List<Method> newMethods = new ArrayList<Method>();
        newMethods.addAll(getMethods);
        newMethods.add(excelEntity.getMethod());
        excelEntity.setMethods(newMethods);
    }
    temp.put(excelEntity.getName(), excelEntity);

}

From source file:com.smartling.api.sdk.file.commandline.RetrieveFile.java

private static RetrieveFileParams getParameters(String[] args) {
    Validate.isTrue(args.length == 6, "Invalid number of arguments");

    RetrieveFileParams retrieveFileParams = new RetrieveFileParams();
    retrieveFileParams.setProductionMode(Boolean.valueOf(args[0]));
    retrieveFileParams.setApiKey(args[1]);
    retrieveFileParams.setProjectId(args[2]);
    retrieveFileParams.setPathToFile(args[3]);
    retrieveFileParams.setLocale(args[4]);
    retrieveFileParams.setPathToStoreFile(args[5]);

    return retrieveFileParams;
}

From source file:com.lynch.cms.core.util.PropertiesLoader.java

/**
 * ?PropertySystemProperty.//from  w ww  .ja  va2 s  . c om
 */
public Boolean getBoolean(String key, boolean defaultValue) {
    return Boolean.valueOf(getProperty(key, String.valueOf(defaultValue)));
}

From source file:it.geosolutions.geoserver.jms.impl.rest.Controller.java

public void toggle(final boolean switchTo, final ToggleType type) {

    ctx.publishEvent(new ToggleEvent(switchTo, type));

    final String switchToValue = Boolean.valueOf(switchTo).toString();
    if (type.equals(ToggleType.MASTER))
        config.putConfiguration(ToggleConfiguration.TOGGLE_MASTER_KEY, switchToValue);
    else/*  ww  w  .  jav  a 2s .co  m*/
        config.putConfiguration(ToggleConfiguration.TOGGLE_MASTER_KEY, switchToValue);

    // if (switchTo) {
    // // LOGGER.info("The " + type + " toggle is now ENABLED");
    // } else {
    // // LOGGER.warn("The " + type
    // // +
    // //
    // " toggle is now DISABLED no event will be posted/received to/from the broker");
    // // fp.info("Note that the " + type
    // // + " is still registered to the topic destination");
    // }
}

From source file:org.zenoss.zep.dao.impl.DaoUtils.java

private static Boolean getBoolProperty(String value) {
    Boolean boolVal = null;/*  w w  w  .java  2  s  .  c  om*/
    if (value != null) {
        boolVal = Boolean.valueOf(value.trim());
    }
    return boolVal;
}