List of usage examples for org.apache.commons.lang3 StringUtils equals
public static boolean equals(final CharSequence cs1, final CharSequence cs2)
Compares two CharSequences, returning true if they represent equal sequences of characters.
null s are handled without exceptions.
From source file:com.paopao.hzgzf.modules.dlj.service.ComClientBasicInfoService.java
private void dealWithRecord(ComClientBasicInfo newObj, ComClientBasicInfo oldObj) { List<ComRecord> records = new ArrayList<ComRecord>(); if (!StringUtils.equals(newObj.getAddress(), oldObj.getAddress())) { records.add(/*from w w w . jav a 2 s . c o m*/ genNewRecord("address", "?", oldObj.getId(), ComClientBasicInfo.REFER_TYPE_CLIENT, oldObj.getAddress(), newObj.getAddress(), oldObj.getOpId())); } if (!StringUtils.equals(newObj.getArchiveNo(), oldObj.getArchiveNo())) { records.add( genNewRecord("archiveNo", "?", oldObj.getId(), ComClientBasicInfo.REFER_TYPE_CLIENT, oldObj.getArchiveNo(), newObj.getArchiveNo(), oldObj.getOpId())); } if (!StringUtils.equals(newObj.getClientName(), oldObj.getClientName())) { records.add( genNewRecord("clientName", "??", oldObj.getId(), ComClientBasicInfo.REFER_TYPE_CLIENT, oldObj.getClientName(), newObj.getClientName(), oldObj.getOpId())); } if (!StringUtils.equals(newObj.getCardId(), oldObj.getCardId())) { records.add( genNewRecord("cardId", "???", oldObj.getId(), ComClientBasicInfo.REFER_TYPE_CLIENT, oldObj.getCardId(), newObj.getCardId(), oldObj.getOpId())); } if (!StringUtils.equals(newObj.getEstateLicense(), oldObj.getEstateLicense())) { records.add(genNewRecord("estateLicense", "??", oldObj.getId(), ComClientBasicInfo.REFER_TYPE_CLIENT, oldObj.getEstateLicense(), newObj.getEstateLicense(), oldObj.getOpId())); } if (!StringUtils.equals(newObj.getIssuingAuthority(), oldObj.getIssuingAuthority())) { records.add(genNewRecord("issuingAuthority", "??", oldObj.getId(), ComClientBasicInfo.REFER_TYPE_CLIENT, oldObj.getIssuingAuthority(), newObj.getIssuingAuthority(), oldObj.getOpId())); } if (!StringUtils.equals(newObj.getOperatorCardId(), oldObj.getOperatorCardId())) { records.add(genNewRecord("operatorCardId", "??", oldObj.getId(), ComClientBasicInfo.REFER_TYPE_CLIENT, oldObj.getOperatorCardId(), newObj.getOperatorCardId(), oldObj.getOpId())); } if (!StringUtils.equals(newObj.getOperatorName(), oldObj.getOperatorName())) { records.add(genNewRecord("operatorName", "??", oldObj.getId(), ComClientBasicInfo.REFER_TYPE_CLIENT, oldObj.getOperatorName(), newObj.getOperatorName(), oldObj.getOpId())); } if (!StringUtils.equals(newObj.getRemark(), oldObj.getRemark())) { records.add(genNewRecord("remark", "", oldObj.getId(), ComClientBasicInfo.REFER_TYPE_CLIENT, oldObj.getRemark(), newObj.getRemark(), oldObj.getOpId())); } if (records.isEmpty()) { return; } for (ComRecord comRecord : records) { comRecord.setIsAttach(ComRecord.NOT_ATTACH); comRecord.setModifyType(ComRecord.MOD_NOR); comRecord.setOpId(UserUtils.getUser().getId()); comRecordService.save(comRecord); } }
From source file:de.micromata.genome.gwiki.web.StaticFileServlet.java
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String uri = req.getPathInfo(); String servletp = req.getServletPath(); String respath = servletp + uri; if (uri == null) { resp.sendError(HttpServletResponse.SC_NOT_FOUND); return;//from w w w. ja v a 2 s . c o m } InputStream is = getServletContext().getResourceAsStream(respath); if (is == null) { resp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } long nt = new Date().getTime() + TimeInMillis.DAY; String mime = MimeUtils.getMimeTypeFromFile(respath); if (StringUtils.equals(mime, "application/x-shockwave-flash")) { resp.setHeader("Cache-Control", "cache, must-revalidate"); resp.setHeader("Pragma", "public"); } resp.setDateHeader("Expires", nt); resp.setHeader("Cache-Control", "max-age=86400, public"); if (mime != null) { resp.setContentType(mime); } byte[] data = IOUtils.toByteArray(is); IOUtils.closeQuietly(is); resp.setContentLength(data.length); IOUtils.write(data, resp.getOutputStream()); }
From source file:info.magnolia.security.app.dialog.field.ConditionalReadOnlyTextFieldFactory.java
@Override public Field<String> createField() { Field<String> field = super.createField(); if (StringUtils.equals(field.getValue(), ((ConditionalReadOnlyTextFieldDefinition) getFieldDefinition()).getConditionalValue())) { Property property = field.getPropertyDataSource(); property.setReadOnly(true);//from w ww . j av a2s . c o m } return field; }
From source file:com.nridge.core.base.field.data.DataBagDiff.java
public void compare(DataField aField1, DataField aField2) { if (aField1.getType() != aField2.getType()) addStatus(aField1.getName(), Field.DIFF_STATUS_UPDATED, "Field data type differs."); if (!StringUtils.equals(aField1.getTitle(), aField2.getTitle())) addStatus(aField1.getName(), Field.DIFF_STATUS_UPDATED, "Field title differs."); if (aField1.getDisplaySize() != aField2.getDisplaySize()) addStatus(aField1.getName(), Field.DIFF_STATUS_UPDATED, "Field display size differs."); if (aField1.getSortOrder() != aField2.getSortOrder()) addStatus(aField1.getName(), Field.DIFF_STATUS_UPDATED, "Field sort order differs."); if (aField1.isRangeAssigned() == aField2.isRangeAssigned()) { if ((aField1.isRangeAssigned()) && (!aField1.getRange().isEqual(aField2.getRange()))) addStatus(aField1.getName(), Field.DIFF_STATUS_UPDATED, "Field ranges differ."); }/* ww w .java 2s .co m*/ if (!aField1.isValueEqual(aField2)) addStatus(aField1.getName(), Field.DIFF_STATUS_UPDATED, "Field values differ."); int featureCount1 = aField1.featureCount(); int featureCount2 = aField2.featureCount(); if (featureCount1 != featureCount2) addStatus(aField1.getName(), Field.DIFF_STATUS_UPDATED, "Field features differ."); else if (featureCount1 > 0) { String keyName1, keyValue1; for (Map.Entry<String, String> featureEntry : aField1.getFeatures().entrySet()) { keyName1 = featureEntry.getKey(); keyValue1 = featureEntry.getValue(); if (!aField2.getFeature(keyName1).equals(keyValue1)) { addStatus(aField1.getName(), Field.DIFF_STATUS_UPDATED, "Field features differ."); break; } } } }
From source file:io.wcm.handler.link.testcontext.DummyUrlHandlerConfig.java
@Override public boolean isSecure(Page page) { String templatePath = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class); return StringUtils.equals(templatePath, DummyAppTemplate.CONTENT_SECURE.getTemplatePath()); }
From source file:com.stefanbrenner.droplet.model.internal.Configuration.java
public static ISerialCommunicationService getSerialCommProvider() { String string = Configuration.PREFS.get(Configuration.CONF_SERIAL_COMM_PROVIDER, null); List<ISerialCommunicationService> plugins = PluginLoader.getPlugins(ISerialCommunicationService.class); for (ISerialCommunicationService commService : plugins) { if (StringUtils.equals(commService.getClass().getCanonicalName(), string)) { return commService; }/*from w ww . j a v a2 s .c o m*/ } // if no provider was found we use our own arduino service instead return Configuration.DEFAULT_SERIAL_COMM_PROVIDER; }
From source file:com.glaf.base.servlet.SpringDispatcherServlet.java
@Override protected void doService(HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug("RequestURI:" + request.getRequestURI()); try {/*from w w w.j ava 2s . c om*/ String systemName = RequestUtils.getCurrentSystem(request); if (systemName != null && !StringUtils.equals("GLAF", systemName)) { Environment.setCurrentSystemName(systemName); } String actorId = RequestUtils.getActorId(request); if (actorId != null) { // logger.debug("actorId:" + actorId); Authentication.setAuthenticatedAccount(actorId); } SysUser user = RequestUtil.getLoginUser(request); if (user != null) { Authentication.setAuthenticatedUser(user); com.glaf.core.security.Authentication.setAuthenticatedActorId(user.getAccount()); } /** * ?????? */ if ((user == null) || (!user.isSystemAdmin())) { String uri = request.getRequestURI(); logger.debug("request uri:" + uri); } } catch (Exception ex) { ex.printStackTrace(); } ThreadContextHolder.setHttpRequest(request); ThreadContextHolder.setHttpResponse(response); try { super.doService(request, response); } finally { Environment.removeCurrentSystemName(); Environment.clear(); Authentication.clear(); ThreadContextHolder.clear(); ConnectionThreadHolder.closeAndClear(); com.glaf.core.security.Authentication.clear(); } }
From source file:ch.cyberduck.core.sds.SDSDelegatingMoveFeature.java
@Override public void move(final Path source, final Path target, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { final Path srcContainer = containerService.getContainer(source); final Path targetContainer = containerService.getContainer(target); if (srcContainer.getType().contains(Path.Type.vault) || targetContainer.getType().contains(Path.Type.vault)) { if (StringUtils.equals(srcContainer.getName(), targetContainer.getName())) { proxy.move(source, target, status, callback, connectionCallback); } else {/*from w w w .jav a 2s .c o m*/ // Moving into or from an encrypted room final Copy copy = session.getFeature(Copy.class); if (log.isDebugEnabled()) { log.debug(String.format("Move %s to %s using copy feature %s", source, target, copy)); } copy.copy(source, target, status, connectionCallback); // Delete source file after copy is complete final Delete delete = session.getFeature(Delete.class); if (delete.isSupported(source)) { delete.delete(Collections.singletonList(source), connectionCallback, callback); } } } else { proxy.move(source, target, status, callback, connectionCallback); } }
From source file:com.adobe.cq.wcm.core.components.internal.form.FormStructureHelperImpl.java
@Override public Resource getFormResource(Resource resource) { if (resource == null || StringUtils.equals(resource.getPath(), "/")) { return null; }//ww w . j a v a 2 s . co m for (String resourceType : FormConstants.RT_ALL_CORE_FORM_CONTAINER) { if (resource.isResourceType(resourceType)) { return resource; } } return getFormResource(resource.getParent()); }
From source file:io.adeptj.runtime.server.IdmUtil.java
/** * Verify the given credentials./* w ww . j a v a2 s . c om*/ * * @param username one from configs. * @param id one that is submitted by client. * @param password one that is submitted by client. * @return boolean to indicate whether the credentials verification was successful or not. */ private static boolean verifyCredentials(String username, String id, char[] password) { return StringUtils.equals(username, id) && isNotEmpty(password) && match(username, new String(password)); }