List of usage examples for java.lang Boolean equals
public boolean equals(Object obj)
From source file:org.apache.rampart.MessageBuilder.java
private boolean isSecurityValidationFault(MessageContext msgCtx) throws AxisFault { OperationContext opCtx = msgCtx.getOperationContext(); MessageContext inMsgCtx;//from w w w. j a va 2 s. c o m if (opCtx != null && (inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) { Boolean secErrorFlag = (Boolean) inMsgCtx.getProperty(RampartConstants.SEC_FAULT); if (secErrorFlag != null && secErrorFlag.equals(Boolean.TRUE)) { return true; } } return false; }
From source file:org.hyperic.hq.ui.action.resource.common.monitor.alerts.config.NewDefinitionAction.java
private boolean areAnyMetricsDisabled(AlertDefinitionValue adv, AppdefEntityID adeId, int sessionID) throws SessionNotFoundException, SessionTimeoutException, AppdefEntityNotFoundException, GroupNotCompatibleException, PermissionException, RemoteException { // create a map of metricId --> enabled for this resource List metrics = measurementBoss.findMeasurements(sessionID, adeId, PageControl.PAGE_ALL); Map<Integer, Boolean> metricEnabledFlags = new HashMap<Integer, Boolean>(metrics.size()); for (Iterator it = metrics.iterator(); it.hasNext();) { // Groups are handled differently here. The list of // metrics that will be returned for a group will be // GroupMetricDisplaySummary beans instead of // DerivedMeasurementValue beans. We cannot check the // enabled status of these measurements for groups, so // don't do anything here. try {/*from w w w . jav a 2 s. c om*/ Measurement m = (Measurement) it.next(); metricEnabledFlags.put(m.getId(), new Boolean(m.isEnabled())); } catch (ClassCastException e) { } } // iterate over alert conditions and see if any of the metrics // being used are disabled for (int i = 0; i < adv.getConditions().length; ++i) { if (adv.getConditions()[i].measurementIdHasBeenSet()) { Integer mid = new Integer(adv.getConditions()[i].getMeasurementId()); Boolean metricEnabled = (Boolean) metricEnabledFlags.get(mid); if (null != metricEnabled) { return metricEnabled.equals(Boolean.FALSE); } } } return false; }
From source file:com.vmware.identity.sts.ws.handlers.LogContextHandler.java
@Override public boolean handleMessage(SOAPMessageContext context) { Validate.notNull(context, "SOAPMessageContext should not be null."); Boolean outbound = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (outbound != null && outbound.equals(Boolean.TRUE)) { return true; } else {//from www .j a v a 2 s. c o m String tenant = null; String correlationId = null; // http://docs.oracle.com/javase/7/docs/api/javax/xml/ws/handler/MessageContext.html : // static final String HTTP_REQUEST_HEADERS // Standard property: HTTP request headers. // Type: java.util.Map<java.lang.String, java.util.List<java.lang.String>> // // static final String SERVLET_REQUEST // Standard property: servlet request object. // Type: javax.servlet.http.HttpServletRequest HttpServletRequest request = (HttpServletRequest) (context.get(MessageContext.SERVLET_REQUEST)); Validate.notNull(request, "HttpServletRequest should not be null."); @SuppressWarnings("unchecked") Map<String, List<String>> headers = (Map<String, List<String>>) (context .get(MessageContext.HTTP_REQUEST_HEADERS)); if (headers != null) { List<String> correlationIds = headers.get(WsConstants.ACTIVITY_CORRELATION_ID_CUSTOM_HEADER); if ((correlationIds != null) && (correlationIds.size() > 1)) { correlationId = correlationIds.get(0); correlationId = LogContextHandler.removeNewline(correlationId); correlationId = LogContextHandler.truncate(correlationId, 200); } } if ((correlationId == null) || (correlationId.isEmpty())) { correlationId = UUID.randomUUID().toString(); logger.debug("unable to extract correlation id from request. generated new correllation id [{}]", correlationId); } else { logger.debug("extracted correlation id [{}] from the request", correlationId); } try { tenant = TenantExtractor.extractTenantName(request.getPathInfo()); tenant = LogContextHandler.removeNewline(tenant); tenant = LogContextHandler.truncate(tenant, 200); logger.debug("extracted tenant [{}] from the request", tenant); } catch (NoSuchIdPException ex) { logger.error("failed to extract tenant from the request", ex); } if ((tenant == null) || (tenant.isEmpty())) { tenant = WsConstants.DEFAULT_TENANT; logger.debug( "unable to extract explicit tenant name from request. Using default tenant marker [{}].", tenant); } else { logger.debug("extracted tenant name [{}] from the request", tenant); } this._diagCtxt = DiagnosticsContextFactory.createContext(correlationId, tenant); } return true; }
From source file:org.apache.myfaces.custom.skin.html.ext.HtmlOutputLabelSkinRenderer.java
/** * Apply the following css class style attributes: * /*from ww w.ja v a2s . c o m*/ * styleClass required * * @param context * @param component * @param arc * @throws IOException */ @Override protected void _addStyleClassesToComponent(FacesContext context, UIComponent component, RenderingContext arc) throws IOException { String contentStyleClass = component.getClass().getName(); String baseStyleClass = this.getBaseStyleName(component); contentStyleClass = baseStyleClass + SkinConstants.STYLE_CLASS_SUFFIX; int otherStyles = 0; Map attributes = component.getAttributes(); String styleClass = (String) attributes.get("styleClass"); String requiredStyleClass = null; String disabledStyleClass = null; String forComponent = (String) component.getAttributes().get("for"); if (forComponent != null) { if (!forComponent.equals("")) { try { // Try to find the component UIComponent c = component.findComponent(forComponent); if (c != null) { Boolean o = (Boolean) c.getAttributes().get("required"); if (o != null) { if (o.equals(Boolean.TRUE)) { // its necesary to add the attributes of // required styleClass requiredStyleClass = baseStyleClass + "::required"; otherStyles++; } } o = (Boolean) c.getAttributes().get("disabled"); if (o != null) { if (o.equals(Boolean.TRUE)) { disabledStyleClass = baseStyleClass + SkinConstants.DISABLED_CLASS_SUFFIX; otherStyles++; } } } else { log.debug("Component " + forComponent + " Not found"); } } catch (java.lang.IllegalArgumentException e) { // Nothing } } } List<String> parsedStyleClasses = OutputUtils.parseStyleClassList(styleClass); int userStyleClassCount; if (parsedStyleClasses == null) userStyleClassCount = (styleClass == null) ? 0 : 1; else userStyleClassCount = parsedStyleClasses.size(); String[] styleClasses = new String[userStyleClassCount + 3]; int i = 0; if (parsedStyleClasses != null) { while (i < userStyleClassCount) { styleClasses[i] = parsedStyleClasses.get(i); i++; } } else if (styleClass != null) { styleClasses[i++] = styleClass; } styleClasses[i++] = contentStyleClass; styleClasses[i++] = requiredStyleClass; styleClasses[i++] = disabledStyleClass; // 3. set the property styleClass, setting it. if (otherStyles > 0) { _renderStyleClasses(component, context, arc, styleClasses); } else { _renderStyleClass(component, context, arc, contentStyleClass); } }
From source file:org.apache.myfaces.custom.skin.renderkit.html.ext.HtmlOutputLabelSkinRenderer.java
/** * Apply the following css class style attributes: * /* w w w . j a v a 2s . c o m*/ * styleClass required * * @param context * @param component * @param arc * @throws IOException */ @Override protected void _addStyleClassesToComponent(FacesContext context, UIComponent component, SkinRenderingContext arc) throws IOException { String contentStyleClass = component.getClass().getName(); String baseStyleClass = this.getBaseStyleName(component); contentStyleClass = baseStyleClass + SkinConstants.STYLE_CLASS_SUFFIX; int otherStyles = 0; Map attributes = component.getAttributes(); String styleClass = (String) attributes.get("styleClass"); String requiredStyleClass = null; String disabledStyleClass = null; String forComponent = (String) component.getAttributes().get("for"); if (forComponent != null) { if (!forComponent.equals("")) { try { // Try to find the component UIComponent c = component.findComponent(forComponent); if (c != null) { Boolean o = (Boolean) c.getAttributes().get("required"); if (o != null) { if (o.equals(Boolean.TRUE)) { // its necesary to add the attributes of // required styleClass requiredStyleClass = baseStyleClass + "::required"; otherStyles++; } } o = (Boolean) c.getAttributes().get("disabled"); if (o != null) { if (o.equals(Boolean.TRUE)) { disabledStyleClass = baseStyleClass + SkinConstants.DISABLED_CLASS_SUFFIX; otherStyles++; } } } else { log.debug("Component " + forComponent + " Not found"); } } catch (java.lang.IllegalArgumentException e) { // Nothing } } } List<String> parsedStyleClasses = OutputUtils.parseStyleClassList(styleClass); int userStyleClassCount; if (parsedStyleClasses == null) userStyleClassCount = (styleClass == null) ? 0 : 1; else userStyleClassCount = parsedStyleClasses.size(); String[] styleClasses = new String[userStyleClassCount + 3]; int i = 0; if (parsedStyleClasses != null) { while (i < userStyleClassCount) { styleClasses[i] = parsedStyleClasses.get(i); i++; } } else if (styleClass != null) { styleClasses[i++] = styleClass; } styleClasses[i++] = contentStyleClass; styleClasses[i++] = requiredStyleClass; styleClasses[i++] = disabledStyleClass; // 3. set the property styleClass, setting it. if (otherStyles > 0) { _renderStyleClasses(component, context, arc, styleClasses); } else { _renderStyleClass(component, context, arc, contentStyleClass); } }
From source file:com.headstrong.npi.raas.Utils.java
public static AttributeBoolean getAttributeBooleanValue(Boolean value) { AttributeBoolean bo = null;// w ww .ja va 2 s .c om if (value != null) { bo = new AttributeBoolean(); bo.setValue((value.equals(Boolean.TRUE)) ? com.headstrong.npi.raas.cobs.xml.pojo.Boolean.YES : com.headstrong.npi.raas.cobs.xml.pojo.Boolean.NO); } return bo; }
From source file:es.pode.modificador.presentacion.pendientes.ModificacionesPendientesControllerImpl.java
/** * @see es.pode.modificador.presentacion.pendientes.ModificacionesPendientesController#eliminarModificaciones(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.pendientes.EliminarModificacionesForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//* ww w . j a v a2 s . c om*/ public final void eliminarModificaciones(ActionMapping mapping, es.pode.modificador.presentacion.pendientes.EliminarModificacionesForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Long[] identificadores = (Long[]) form.getIdentificadores() .toArray(new Long[form.getIdentificadores().size()]); Boolean resultadoEliminacion = this.getSrvHerramientaModificacion().eliminarModificacion(identificadores); if (resultadoEliminacion.equals(Boolean.FALSE)) { saveErrorMessage(request, MENSAJE_ERROR_DETALLES); } else if (resultadoEliminacion.equals(Boolean.TRUE)) { saveSuccessMessage(request, MENSAJE_EXITO_DETALLE); } }
From source file:org.jmws.webapp.action.UserLogInAction.java
/** * Executes the UserLogIn Struts Action. * @param mapping//w w w . j a v a 2 s. com * @param form * @param request * @param response * @return */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { // retrieve form's parameters String login = null; String password = null; try { login = (String) PropertyUtils.getSimpleProperty(form, "login"); password = (String) PropertyUtils.getSimpleProperty(form, "password"); } catch (Exception e) { } // Form validation ActionErrors errors = new ActionErrors(); if ((login == null) || (login.equals(""))) errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.login.login.notfound")); else if ((password == null) || (password.equals(""))) errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.login.password.notfound")); // If any errors, forward errors to input page if (!errors.isEmpty()) { saveErrors(request, errors); return mapping.getInputForward(); } else { try { // JNDI naming context InitialContext context = new InitialContext(); // Get the UserLogInHome interface UserLogInHome home; Object obj = context.lookup(UserLogIn.JNDI_NAME); home = (UserLogInHome) obj; // Get a new UserLogIn session bean. UserLogInRemote remote = home.create(); // Checks log in for the specified User. Boolean logged = remote.checkLogIn(login, password); // Check failed ? if (logged.equals(Boolean.FALSE)) { // Forward the error to input page errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.login.failed")); saveErrors(request, errors); return mapping.getInputForward(); } // Check succeeded ? else { // Save User logged in state into Session HttpSession session = request.getSession(); session.setAttribute(Constants.USER_KEY, login); // Forward to success page return mapping.findForward("success"); } } catch (NamingException ne) { // Forward the error to input page errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.global.namingexception")); saveErrors(request, errors); return mapping.getInputForward(); } catch (RemoteException re) { // Forward the error to input page errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.global.remoteexception")); saveErrors(request, errors); return mapping.getInputForward(); } catch (CreateException ce) { // Forward the error to input page errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.global.createexception")); saveErrors(request, errors); return mapping.getInputForward(); } catch (UserWrongPasswordException uspe) { // Forward the error to input page errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.login.userwrongpasswordexception")); saveErrors(request, errors); return mapping.getInputForward(); } catch (UserInactiveException uia) { // Forward the error to input page errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.login.userinactiveexception")); saveErrors(request, errors); return mapping.getInputForward(); } catch (FinderException fe) { // Forward the error to input page errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.global.finderexception")); saveErrors(request, errors); return mapping.getInputForward(); } } }
From source file:com.twitter.heron.scheduler.RuntimeManagerMain.java
protected boolean validateRuntimeManage(SchedulerStateManagerAdaptor adaptor, String topologyName) { // Check whether the topology has already been running Boolean isTopologyRunning = adaptor.isTopologyRunning(topologyName); if (isTopologyRunning == null || isTopologyRunning.equals(Boolean.FALSE)) { LOG.severe("No such topology exists"); return false; }/* w w w . ja va 2s. c o m*/ // Check whether cluster/role/environ matched ExecutionEnvironment.ExecutionState executionState = adaptor.getExecutionState(topologyName); if (executionState == null || !executionState.getCluster().equals(Context.cluster(config)) || !executionState.getRole().equals(Context.role(config)) || !executionState.getEnviron().equals(Context.environ(config))) { LOG.severe("cluster/role/environ not matched"); return false; } return true; }
From source file:org.medici.bia.common.util.ListBeanUtils.java
/** * Method to obtains a plain list of multiple fields contained in a bean input list. * The fields are marked by third parameter which is the separator. * The outputString// ww w . jav a2 s. c o m * * @param beansList List of bean from which we estract the plain list of multiple fields. * @param concatenatedFields List of bean's fields we want to concatenate in outputlist * @param fieldsSeparator String Separator of previous parameter * @param outputFieldsSeparator Separator of fields in output list * @param addBlankSpace A boolean parameter to insert a blank space before and after every separatore of output fields * @param excludeZero If a field is numeric and his value is 0, the field is discarded from output. * @return */ public static List<String> toStringListWithConcatenationFields(List<?> beansList, String concatenatedFields, String fieldsSeparator, String outputFieldsSeparator, Boolean addBlankSpace, Boolean excludeZero) { if (beansList == null) { return new ArrayList<String>(0); } if ((beansList.size() == 0) || (StringUtils.isEmpty(fieldsSeparator)) || (StringUtils.isEmpty(outputFieldsSeparator))) { return new ArrayList<String>(0); } List<String> retValue = new ArrayList<String>(beansList.size()); String[] fields = StringTokenizerUtils.tokenizeToArray(concatenatedFields, fieldsSeparator); StringBuilder stringBuilder = null; for (int i = 0; i < beansList.size(); i++) { stringBuilder = new StringBuilder(0); for (int j = 0; j < fields.length; j++) { PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(beansList.get(0).getClass(), fields[j]); Method method = pd.getReadMethod(); try { Object fieldBeanValue = method.invoke(beansList.get(i), (Object[]) null); if (fieldBeanValue != null) { if (fieldBeanValue.getClass().equals(Integer.class)) { if (excludeZero.equals(Boolean.TRUE)) { if (fieldBeanValue.equals(0)) { continue; } } } if (j > 0) { if (addBlankSpace) { stringBuilder.append(' '); stringBuilder.append(outputFieldsSeparator); stringBuilder.append(' '); } else { stringBuilder.append(outputFieldsSeparator); } } stringBuilder.append(fieldBeanValue.toString()); } } catch (IllegalAccessException iaex) { retValue.set(i, null); } catch (InvocationTargetException itex) { retValue.set(i, null); } } retValue.add(i, stringBuilder.toString()); } return retValue; }