List of usage examples for org.apache.wicket.util.lang Objects equal
public static boolean equal(final Object a, final Object b)
From source file:com.googlecode.wicketelements.components.lists.ComponentListPanel.java
License:Apache License
private void init(final ComponentListModel componentListModelParam) { final ListView<Component> listView = new ListView<Component>("componentList", componentListModelParam) { @Override// w w w .ja v a 2 s . c o m protected void populateItem(final ListItem<Component> itemParam) { final Component component = itemParam.getModelObject(); PRE_COND.String.requireNotBlank(component.getId(), "The ComponentList elements must have an id which is not blank."); PRE_COND.Logic.requireTrue(Objects.equal(LIST_ELEMENT_WICKET_ID, component.getId()), "The ComponentList elements must have the id: " + LIST_ELEMENT_WICKET_ID); itemParam.add(component); onItem(itemParam); if (isFirstItem(itemParam)) { onFirstItem(itemParam); } if (isLastItem(itemParam)) { onLastItem(itemParam); } } }; add(listView); }
From source file:com.norconex.jefmon.instance.JEFMonInstance.java
License:Apache License
public JobSuiteStatusSnapshot getJobSuiteStatuses(String suiteId) { for (JobSuiteStatusSnapshot snapshot : getJobSuitesStatuses()) { if (Objects.equal(snapshot.getRoot().getJobId(), suiteId)) { return snapshot; }//from ww w .ja v a2s. c om } return null; }
From source file:com.norconex.jefmon.JEFMonApplication.java
License:Apache License
@Override protected void init() { String enc = getRequestCycleSettings().getResponseRequestEncoding(); if (!Objects.equal(enc, CharEncoding.UTF_8)) { LOG.info("Response/Request encoding detected was \"" + enc + "\". Switching to UTF-8"); getRequestCycleSettings().setResponseRequestEncoding(CharEncoding.UTF_8); getMarkupSettings().setDefaultMarkupEncoding(CharEncoding.UTF_8); }// w w w.ja v a 2 s . c o m initJobActions(); mountPage("settings", SettingsPage.class); mountPage("suites/json", JobSuiteProgressJsonPage.class); mountPage("jobs", InstancePage.class); getMarkupSettings().setStripWicketTags(true); statusesMonitor.startMonitoring(); }
From source file:com.pushinginertia.wicket.core.form.behavior.RealFullNameValidator.java
License:Open Source License
@Override public void validate(final Form<?> form) { // 1. minimum length and no dot if (!satisfiesLengthWithoutDot(firstName)) { LOG.info(toLogString(form, firstName)); error(firstName);//from w w w . ja va 2s . c o m return; } if (!satisfiesLengthWithoutDot(familyName)) { LOG.info(toLogString(form, familyName)); error(familyName); return; } // 2. check equality if (Objects.equal(firstName.getInput().toLowerCase(), familyName.getInput().toLowerCase())) { LOG.info(toLogString(form, firstName)); error(firstName); return; } // 3. check for illegal characters if (CharUtils.inCharArray(firstName.getInput(), ILLEGAL_CHARS) >= 0) { LOG.info(toLogString(form, firstName)); error(firstName); return; } if (CharUtils.inCharArray(familyName.getInput(), ILLEGAL_CHARS) >= 0) { LOG.info(toLogString(form, familyName)); error(familyName); return; } // 4. check for title in the first name such as "Mr." or "Mrs." if (containsTitle(firstName)) { LOG.info(toLogString(form, firstName)); error(firstName); return; } // 5. check for all vowels or consonants in the name if (allVowelsOrConsonants(firstName.getInput())) { LOG.info(toLogString(form, firstName)); error(firstName); return; } if (allVowelsOrConsonants(familyName.getInput())) { LOG.info(toLogString(form, familyName)); error(familyName); } // 6. reject domains if (isDomain(firstName.getInput())) { LOG.info(toLogString(form, firstName)); error(firstName); return; } if (isDomain(familyName.getInput())) { LOG.info(toLogString(form, familyName)); error(familyName); return; } // 7. check for one character limits if (exceedsOneCharLimits(firstName.getInput())) { LOG.info(toLogString(form, firstName)); error(firstName); return; } if (exceedsOneCharLimits(familyName.getInput())) { LOG.info(toLogString(form, familyName)); error(familyName); return; } // 8. check that first and last characters are letters if (!firstAndLastAreLetters(firstName.getInput())) { LOG.info(toLogString(form, firstName)); error(firstName); return; } if (!firstAndLastAreLetters(familyName.getInput())) { LOG.info(toLogString(form, familyName)); error(familyName); } }
From source file:com.pushinginertia.wicket.core.form.validation.NotEqualInputValidator.java
License:Open Source License
/** * @see org.apache.wicket.markup.html.form.validation.IFormValidator#validate(org.apache.wicket.markup.html.form.Form) *//*w ww . ja va 2 s .co m*/ public void validate(final Form<?> form) { // we have a choice to validate the type converted values or the raw // input values, we validate the raw input final FormComponent<String> formComponent1 = components[0]; final FormComponent<String> formComponent2 = components[1]; if (Objects.equal(formComponent1.getInput(), formComponent2.getInput())) { error(formComponent2); } }
From source file:com.romeikat.datamessie.core.sync.service.template.withIdAndVersion.CreateOrUpdateExecutor.java
License:Open Source License
private void updateVersion(final StatelessSession rhsStatelessSession, final E lhsEntity, final E rhsEntity) { if (Objects.equal(lhsEntity.getVersion(), rhsEntity.getVersion())) { return;//w w w.ja va 2 s .c om } final String queryString = "UPDATE " + clazz.getSimpleName() + " SET version = :_version WHERE id = :_id"; final Query<?> query = rhsStatelessSession.createQuery(queryString); query.setParameter("_id", rhsEntity.getId()); query.setParameter("_version", lhsEntity.getVersion()); query.executeUpdate(); }
From source file:de.flapdoodle.tests.TestVariations.java
License:Apache License
@Test public void usage() { Set<IJoinedSample<Integer, Boolean, ISample<Boolean>>> notEquals = new HashSet<IJoinedSample<Integer, Boolean, ISample<Boolean>>>(); IGenerator<Integer, IJoinedSample<Integer, Boolean, ISample<Boolean>>> variations = Variations .of(Variation.of(1, 2, 3, 4, 5, 6, 7), Variations.of(Variation.bool())); while (variations.hasNext()) { IJoinedSample<Integer, Boolean, ISample<Boolean>> sample = variations.get(); int number = sample.get(); boolean flag = sample.next().get(); if (!Objects.equal(one(number, flag), two(number, flag))) { notEquals.add(sample);//from w w w.ja v a 2 s .c om } } Assert.assertEquals("" + notEquals, 2, notEquals.size()); }
From source file:eu.uqasar.web.pages.user.panels.UserProfilePanel.java
License:Apache License
private boolean editingMyself() { return user != null && user.getId() != null && UQSession.exists() && UQSession.get().getLoggedInUser() != null && Objects.equal(user.getId(), UQSession.get().getLoggedInUser().getId()); }
From source file:jp.xet.uncommons.wicket.behavior.NotEqualInputValidator.java
License:Apache License
@Override public void validate(Form<?> form) { // we have a choice to validate the type converted values or the raw // input values, we validate the raw input final FormComponent<?> formComponent1 = components[0]; final FormComponent<?> formComponent2 = components[1]; if (Objects.equal(formComponent1.getInput(), formComponent2.getInput())) { error(formComponent2);//ww w. java2s . c o m } }
From source file:jp.xet.uncommons.wicket.gp.CsrfSecureForm.java
License:Apache License
@Override protected void onValidate() { super.onValidate(); IRequestParameters params = getRequest().getRequestParameters(); String actualKey = params.getParameterValue(INPUT_NAME).toString(); logger.trace("CSRF checking {}:{} - actual = {}, expected = {}", new Object[] { getPage().getClass().getName(), getPageRelativePath(), actualKey, csrfToken }); if (ignoreKeyForTest == false && Objects.equal(actualKey, csrfToken) == false) { logger.warn("CSRF detected in {}:{} - actual = {}, expected = {}", new Object[] { getPage().getClass().getName(), getPageRelativePath(), actualKey, csrfToken }); throw new AbortWithHttpErrorCodeException(HttpServletResponse.SC_BAD_REQUEST); } else {/*from w ww.java 2 s . c om*/ logger.debug("submit successfully."); initCsrfToken(); } }