Example usage for java.lang Boolean booleanValue

List of usage examples for java.lang Boolean booleanValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public boolean booleanValue() 

Source Link

Document

Returns the value of this Boolean object as a boolean primitive.

Usage

From source file:net.sourceforge.fenixedu.domain.contacts.PhysicalAddress.java

public PhysicalAddress(final Party party, final PartyContactType type, final Boolean defaultContact,
        final String address, final String areaCode, final String areaOfAreaCode, final String area,
        final String parishOfResidence, final String districtSubdivisionOfResidence,
        final String districtOfResidence, final Country countryOfResidence) {
    this(party, type, defaultContact.booleanValue(), new PhysicalAddressData(address, areaCode, areaOfAreaCode,
            area, parishOfResidence, districtSubdivisionOfResidence, districtOfResidence, countryOfResidence));
}

From source file:fxts.stations.util.BrowserLauncher.java

/**
 * This method open url at default browser by using JNLP.
 * If JNLP not available (start of application not trought Java WebStart)
 * the its return false./*from  w w w. j  a  va 2 s  .co m*/
 */
public static boolean showDocument(String sUrl) {
    Boolean resultBoolean;
    Class basicServiceClass;
    Object basicServiceObject;
    Method method;
    URL url;

    //gets BasicService class
    basicServiceClass = getBasicServiceClass();
    //gets BasicService object
    basicServiceObject = getBasicServiceObject();
    if (basicServiceClass == null || basicServiceObject == null) {
        return false;
    }
    try {
        url = new URL(sUrl);
    } catch (Exception ex) {
        ex.printStackTrace();
        return false;
    }
    try {
        method = basicServiceClass.getMethod("showDocument", new Class[] { URL.class });
        //invokes BasicService`s method
        resultBoolean = (Boolean) method.invoke(basicServiceObject, new Object[] { url });
        return resultBoolean.booleanValue();
    } catch (Exception ex) {
        ex.printStackTrace();
        return false;
    }
}

From source file:gridool.db.catalog.UpdatePartitionInCatalogJob.java

public GridTaskResultPolicy result(GridTaskResult result) throws GridException {
    Boolean succeed = result.getResult();
    if (succeed == null) {
        if (LOG.isWarnEnabled()) {
            GridNode node = result.getExecutedNode();
            GridException err = result.getException();
            LOG.warn("UpdateCatalogTask failed on node: " + node, err);
        }/*from  w  w  w  . ja  v  a  2  s.  c om*/
    } else {
        assert (succeed.booleanValue());
    }
    return GridTaskResultPolicy.CONTINUE;
}

From source file:gridool.tools.cmd.RegisterReplicaDbCommand.java

public boolean process(String[] args) throws CommandException {
    String driverClassName = getOption("driverClassName");
    String primaryDbUrl = getOption("primaryDbUrl");
    String user = getOption("user");
    String passwd = getOption("passwd");
    final boolean isLocal = !"cluster".equalsIgnoreCase(args[1]);
    final String[] dbnames;
    if (isLocal) {
        dbnames = ArrayUtils.copyOfRange(args, 2, args.length);
    } else {//from  w  ww  .jav a2s .  c  o  m
        dbnames = ArrayUtils.copyOfRange(args, 3, args.length);
    }

    final JobConf jobConf = new JobConf(driverClassName, primaryDbUrl, user, passwd, dbnames, isLocal);
    final Grid grid = new GridClient();
    final Boolean succeed;
    try {
        succeed = grid.execute(RegisterReplicaDbJob.class, jobConf);
    } catch (RemoteException e) {
        throw new CommandException(e);
    }
    return (succeed == null) ? false : succeed.booleanValue();
}

From source file:com.netspective.sparx.form.action.ActionWrapper.java

public void locateValidator() throws NoSuchMethodException {
    final Method isValidMethod = getMethod(isValidMethodName, List.class) == null
            ? getMethod(isValidMethodName, (Class[]) null)
            : getMethod(isValidMethodName, List.class);
    if (isValidMethod != null) {
        if (isValidMethod.getReturnType() == boolean.class) {
            actionValidator = new ActionValidator() {
                public boolean isValid(Object instance, List messages) throws Exception {
                    Boolean result = (Boolean) isValidMethod.invoke(instance, new Object[] { messages });
                    return result.booleanValue();
                }//from  ww w .j a v  a2  s.  c  om
            };
        }
    } else
        actionValidator = null;
}

From source file:com.gst.useradministration.service.UserDataValidator.java

public void validateForCreate(final String json) {
    if (StringUtils.isBlank(json)) {
        throw new InvalidJsonException();
    }//  ww w.j a v a2  s.c o  m

    final Type typeOfMap = new TypeToken<Map<String, Object>>() {
    }.getType();
    this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
    final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
            .resource("user");

    final JsonElement element = this.fromApiJsonHelper.parse(json);

    final String username = this.fromApiJsonHelper.extractStringNamed("username", element);
    baseDataValidator.reset().parameter("username").value(username).notBlank().notExceedingLengthOf(100);

    final String firstname = this.fromApiJsonHelper.extractStringNamed("firstname", element);
    baseDataValidator.reset().parameter("firstname").value(firstname).notBlank().notExceedingLengthOf(100);

    final String lastname = this.fromApiJsonHelper.extractStringNamed("lastname", element);
    baseDataValidator.reset().parameter("lastname").value(lastname).notBlank().notExceedingLengthOf(100);

    final Boolean sendPasswordToEmail = this.fromApiJsonHelper.extractBooleanNamed("sendPasswordToEmail",
            element);
    if (sendPasswordToEmail != null) {
        if (sendPasswordToEmail.booleanValue()) {
            final String email = this.fromApiJsonHelper.extractStringNamed("email", element);
            baseDataValidator.reset().parameter("email").value(email).notBlank().notExceedingLengthOf(100);
        } else {
            final String password = this.fromApiJsonHelper.extractStringNamed("password", element);
            final String repeatPassword = this.fromApiJsonHelper.extractStringNamed("repeatPassword", element);
            final PasswordValidationPolicy validationPolicy = this.passwordValidationPolicy
                    .findActivePasswordValidationPolicy();
            final String regex = validationPolicy.getRegex();
            final String description = validationPolicy.getDescription();
            baseDataValidator.reset().parameter("password").value(password).matchesRegularExpression(regex,
                    description);

            if (StringUtils.isNotBlank(password)) {
                baseDataValidator.reset().parameter("password").value(password)
                        .equalToParameter("repeatPassword", repeatPassword);
            }
        }
    } else {
        baseDataValidator.reset().parameter("sendPasswordToEmail").value(sendPasswordToEmail)
                .trueOrFalseRequired(false);
    }

    final Long officeId = this.fromApiJsonHelper.extractLongNamed("officeId", element);
    baseDataValidator.reset().parameter("officeId").value(officeId).notNull().integerGreaterThanZero();

    if (this.fromApiJsonHelper.parameterExists("staffId", element)) {
        final Long staffId = this.fromApiJsonHelper.extractLongNamed("staffId", element);
        baseDataValidator.reset().parameter("staffId").value(staffId).notNull().integerGreaterThanZero();
    }

    if (this.fromApiJsonHelper.parameterExists(AppUserConstants.PASSWORD_NEVER_EXPIRES, element)) {
        final boolean passwordNeverExpire = this.fromApiJsonHelper
                .extractBooleanNamed(AppUserConstants.PASSWORD_NEVER_EXPIRES, element);
        baseDataValidator.reset().parameter("passwordNeverExpire").value(passwordNeverExpire)
                .validateForBooleanValue();
    }

    Boolean isSelfServiceUser = null;
    if (this.fromApiJsonHelper.parameterExists(AppUserConstants.IS_SELF_SERVICE_USER, element)) {
        isSelfServiceUser = this.fromApiJsonHelper.extractBooleanNamed(AppUserConstants.IS_SELF_SERVICE_USER,
                element);
        if (isSelfServiceUser == null) {
            baseDataValidator.reset().parameter(AppUserConstants.IS_SELF_SERVICE_USER)
                    .trueOrFalseRequired(false);
        }
    }

    if (this.fromApiJsonHelper.parameterExists(AppUserConstants.CLIENTS, element)) {
        if (isSelfServiceUser == null || !isSelfServiceUser) {
            baseDataValidator.reset().parameter(AppUserConstants.CLIENTS).failWithCode(
                    "not.supported.when.isSelfServiceUser.is.false",
                    "clients parameter is not supported when isSelfServiceUser parameter is false");
        } else {
            final JsonArray clientsArray = this.fromApiJsonHelper
                    .extractJsonArrayNamed(AppUserConstants.CLIENTS, element);
            baseDataValidator.reset().parameter(AppUserConstants.CLIENTS).value(clientsArray)
                    .jsonArrayNotEmpty();

            for (JsonElement client : clientsArray) {
                Long clientId = client.getAsLong();
                baseDataValidator.reset().parameter(AppUserConstants.CLIENTS).value(clientId)
                        .longGreaterThanZero();
            }
        }
    }

    final String[] roles = this.fromApiJsonHelper.extractArrayNamed("roles", element);
    baseDataValidator.reset().parameter("roles").value(roles).arrayNotEmpty();

    throwExceptionIfValidationWarningsExist(dataValidationErrors);
}

From source file:com.activecq.samples.slingauthenticationhandler.impl.TokenSlingAuthenticationHandler.java

private boolean accepts(final HttpServletRequest request) {
    // Fail quickly and exit from the Auth Handler ASAP

    // This is check thats here to work with the Sample RememberMe Authentication Handler
    final Boolean rememberMe = (Boolean) request
            .getAttribute(RememberMeSlingAuthenticationHandler.REMEMBER_ME_ROUTINE);
    final String authKey = request.getParameter("auth");

    return "go".equals(authKey) || (rememberMe != null && rememberMe.booleanValue());
}

From source file:de.berlios.jedi.presentation.admin.LoginAction.java

/**
 * Handle server requests.//www.j a v  a 2  s.  c  o m
 * 
 * @param mapping
 *            The ActionMapping used to select this instance.
 * @param form
 *            The optional ActionForm bean for this request (if any).
 * @param request
 *            The HTTP request we are processing.
 * @param response
 *            The HTTP response we are creating.
 */
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) {
    Boolean isLoggedIn = (Boolean) request.getSession().getAttribute(AdminKeys.IS_LOGGED_IN);

    String password = request.getParameter("password");
    try {
        new AdminLogicService().login(password);
    } catch (IncorrectPasswordException e) {
        LogFactory.getLog(LoginAction.class).warn("An invalid password was used to try logging in", e);

        // Already logged in
        if (isLoggedIn != null && isLoggedIn.booleanValue()) {
            return errorForward(mapping, request, new ActionMessage("incorrectPassword"),
                    "loginIncorrectPassword", "logout");
        }

        return errorForward(mapping, request, new ActionMessage("incorrectPassword"), "loginIncorrectPassword");
    }

    // Already logged in
    if (isLoggedIn != null && isLoggedIn.booleanValue()) {
        return mapping.findForward("success");
    }

    request.getSession().setAttribute(AdminKeys.IS_LOGGED_IN, new Boolean(true));

    request.setAttribute(Keys.NEXT_FORWARD_NAME, "adminView");

    return mapping.findForward("success");
}

From source file:org.ovirt.engine.sdk.web.ConnectionsPoolBuilder.java

/**
 * @param noHostVerification// www .  ja  v a 2  s  . c  o  m
 *            flag
 */
public ConnectionsPoolBuilder noHostVerification(Boolean noHostVerification) {
    if (noHostVerification != null) {
        this.noHostVerification = noHostVerification.booleanValue();
    }
    return this;
}

From source file:com.googlecode.psiprobe.Tomcat55ContainerAdaptor.java

private void checkChanges(String name) throws Exception {
    Boolean result = (Boolean) mBeanServer.invoke(deployerOName, "isServiced", new String[] { name },
            new String[] { "java.lang.String" });
    if (!result.booleanValue()) {
        mBeanServer.invoke(deployerOName, "addServiced", new String[] { name },
                new String[] { "java.lang.String" });
        try {/*www.  j  a  v a2  s  .c o m*/
            mBeanServer.invoke(deployerOName, "check", new String[] { name },
                    new String[] { "java.lang.String" });
        } finally {
            mBeanServer.invoke(deployerOName, "removeServiced", new String[] { name },
                    new String[] { "java.lang.String" });
        }
    }
}