/** * @return <code>true</code> if the given theme is equal to 'default'. Note that this is <b>not</b> the same as * checking for equality to {@link #getConfiguredTheme()}! */ public boolean isDefaultTheme(String theme) { return ObjectUtility.equals(theme, UiThemeProperty.DEFAULT_THEME); } }
@Override public void init(FilterConfig config) throws ServletException { // read config m_getMinSize = Integer.parseInt(ObjectUtility.nvl(config.getInitParameter("get_min_size"), "256")); m_postMinSize = Integer.parseInt(ObjectUtility.nvl(config.getInitParameter("post_min_size"), "256")); m_contentTypes = CollectionUtility.hashSet(StringUtility.split(ObjectUtility.nvl(config.getInitParameter("content_types"), CONTENT_TYPES), ",")); }
/** * @return <code>true</code> if the request payload should be included in the proxy call, <code>false</code> * otherwise. The default implementation returns <code>true</code> for POST and PUT requests. */ protected boolean shouldIncludeRequestPayload(HttpServletRequest req) { return ObjectUtility.isOneOf(req.getMethod(), "POST", "PUT"); }
private String getDiagnosticItemsXML(List<List<String>> result) { StringBuilder buf = new StringBuilder(); for (List<String> status : result) { if (ObjectUtility.notEquals(DiagnosticFactory.STATUS_TITLE, status.get(2))) { buf.append("<status name='").append(status.get(0)).append("' status='").append(status.get(2)).append("'>"); buf.append(status.get(1)); buf.append("</status>"); } } return buf.toString(); }
@Override protected void handleUiPropertyChange(String propertyName, JSONObject data) { if (IBooleanField.PROP_VALUE.equals(propertyName)) { Object o = data.opt(propertyName); Boolean uiValue = null; if (ObjectUtility.isOneOf(o, Boolean.TRUE, Boolean.FALSE)) { uiValue = (Boolean) o; } addPropertyEventFilterCondition(propertyName, uiValue); getModel().getUIFacade().setValueFromUI(uiValue); // In some cases the widget in the UI is clicked, which causes the check-box to be de-/selected, but the model rejects the value-change. // in that case we must "revert" the click in the UI, so that UI and model are in-sync again. This may happen, when the model-field throws // a VetoExeception in its execValidateValue() method. Boolean modelValue = getModel().getValue(); if (ObjectUtility.notEquals(uiValue, modelValue)) { addPropertyChangeEvent(propertyName, modelValue); } } else { super.handleUiPropertyChange(propertyName, data); } } }
ITableCustomizer tc = tablePage.getTable().getTableCustomizer(); byte[] curData = tc.getSerializedData(); if (ObjectUtility.notEquals(curData, newData)) { tc.removeAllColumns(); tc.setSerializedData(newData); TableUserFilterManager ufm = tablePage.getTable().getUserFilterManager(); byte[] curData = ufm.getSerializedData(); if (ObjectUtility.notEquals(curData, newData)) { try { ufm.setSerializedData(newData); String newSearchFilterState = tablePageState.getSearchFilterState(); String oldSearchFilterState = "" + createSearchFilterCRC(searchForm.getSearchFilter()); if (ObjectUtility.equals(oldSearchFilterState, newSearchFilterState)) { String newSearchFormState = tablePageState.getSearchFormState(); String oldSearchFormState = searchForm.storeToXmlString(); if (ObjectUtility.equals(oldSearchFormState, newSearchFormState)) { doSearch = false;
private int compareInternal(NUMBER a, NUMBER b) { return ObjectUtility.compareTo(NumberUtility.numberToBigDecimal(a), NumberUtility.numberToBigDecimal(b)); }
@SuppressWarnings("unchecked") protected IMarshaller createDefaultMarshaller(final Map<Object, Object> properties) { Object prop = properties.get(MARSHALLER); if (prop instanceof IMarshaller) { return (IMarshaller) prop; } else { Class<? extends IMarshaller> marshallerClass; String marshallerClassName = ObjectUtility.toString(prop); if (marshallerClassName != null) { try { marshallerClass = (Class<? extends IMarshaller>) Class.forName(marshallerClassName); } catch (final ClassNotFoundException | ClassCastException e) { throw new PlatformException("Failed to load class specified by environment property '{}' [value={}]", MARSHALLER, marshallerClassName, e); } } else { marshallerClass = CONFIG.getPropertyValue(DefaultMarshallerProperty.class); } return BEANS.get(marshallerClass); } }
public void popProperty(String propertyName) { if (ObjectUtility.notEquals(m_propertyStack.peek(), propertyName)) { throw new IllegalStateException("'" + propertyName + "' is not the last element in the stack: [" + CollectionUtility.format(m_propertyStack) + "]"); } m_propertyStack.pop(); }
private int compareInternal(NUMBER a, NUMBER b) { return ObjectUtility.compareTo(NumberUtility.numberToBigDecimal(a), NumberUtility.numberToBigDecimal(b)); }
/** * @return the identifier to name the {@link Connection}. */ protected String computeClientId(final Map<Object, Object> properties) { final String clientId = ObjectUtility.toString(properties.get(JMS_CLIENT_ID)); if (clientId != null) { return clientId; } final String nodeId = BEANS.get(NodeIdentifier.class).get(); return StringUtility.join(" ", m_symbolicName, StringUtility.box("(", nodeId, ")")); }
protected boolean isIdenticalEvent(T event1, T event2) { return ObjectUtility.equals(event1, event2); }
/** * Converts the space separated CSS class string to a list. */ static List<String> cssClassesAsList(String cssClass) { List<String> cssClasses = new ArrayList<>(); String cssClassesStr = ObjectUtility.nvl(cssClass, ""); cssClassesStr = cssClassesStr.trim(); if (cssClassesStr.length() > 0) { cssClasses = CollectionUtility.arrayList(cssClassesStr.split(" ")); } return cssClasses; } }
public void setText(String s) { if (ObjectUtility.notEquals(m_text, s)) { m_text = s; notifyObserver(TEXT_BIT); } }
@SuppressWarnings("squid:S1149") protected Hashtable<Object, Object> createContextEnvironment(final Map<Object, Object> properties) throws NamingException { Hashtable<Object, Object> env = new Hashtable<>(); if (properties != null) { for (Entry<Object, Object> entry : properties.entrySet()) { if (entry.getKey() == null || entry.getValue() == null) { LOG.info("ignoring property having null key or value [key={}, value={}]", entry.getKey(), entry.getValue()); } else if (ObjectUtility.isOneOf(entry.getKey(), CONNECTION_FACTORY, SYMBOLIC_NAME, MARSHALLER, REQUEST_REPLY_ENABLED, REQUEST_REPLY_CANCELLATION_TOPIC, JMS_CLIENT_ID)) { // Don't pass MOM-specific properties to the initial context to prevent problems with non-standard values. // For example, some containers throw an error if it finds an unserializable value. } else { env.put(entry.getKey(), entry.getValue()); } } } return env; }
private <T extends Comparable<T>> IStatus checkFromTo(IValueField<T> from, IValueField<T> to, boolean lessMessage) { if (from != null && to != null && ObjectUtility.compareTo(from.getValue(), to.getValue()) > 0) { if (lessMessage) { return new InvalidSequenceStatus(TEXTS.get("XMustBeLessThanOrEqualY", from.getLabel(), to.getLabel())); } else { return new InvalidSequenceStatus(TEXTS.get("XMustBeGreaterThanOrEqualY", to.getLabel(), from.getLabel())); } } return null; }
protected void initRequestReply(final Map<Object, Object> properties) throws JMSException { m_requestReplyEnabled = BooleanUtility.nvl( TypeCastUtility.castValue(properties.get(REQUEST_REPLY_ENABLED), Boolean.class), CONFIG.getPropertyValue(RequestReplyEnabledProperty.class)); if (!m_requestReplyEnabled) { LOG.info("{}: 'request-reply' messaging is disabled", m_symbolicName); return; } // Register consumer to handle cancellation requests for 'request-reply' communication. Object prop = properties.get(IMomImplementor.REQUEST_REPLY_CANCELLATION_TOPIC); if (prop instanceof IDestination) { m_requestReplyCancellationTopic = (IDestination<?>) prop; } else { final String cancellationTopicName = ObjectUtility.toString(prop); if (cancellationTopicName != null) { final DestinationConfigPropertyParser p = BEANS.get(DestinationConfigPropertyParser.class).parse(cancellationTopicName); m_requestReplyCancellationTopic = MOM.newDestination(p.getDestinationName(), DestinationType.TOPIC, p.getResolveMethod(), p.getParameters()); } else { m_requestReplyCancellationTopic = CONFIG.getPropertyValue(RequestReplyCancellationTopicProperty.class); } } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } HttpCacheKey other = (HttpCacheKey) obj; return ObjectUtility.equals(m_resourcePath, other.m_resourcePath) && ObjectUtility.equals(m_attributes, other.m_attributes); }
/** * @param resp * May be null, since this method can be called during a client-job, when no response is available. In that * case no cookie is written. * @param session * HTTP session * @param theme * <code>null</code> will reset the theme to the configured theme */ public void storeTheme(HttpServletResponse resp, HttpSession session, String theme) { theme = ObjectUtility.nvl(theme, getConfiguredTheme()); if (resp != null) { CookieUtility.addPersistentCookie(resp, THEME_COOKIE_NAME, theme); } session.setAttribute(THEME_SESSION_ATTRIBUTE, theme); }
/** * Gets if the given cell values are equal to the given search values * * @param searchValues * The values to search in the given cells. Must not be <code>null</code>. * @param keyColumns * The columns describing the cells to be searched. Must not be <code>null</code>. * @param row * The row holding the cells to be searched. Must not be <code>null</code>. * @return <code>true</code> if the cells described by the given columns and row have the same content as the given * searchValues. <code>false</code> otherwise. If the number of columns is different than the number of search * values only the columns are searched for which a search value exists ( * <code>min(searchValues.size(), keyColumns.size()</code>). */ protected boolean areCellsEqual(List<?> searchValues, List<IColumn<?>> keyColumns, ITableRow row) { int keyIndex = 0; int numKeyColumns = keyColumns.size(); for (Object key : searchValues) { if (keyIndex >= numKeyColumns) { break; } Object cellValue = keyColumns.get(keyIndex).getValue(row); if (ObjectUtility.notEquals(key, cellValue)) { return false; } keyIndex++; } return true; }