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:com.clustercontrol.notify.factory.NotifyDispatcher.java

/**
 * NotifyDispatcher#notifyAction(List<OutputBasicInfo>, List, boolean)??<BR>
 * NotifyDispatcher#notifyAction(OutputBasicInfo, List, boolean)??<BR>
 * (outputBasicInfoListList????????)<BR>
 * <BR>//from  w w  w.  j  a  v  a  2s  .  c o  m
 * List<OutputBasicInfo>???OutputBasicInfo?PluginId?MonitorId?????????<BR>
 * 
 * @see NotifyDispatcher#notifyAction(OutputBasicInfo, List, boolean)
 * 
 * @param outputBasicInfoList
 * @param notifyIdList
 * @param persist
 */
public static void notifyAction(List<OutputBasicInfo> outputBasicInfoList, List<String> notifyIdList,
        boolean persist) throws HinemosUnknown {
    if (notifyIdList == null) {
        return;
    }
    if (outputBasicInfoList.isEmpty()) {
        return;
    }

    //NotifyHistory??
    OutputBasicInfo firstOutputBasicInfo = outputBasicInfoList.get(0);
    List<NotifyHistoryEntity> notifyHistoryEntityList = null;
    if (outputBasicInfoList.size() > 1) {// 
        notifyHistoryEntityList = QueryUtil.getNotifyHistoryByPluginIdAndMonitorId(
                firstOutputBasicInfo.getPluginId(), firstOutputBasicInfo.getMonitorId());
    } else {// ?????
        notifyHistoryEntityList = QueryUtil.getNotifyHistoryByPluginIdAndMonitorIdAndFacilityId(
                firstOutputBasicInfo.getPluginId(), firstOutputBasicInfo.getMonitorId(),
                firstOutputBasicInfo.getFacilityId());
    }
    Map<NotifyHistoryEntityPK, NotifyHistoryEntity> notifyHistoryEntityMap = new ConcurrentHashMap<NotifyHistoryEntityPK, NotifyHistoryEntity>();
    for (NotifyHistoryEntity notifyHistoryEntity : notifyHistoryEntityList) {
        notifyHistoryEntityMap.put(notifyHistoryEntity.getId(), notifyHistoryEntity);
    }

    //??(???????)
    for (OutputBasicInfo info : outputBasicInfoList) {
        String pluginId = info.getPluginId();
        boolean flag = HinemosPropertyUtil.getHinemosPropertyBool("notify.remove.subkey." + pluginId, false);
        if (flag) {
            info.setSubKey("");
        }
    }

    // ???
    String notify_mode = HinemosPropertyUtil.getHinemosPropertyStr(NOTIFY_MODE_KEY, MODE_NORMAL);

    // cc_monitor_status?counter1?
    HashMap<OutputBasicInfo, Boolean> priorityChangeMap = new HashMap<>();
    for (OutputBasicInfo info : outputBasicInfoList) {
        priorityChangeMap.put(info, MonitorResultStatusUpdater.update(info));
    }

    // ???
    for (String notifyId : notifyIdList) {
        NotifyInfo notifyInfo = NotifyCache.getNotifyInfo(notifyId);
        Integer notifyType = notifyInfo.getNotifyType();
        Boolean notifyValid = notifyInfo.getValidFlg();
        if (notifyType == null || notifyValid == null) {
            // ?ID??????????ID???
            m_log.info("notifyAction() : notifyId = " + notifyId + " not found.");
            continue;
        }
        if (!notifyValid.booleanValue()) {
            m_log.debug("notifyAction() : notifyId = " + notifyId + " invalid.");
            continue;
        }

        if (!checkCalendar(notifyInfo.getCalendarId())) {
            m_log.debug("notifyAction() : notifyId = " + notifyId + " calendar is disabled now.");
            continue;
        }

        ArrayList<NotifyRequestMessage> msgList = new ArrayList<NotifyRequestMessage>();
        for (OutputBasicInfo info : outputBasicInfoList) {
            boolean prioityChangeFlag = priorityChangeMap.get(info);
            Timestamp outputDate = new Timestamp(HinemosTime.currentTimeMillis());

            // ????????????
            boolean isNotify = notifyCheck(info.getFacilityId(), info.getPluginId(), info.getMonitorId(),
                    info.getSubKey(), notifyId, info.getPriority(), outputDate, prioityChangeFlag, notify_mode,
                    notifyHistoryEntityMap);

            if (!isNotify) {
                continue;
            }

            // ?AsyncWorkerPlugin.addTask???
            OutputBasicInfo clonedInfo = info.clone();

            // Ignore Invalid XML Chars
            clonedInfo.setMessage(XMLUtil.ignoreInvalidString(clonedInfo.getMessage()));
            clonedInfo.setMessageOrg(XMLUtil.ignoreInvalidString(clonedInfo.getMessageOrg()));

            // ID?????????????
            NotifyRequestMessage msg = new NotifyRequestMessage(clonedInfo, notifyId, outputDate,
                    prioityChangeFlag);

            msgList.add(msg);
        }

        try {
            addNotifyTask(persist, notifyType, msgList);
        } catch (HinemosUnknown e) {
            m_log.warn(e);
            throw e;
        }
    }
}

From source file:com.aurel.track.admin.customize.lists.systemOption.IssueTypeBL.java

/**
 * Load all issue types allowed for the project type the project belongs to 
 * @param projectType/*from ww w.ja va2  s  .co m*/
 * @param whether to get only the document type item types or the non document type item types or all item types
 * @return
 */
public static List<TListTypeBean> loadAllowedByProjectType(Integer projectType, Boolean documents) {
    List<TListTypeBean> allowedByIssueTypes = null;
    if (documents == null) {
        allowedByIssueTypes = issueTypeDAO.loadAllowedByProjectType(projectType);
    } else {
        if (documents.booleanValue() == true) {
            allowedByIssueTypes = issueTypeDAO.loadAllowedDocumentTypesByProjectType(projectType);
        } else {
            allowedByIssueTypes = issueTypeDAO.loadAllowedNonDocumentTypesByProjectType(projectType);
        }
    }
    if (allowedByIssueTypes == null || allowedByIssueTypes.isEmpty()) {
        if (documents == null) {
            return IssueTypeBL.loadAll();
        } else {
            if (documents.booleanValue() == true) {
                return IssueTypeBL.loadAllDocumentTypes();
            } else {
                return IssueTypeBL.loadAllSelectable();
            }
        }
    } else {
        return allowedByIssueTypes;
    }
}

From source file:com.projity.util.ClassUtils.java

public static boolean isObjectFieldReadOnly(Object object, Field field) {
    if (object == null)
        return false;
    Boolean value = null;
    try {//  ww  w  .jav a2  s  .  c  o  m
        Method m = object.getClass().getMethod("isReadOnly", fieldGetterParams);
        if (m != null)
            value = (Boolean) m.invoke(object, new Object[] { field });
    } catch (IllegalArgumentException e) {
    } catch (IllegalAccessException e) {
    } catch (InvocationTargetException e) {
    } catch (NoSuchMethodException e) {
    }
    return value != null && value.booleanValue();

}

From source file:fr.paris.lutece.plugins.mylutece.util.SecurityUtils.java

/**
 * Check whether a user must change his new password after a password reset
 * by mail.// www. j a v  a 2 s.c  om
 * @param parameterService Parameter service to get parameters from.
 * @param plugin The plugin
 * @return true if the user must, false otherwise
 */
private static boolean isChangePasswordForceAfterReinitActivated(IUserParameterService parameterService,
        Plugin plugin) {
    Boolean bIsChecked = Boolean
            .valueOf(parameterService.findByKey(MARK_FORCE_CHANGE_PASSWORD_REINIT, plugin).isChecked());

    return bIsChecked.booleanValue();
}

From source file:com.qmetry.qaf.automation.ui.selenium.AssertionService.java

public static boolean seleniumEquals(String expectedPattern, String actual) {
    if (actual.startsWith("regexp:") || actual.startsWith("regex:") || actual.startsWith("regexpi:")
            || actual.startsWith("regexi:")) {
        // swap 'em
        String tmp = actual;// www  .j  ava2 s  .c o m
        actual = expectedPattern;
        expectedPattern = tmp;
    }
    Boolean b;
    b = handleRegex("regexp:", expectedPattern, actual, 0);
    if (b != null) {
        return b.booleanValue();
    }
    b = handleRegex("regex:", expectedPattern, actual, 0);
    if (b != null) {
        return b.booleanValue();
    }
    b = handleRegex("regexpi:", expectedPattern, actual, Pattern.CASE_INSENSITIVE);
    if (b != null) {
        return b.booleanValue();
    }
    b = handleRegex("regexi:", expectedPattern, actual, Pattern.CASE_INSENSITIVE);
    if (b != null) {
        return b.booleanValue();
    }

    if (expectedPattern.startsWith("exact:")) {
        String expectedExact = expectedPattern.replaceFirst("exact:", "");
        if (!expectedExact.equals(actual)) {
            System.out.println("expected " + actual + " to match " + expectedPattern);
            return false;
        }
        return true;
    }

    String expectedGlob = expectedPattern.replaceFirst("glob:", "");
    expectedGlob = expectedGlob.replaceAll("([\\]\\[\\\\{\\}$\\(\\)\\|\\^\\+.])", "\\\\$1");

    expectedGlob = expectedGlob.replaceAll("\\*", ".*");
    expectedGlob = expectedGlob.replaceAll("\\?", ".");
    if (!Pattern.compile(expectedGlob, Pattern.DOTALL).matcher(actual).matches()) {
        System.out.println("expected \"" + actual + "\" to match glob \"" + expectedPattern
                + "\" (had transformed the glob into regexp \"" + expectedGlob + "\"");
        return false;
    }
    return true;
}

From source file:jk.wrapper.common.util.BooleanUtils.java

/**
 * <p>Converts a Boolean to a Integer using the convention that
 * <code>zero</code> is <code>false</code>.</p>
 *
 * <p><code>null</code> will be converted to <code>null</code>.</p>
 *
 * <pre>/*from   w w w  .  j a  va  2  s  .c  om*/
 *   BooleanUtils.toIntegerObject(Boolean.TRUE)  = new Integer(1)
 *   BooleanUtils.toIntegerObject(Boolean.FALSE) = new Integer(0)
 * </pre>
 *
 * @param bool  the Boolean to convert
 * @return one if Boolean.TRUE, zero if Boolean.FALSE, <code>null</code> if <code>null</code>
 */
public static Integer toIntegerObject(Boolean bool) {
    if (bool == null) {
        return null;
    }
    return bool.booleanValue() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}

From source file:com.springframework.core.annotation.AnnotationUtils.java

static boolean isInterfaceWithAnnotatedMethods(Class<?> iface) {
    Boolean flag = annotatedInterfaceCache.get(iface);
    if (flag != null) {
        return flag.booleanValue();
    }//from  www  .ja va 2 s  . com
    Boolean found = Boolean.FALSE;
    for (Method ifcMethod : iface.getMethods()) {
        try {
            if (ifcMethod.getAnnotations().length > 0) {
                found = Boolean.TRUE;
                break;
            }
        } catch (Exception ex) {
            // Assuming nested Class values not resolvable within annotation attributes...
            logIntrospectionFailure(ifcMethod, ex);
        }
    }
    annotatedInterfaceCache.put(iface, found);
    return found.booleanValue();
}

From source file:com.baasbox.service.user.UserService.java

public static boolean isSocialAccount(String username) throws SqlInjectionException {
    ODocument user = getUserProfilebyUsername(username);
    Boolean generated = (Boolean) user.field(UserDao.GENERATED_USERNAME);
    if (generated == null)
        return false;
    return generated.booleanValue();
}

From source file:de.bps.onyx.plugin.OnyxModule.java

public static boolean isOnyxTest(final OLATResourceable res) {
    if (res.getResourceableTypeName().equals(TestFileResource.TYPE_NAME)
            || res.getResourceableTypeName().equals(SurveyFileResource.TYPE_NAME)) {
        Long resourceId = res.getResourceableId();
        Boolean onyx = onyxMap.get(resourceId);
        if (onyx == null) {
            onyx = Boolean.FALSE;
            try {
                final Resolver resolver = new ImsRepositoryResolver(res);
                // search for qti.xml, it not exists for qti2
                if (resolver.getQTIDocument() == null) {
                    onyx = Boolean.TRUE;
                } else {
                    onyx = Boolean.FALSE;
                }// w  w w  . java  2s.  co m
            } catch (OLATRuntimeException e) {
                log.error("", e);
            }
            onyxMap.put(resourceId, onyx);
        }
        return onyx.booleanValue();
    } else {
        return false;
    }
}

From source file:ActionChangedListener.java

public void propertyChange(PropertyChangeEvent e) {
    String propertyName = e.getPropertyName();
    System.out.println(propertyName);
    if (e.getPropertyName().equals(Action.NAME)) {
        String text = (String) e.getNewValue();
        button.setText(text);//w ww.  j  a v a  2  s  . com
        button.repaint();
    } else if (propertyName.equals("enabled")) {
        Boolean enabledState = (Boolean) e.getNewValue();
        button.setEnabled(enabledState.booleanValue());
        button.repaint();
    } else if (e.getPropertyName().equals(Action.SMALL_ICON)) {
        Icon icon = (Icon) e.getNewValue();
        button.setIcon(icon);
        button.invalidate();
        button.repaint();
    }
}