Java Code Examples for org.apache.commons.lang3.ObjectUtils#notEqual()
The following examples show how to use
org.apache.commons.lang3.ObjectUtils#notEqual() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MobileDeviceDAOImpl.java From arcusplatform with Apache License 2.0 | 6 votes |
private MobileDeviceSaveResult doUpdate(MobileDevice device) { MobileDevice current = findOne(device.getPersonId(), device.getDeviceIndex()); if (ObjectUtils.notEqual(current.getLastLatitude(), device.getLastLatitude()) || ObjectUtils.notEqual(current.getLastLongitude(), device.getLastLongitude())){ device.setLastLocationTime(new Date()); } BatchStatement batch = new BatchStatement(); addUpsertToBatch(batch, device); // only update the token if it exists already if (!tryTokenIndexUpdateForDevice(device)){ /* * if the tryTokenIndexUpdateForDevice failed the new key didn't exist * already or device.getNotificationToken() was blank or null */ addTokenIndexDeleteToBatch(batch, current); // delete the old row addTokenIndexInsertToBatch(batch, device); // insert the new row } session.execute(batch); MobileDeviceSaveResult saveResult = new MobileDeviceSaveResult(device); return saveResult; }
Example 2
Source File: ExtendedMessageFormat.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if this extended message format is equal to another object. * * @param obj the object to compare to * @return true if this object equals the other, otherwise false */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!super.equals(obj)) { return false; } if (ObjectUtils.notEqual(getClass(), obj.getClass())) { return false; } ExtendedMessageFormat rhs = (ExtendedMessageFormat)obj; if (ObjectUtils.notEqual(toPattern, rhs.toPattern)) { return false; } if (ObjectUtils.notEqual(registry, rhs.registry)) { return false; } return true; }
Example 3
Source File: ExtendedMessageFormat.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if this extended message format is equal to another object. * * @param obj the object to compare to * @return true if this object equals the other, otherwise false */ @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!super.equals(obj)) { return false; } if (ObjectUtils.notEqual(getClass(), obj.getClass())) { return false; } final ExtendedMessageFormat rhs = (ExtendedMessageFormat)obj; if (ObjectUtils.notEqual(toPattern, rhs.toPattern)) { return false; } if (ObjectUtils.notEqual(registry, rhs.registry)) { return false; } return true; }
Example 4
Source File: ExtendedMessageFormat.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if this extended message format is equal to another object. * * @param obj the object to compare to * @return true if this object equals the other, otherwise false */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!super.equals(obj)) { return false; } if (ObjectUtils.notEqual(getClass(), obj.getClass())) { return false; } ExtendedMessageFormat rhs = (ExtendedMessageFormat)obj; if (ObjectUtils.notEqual(toPattern, rhs.toPattern)) { return false; } if (ObjectUtils.notEqual(registry, rhs.registry)) { return false; } return true; }
Example 5
Source File: ExtendedMessageFormat.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if this extended message format is equal to another object. * * @param obj the object to compare to * @return true if this object equals the other, otherwise false */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!super.equals(obj)) { return false; } if (ObjectUtils.notEqual(getClass(), obj.getClass())) { return false; } ExtendedMessageFormat rhs = (ExtendedMessageFormat)obj; if (ObjectUtils.notEqual(toPattern, rhs.toPattern)) { return false; } if (ObjectUtils.notEqual(registry, rhs.registry)) { return false; } return true; }
Example 6
Source File: Lang_23_ExtendedMessageFormat_t.java From coming with MIT License | 6 votes |
/** * Check if this extended message format is equal to another object. * * @param obj the object to compare to * @return true if this object equals the other, otherwise false */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!super.equals(obj)) { return false; } if (ObjectUtils.notEqual(getClass(), obj.getClass())) { return false; } ExtendedMessageFormat rhs = (ExtendedMessageFormat)obj; if (ObjectUtils.notEqual(toPattern, rhs.toPattern)) { return false; } if (ObjectUtils.notEqual(registry, rhs.registry)) { return false; } return true; }
Example 7
Source File: KeyItemImportExportLineItem.java From estatio with Apache License 2.0 | 6 votes |
private Status calculateStatus() { if (getProperty() == null || getUnit() == null || getKeyTable() == null) { return Status.NOT_FOUND; } if (getKeyItem() == null) { return Status.ADDED; } if (ObjectUtils.notEqual(getKeyItem().getValue().setScale(6, BigDecimal.ROUND_HALF_UP), getKeyValue().setScale(6, BigDecimal.ROUND_HALF_UP)) || ObjectUtils.notEqual(getKeyItem().getSourceValue().setScale(6, BigDecimal.ROUND_HALF_UP), getSourceValue().setScale(6, BigDecimal.ROUND_HALF_UP))) { return Status.UPDATED; } // added for newly created lines for deleted items if (getStatus() == Status.DELETED) { return Status.DELETED; } return Status.UNCHANGED; }
Example 8
Source File: HttpUploadFeature.java From cyberduck with GNU General Public License v3.0 | 6 votes |
protected void verify(final Path file, final MessageDigest digest, final Checksum checksum) throws ChecksumException { if(file.getType().contains(Path.Type.encrypted)) { log.warn(String.format("Skip checksum verification for %s with client side encryption enabled", file)); return; } if(null == digest) { log.debug(String.format("Digest disabled for file %s", file)); return; } // Obtain locally-calculated MD5 hash. final Checksum expected = Checksum.parse(Hex.encodeHexString(digest.digest())); if(ObjectUtils.notEqual(expected.algorithm, checksum.algorithm)) { log.warn(String.format("ETag %s returned by server is %s but expected %s", checksum.hash, checksum.algorithm, expected.algorithm)); } else { // Compare our locally-calculated hash with the ETag returned by S3. if(!checksum.equals(expected)) { throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()), MessageFormat.format("Mismatch between MD5 hash {0} of uploaded data and ETag {1} returned by the server", expected, checksum.hash)); } } }
Example 9
Source File: VectorSessionToken.java From azure-cosmosdb-java with MIT License | 6 votes |
private boolean areRegionProgressEqual(UnmodifiableMap<Integer, Long> other) { if (this.localLsnByRegion.size() != other.size()) { return false; } for (Map.Entry<Integer, Long> kvp : this.localLsnByRegion.entrySet()) { Integer regionId = kvp.getKey(); ValueHolder<Long> localLsn1 = ValueHolder.initialize(kvp.getValue()); ValueHolder<Long> localLsn2 = ValueHolder.initialize(-1l); if (Utils.tryGetValue(other, regionId, localLsn2)) { if (ObjectUtils.notEqual(localLsn1.v, localLsn2.v)) { return false; } } } return true; }
Example 10
Source File: LeaseTerm.java From estatio with Apache License 2.0 | 5 votes |
public void modifyStartDate(final LocalDate newStartDate) { if (ObjectUtils.notEqual(getStartDate(), newStartDate)) { setStartDate(newStartDate); if (getPrevious() != null) { getPrevious().align(); } } }
Example 11
Source File: Dude.java From viritin with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Dude other = (Dude) obj; if (ObjectUtils.notEqual(age, other.age)) { return false; } if (firstName == null) { if (other.firstName != null) { return false; } } else if (!firstName.equals(other.firstName)) { return false; } if (id != other.id) { return false; } if (lastName == null) { if (other.lastName != null) { return false; } } else if (!lastName.equals(other.lastName)) { return false; } return true; }
Example 12
Source File: AdformRequestUtil.java From prebid-server-java with Apache License 2.0 | 5 votes |
/** * Retrieves gdpr from regs.ext.gdpr and in case of any exception or invalid values returns empty string. */ String getGdprApplies(Regs regs) { final ObjectNode extRegsNode = regs != null ? regs.getExt() : null; final ExtRegs extRegs; try { extRegs = extRegsNode != null ? mapper.mapper().treeToValue(extRegsNode, ExtRegs.class) : null; } catch (JsonProcessingException e) { return ""; } final String gdpr = extRegs != null ? Integer.toString(extRegs.getGdpr()) : ""; return ObjectUtils.notEqual(gdpr, "1") && ObjectUtils.notEqual(gdpr, "0") ? "" : gdpr; }
Example 13
Source File: EventUtil.java From prebid-server-java with Apache License 2.0 | 5 votes |
public static void validateType(RoutingContext context) { final String type = context.request().params().get(TYPE_PARAMETER); if (ObjectUtils.notEqual(type, IMP_TYPE) && ObjectUtils.notEqual(type, WIN_TYPE)) { throw new IllegalArgumentException(String.format( "Type '%s' is required query parameter. Possible values are %s and %s, but was %s", TYPE_PARAMETER, WIN_TYPE, IMP_TYPE, type)); } }
Example 14
Source File: PrivacyExtractor.java From prebid-server-java with Apache License 2.0 | 5 votes |
private static Privacy toValidPrivacy(String gdpr, String consent, String usPrivacy) { final String validGdpr = ObjectUtils.notEqual(gdpr, "1") && ObjectUtils.notEqual(gdpr, "0") ? DEFAULT_GDPR_VALUE : gdpr; final String validConsent = consent == null ? DEFAULT_CONSENT_VALUE : consent; final Ccpa validCCPA = usPrivacy == null ? DEFAULT_CCPA_VALUE : toValidCcpa(usPrivacy); return Privacy.of(validGdpr, validConsent, validCCPA); }
Example 15
Source File: Element.java From recheck with GNU Affero General Public License v3.0 | 5 votes |
private void addPathChangeToChangeSet( final ActionChangeSet actionChangeSet, final IdentifyingAttributes newIdentAttributes, final Element oldElement ) { if ( ObjectUtils.notEqual( identifyingAttributes.getPathTyped(), newIdentAttributes.getPathTyped() ) ) { final Path oldPath = oldElement.identifyingAttributes.getPathTyped(); final Path newPath = Path.fromString( newIdentAttributes.getPath() + Path.PATH_SEPARATOR + oldElement.identifyingAttributes.getPathElement().toString() ); actionChangeSet.getIdentAttributeChanges().add( oldElement.identifyingAttributes, new AttributeDifference( "path", oldPath, newPath ) ); } }
Example 16
Source File: Dude.java From viritin with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Dude other = (Dude) obj; if (ObjectUtils.notEqual(age, other.age)) { return false; } if (firstName == null) { if (other.firstName != null) { return false; } } else if (!firstName.equals(other.firstName)) { return false; } if (id != other.id) { return false; } if (lastName == null) { if (other.lastName != null) { return false; } } else if (!lastName.equals(other.lastName)) { return false; } return true; }
Example 17
Source File: AeroRemoteApiController.java From webanno with Apache License 2.0 | 4 votes |
private CAS createCompatibleCas(long aProjectId, long aDocumentId, MultipartFile aFile, Optional<String> aFormatId) throws RemoteApiException, ClassNotFoundException, IOException, UIMAException { Project project = getProject(aProjectId); SourceDocument document = getDocument(project, aDocumentId); // Check if the format is supported String format = aFormatId.orElse(FORMAT_DEFAULT); if (!importExportService.getReadableFormatById(format).isPresent()) { throw new UnsupportedFormatException( "Format [%s] not supported. Acceptable formats are %s.", format, importExportService.getReadableFormats().stream() .map(FormatSupport::getId).sorted().collect(Collectors.toList())); } // Convert the uploaded annotation document into a CAS File tmpFile = null; CAS annotationCas; try { tmpFile = File.createTempFile("upload", ".bin"); aFile.transferTo(tmpFile); annotationCas = importExportService.importCasFromFile(tmpFile, project, format); } finally { if (tmpFile != null) { FileUtils.forceDelete(tmpFile); } } // Check if the uploaded file is compatible with the source document. They are compatible // if the text is the same and if all the token and sentence annotations have the same // offsets. CAS initialCas = documentService.createOrReadInitialCas(document); String initialText = initialCas.getDocumentText(); String annotationText = annotationCas.getDocumentText(); // If any of the texts contains tailing line breaks, we ignore that. We assume at the moment // that nobody will have created annotations over that trailing line breaks. initialText = StringUtils.chomp(initialText); annotationText = StringUtils.chomp(annotationText); if (ObjectUtils.notEqual(initialText, annotationText)) { int diffIndex = StringUtils.indexOfDifference(initialText, annotationText); String expected = initialText.substring(diffIndex, Math.min(initialText.length(), diffIndex + 20)); String actual = annotationText.substring(diffIndex, Math.min(annotationText.length(), diffIndex + 20)); throw new IncompatibleDocumentException( "Text of annotation document does not match text of source document at offset " + "[%d]. Expected [%s] but found [%s].", diffIndex, expected, actual); } // Just in case we really had to chomp off a trailing line break from the annotation CAS, // make sure we copy over the proper text from the initial CAS // NOT AT HOME THIS YOU SHOULD TRY // SETTING THE SOFA STRING FORCEFULLY FOLLOWING THE DARK SIDE IS! forceOverwriteSofa(annotationCas, initialCas.getDocumentText()); Collection<AnnotationFS> annotationSentences = selectSentences(annotationCas); Collection<AnnotationFS> initialSentences = selectSentences(initialCas); if (annotationSentences.size() != initialSentences.size()) { throw new IncompatibleDocumentException( "Expected [%d] sentences, but annotation document contains [%d] sentences.", initialSentences.size(), annotationSentences.size()); } assertCompatibleOffsets(initialSentences, annotationSentences); Collection<AnnotationFS> annotationTokens = selectTokens(annotationCas); Collection<AnnotationFS> initialTokens = selectTokens(initialCas); if (annotationTokens.size() != initialTokens.size()) { throw new IncompatibleDocumentException( "Expected [%d] sentences, but annotation document contains [%d] sentences.", initialSentences.size(), annotationSentences.size()); } assertCompatibleOffsets(initialTokens, annotationTokens); return annotationCas; }
Example 18
Source File: SysUserServiceImpl.java From open-capacity-platform with Apache License 2.0 | 4 votes |
@Transactional @Override public SysUser updateSysUser(SysUser sysUser) { sysUser.setUpdateTime(new Date()); Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication instanceof OAuth2Authentication) { OAuth2Authentication oAuth2Auth = (OAuth2Authentication) authentication; authentication = oAuth2Auth.getUserAuthentication(); OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) oAuth2Auth.getDetails(); LoginAppUser user = SysUserUtil.getLoginAppUser(); if (user != null) { if ( !ObjectUtils.notEqual(user.getId(),sysUser.getId()) ) { OAuth2AccessToken token = redisTokenStore.readAccessToken(details.getTokenValue()); if (token != null) { if (!StringUtils.isBlank(sysUser.getHeadImgUrl())) { user.setHeadImgUrl(sysUser.getHeadImgUrl()); } if (!StringUtils.isBlank(sysUser.getNewPassword())) { user.setPassword(sysUser.getNewPassword()); } if (!StringUtils.isBlank(sysUser.getNewPassword())) { user.setPassword(sysUser.getNewPassword()); } if (!StringUtils.isBlank(sysUser.getNickname())) { user.setNickname(sysUser.getNickname()); } if (!StringUtils.isBlank(sysUser.getPhone())){ user.setPhone(sysUser.getPhone()); } if (sysUser.getSex() != null) { user.setSex(sysUser.getSex()); } UsernamePasswordAuthenticationToken userAuthentication = new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities()); OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(oAuth2Auth.getOAuth2Request(), userAuthentication); oAuth2Authentication.setAuthenticated(true); redisTokenStore.storeAccessToken(token, oAuth2Authentication); } } } } sysUserDao.updateByOps(sysUser); log.info("修改用户:{}", sysUser); return sysUser; }
Example 19
Source File: LeaseTerm.java From estatio with Apache License 2.0 | 4 votes |
public void modifyEndDate(final LocalDate newEndDate) { if (ObjectUtils.notEqual(getEndDate(), newEndDate)) { setEndDate(newEndDate); } }
Example 20
Source File: BaseHierarchicalConfiguration.java From commons-configuration with Apache License 2.0 | 2 votes |
/** * Tests whether a value is changed because of interpolation. * * @param interpolatedValue the interpolated value * @param value the original value * @return a flag whether the value was changed */ private boolean valueChanged(final Object interpolatedValue, final Object value) { return ObjectUtils.notEqual(interpolatedValue, value); }