List of usage examples for java.lang Long equals
public boolean equals(Object obj)
From source file:com.devnexus.ting.model.CfpSubmission.java
public Long getSpeakerIdForCfpSpeakerId(Long cfpSubmissionSpeakerId) { Assert.notNull(cfpSubmissionSpeakerId, "cfpSubmissionSpeakerId must not be null."); for (CfpSubmissionSpeaker speaker : this.getCfpSubmissionSpeakers()) { if (cfpSubmissionSpeakerId.equals(speaker.getId())) { return speaker.getSpeaker().getId(); }//from w w w . ja v a2 s . co m } throw new IllegalStateException("Could not find CFP Submission Speaker for id " + cfpSubmissionSpeakerId); }
From source file:org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils.java
/** * Determines whether the "fast stats" for the passed partitions are the same. * * @param oldPart Old partition to compare. * @param newPart New partition to compare. * @return true if the partitions are not null, contain all the "fast stats" and have the same values for these stats, otherwise false. *///from www . j av a2s. com public static boolean isFastStatsSame(Partition oldPart, Partition newPart) { // requires to calculate stats if new and old have different fast stats if ((oldPart != null) && oldPart.isSetParameters() && newPart != null && newPart.isSetParameters()) { for (String stat : StatsSetupConst.FAST_STATS) { if (oldPart.getParameters().containsKey(stat) && newPart.getParameters().containsKey(stat)) { Long oldStat = Long.parseLong(oldPart.getParameters().get(stat)); String newStat = newPart.getParameters().get(stat); if (newStat == null || !oldStat.equals(Long.parseLong(newStat))) { return false; } } else { return false; } } return true; } return false; }
From source file:jipdbs.web.processors.PlayerPenaltyProcessor.java
/** * //from w w w .j a v a2 s .c o m * @param req * @param penalty * @param type * @param reason * @param duration * @param durationType * @param redirect * @param player * @param server * @param currentPlayer * @return * @throws HttpError */ private String createPenalty(HttpServletRequest req, Penalty penalty, String type, String reason, String duration, String durationType, String redirect, Player player, Server server, Player currentPlayer) throws HttpError { penalty.setReason(reason); penalty.setPlayer(player.getKey()); if (currentPlayer != null) penalty.setAdmin(currentPlayer.getKey()); if (type.equals("notice")) { if (!UserServiceFactory.getUserService().hasPermission(server.getKey(), server.getPermission(RemotePermissions.ADD_NOTICE))) { Flash.error(req, MessageResource.getMessage("forbidden")); throw new HttpError(HttpServletResponse.SC_FORBIDDEN); } penalty.setType(Penalty.NOTICE); if ((server.getRemotePermission() & RemotePermissions.ADD_NOTICE) == RemotePermissions.ADD_NOTICE) { penalty.setSynced(false); penalty.setActive(false); Flash.info(req, MessageResource.getMessage("local_action_pending")); } else { penalty.setSynced(true); penalty.setActive(true); Flash.warn(req, MessageResource.getMessage("local_action_only")); } } else { if (!UserServiceFactory.getUserService().hasPermission(server.getKey(), server.getPermission(RemotePermissions.ADD_BAN))) { Flash.error(req, MessageResource.getMessage("forbidden")); throw new HttpError(HttpServletResponse.SC_FORBIDDEN); } Long dm = Functions.time2minutes(duration + durationType); if (dm > server.getBanPermission(currentPlayer.getLevel())) { Flash.warn(req, MessageResource.getMessage("duration_fixed")); dm = server.getBanPermission(currentPlayer.getLevel()); } if (dm.equals(0)) { Flash.error(req, MessageResource.getMessage("duration_field_required")); return redirect; } if ((server.getRemotePermission() & RemotePermissions.ADD_BAN) == RemotePermissions.ADD_BAN) { penalty.setSynced(false); penalty.setActive(false); Flash.info(req, MessageResource.getMessage("local_action_pending")); } else { Flash.error(req, MessageResource.getMessage("remote_action_not_available")); return redirect; } penalty.setType(Penalty.BAN); penalty.setDuration(dm); } return null; }
From source file:com.aliyun.odps.ship.common.RecordConverter.java
/** * tunnel record to byte[] array/*from www . j av a 2 s . c om*/ */ public byte[][] format(Record r) throws UnsupportedEncodingException { int cols = schema.getColumns().size(); byte[][] line = new byte[cols][]; byte[] colValue = null; for (int i = 0; i < cols; i++) { OdpsType t = schema.getColumn(i).getType(); switch (t) { case BIGINT: { Long v = r.getBigint(i); colValue = v == null ? null : v.toString().getBytes(defaultCharset); break; } case DOUBLE: { Double v = r.getDouble(i); if (v == null) { colValue = null; } else if (v.equals(Double.POSITIVE_INFINITY) || v.equals(Double.NEGATIVE_INFINITY)) { colValue = v.toString().getBytes(defaultCharset); } else { colValue = doubleFormat.format(v).replaceAll(",", "").getBytes(defaultCharset); } break; } case DATETIME: { Date v = r.getDatetime(i); if (v == null) { colValue = null; } else { colValue = dateFormatter.format(v).getBytes(defaultCharset); } break; } case BOOLEAN: { Boolean v = r.getBoolean(i); colValue = v == null ? null : v.toString().getBytes(defaultCharset); break; } case STRING: { byte[] v = r.getBytes(i); if (v == null) { colValue = null; } else if (Util.isIgnoreCharset(charset)) { colValue = v; } else { // data at ODPS side is always utf-8 colValue = new String(v, Constants.REMOTE_CHARSET).getBytes(charset); } break; } case DECIMAL: { BigDecimal v = r.getDecimal(i); colValue = v == null ? null : v.toPlainString().getBytes(defaultCharset); break; } default: throw new RuntimeException("Unknown column type: " + t); } if (colValue == null) { line[i] = nullBytes; } else { line[i] = colValue; } } return line; }
From source file:org.o3project.optsdn.don.NetworkInformation.java
/** * Get informations from IDEx file(idex.txt). * - DP ID// w w w .ja va2 s . co m * - OF Port * * @param filepath The IDEx file path * @throws Exception File Read Failed */ private void parseIdExFile(String filepath) throws Exception { String idexJson = readIdexAsJson(filepath); ObjectMapper mapper = new ObjectMapper(); @SuppressWarnings("unchecked") Map<String, Map<String, String>> value = mapper.readValue(idexJson, Map.class); Set<Entry<String, Map<String, String>>> entrySet = value.entrySet(); dpidMap = new HashMap<String, Long>(); Map<String, Integer> ofPortMap = new HashMap<String, Integer>(); for (Entry<String, Map<String, String>> entry : entrySet) { Map<String, String> params = entry.getValue(); BigInteger bigintDpid = new BigInteger(params.get(DPID)); if (bigintDpid.compareTo(BigInteger.valueOf(0)) < 0 || bigintDpid.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) { throw new Exception("DP ID is out of boundary. (DP ID valid between 0 and 2^63-1)"); } long dpid = bigintDpid.longValue(); String informationModelId = entry.getKey(); Port port = new Port(informationModelId); String neId = port.getNeId(); Long existDpid = dpidMap.get(neId); if (existDpid == null) { dpidMap.put(neId, dpid); } else if (!existDpid.equals(dpid)) { logger.warn("Fail to add DP ID[" + dpid + "]. " + "The DP ID of NE[" + neId + "] is already set" + "(exist DP ID[" + existDpid + "])."); } int ofPortId = Integer.valueOf(params.get(PORT)); Integer existOfPortId = ofPortMap.get(informationModelId); if (existOfPortId != null) { if (!existOfPortId.equals(ofPortId)) { logger.warn("Fail to add OpenFlow Port ID[" + ofPortId + "]. " + "The OpenFlow Port ID of Port[" + informationModelId + "] is already set" + "(exist OpenFlow Port ID[" + existOfPortId + "])."); } } else { if (ofPortId < 0 && ofPortId > Integer.MAX_VALUE) { throw new Exception("OpenFlow Port ID is out of boundary. " + "(OpenFlow Port ID valid between 0 and 2^31-1)"); } ofPortMap.put(informationModelId, ofPortId); } } for (Port port : portSet) { Integer openFlowPortId = ofPortMap.get(port.getInformationModelId()); if (openFlowPortId == null) { continue; } port.setOpenFlowPortId(openFlowPortId); } for (List<List<Port>> linkList : omsConnectionInfoListMap.values()) { for (List<Port> link : linkList) { Port port1 = link.get(0); Integer openFlowPortId1 = ofPortMap.get(port1.getInformationModelId()); if (openFlowPortId1 != null) { port1.setOpenFlowPortId(openFlowPortId1); } Port port2 = link.get(1); Integer openFlowPortId2 = ofPortMap.get(port2.getInformationModelId()); if (openFlowPortId2 != null) { port2.setOpenFlowPortId(openFlowPortId2); } } } }
From source file:org.apache.openmeetings.web.app.WebSession.java
public String getValidatedSid() { SessiondataDao sessionDao = getBean(SessiondataDao.class); Long _userId = sessionDao.check(SID); if (_userId == null || !_userId.equals(userId)) { Sessiondata sessionData = sessionDao.get(SID); if (sessionData == null) { sessionData = sessionDao.create(); }//www .j av a 2 s .c o m if (!sessionDao.updateUser(sessionData.getSessionId(), userId, false, languageId)) { //something bad, force user to re-login invalidate(); } else { SID = sessionData.getSessionId(); } } return SID; }
From source file:com.snapdeal.archive.service.impl.ArchivalServiceImpl.java
private boolean checkForEquality(Object childObject, Object parentObject, String columnType) { Boolean isEquals = Boolean.FALSE; switch (columnType) { case "Integer": Integer childVal = (Integer) childObject; Integer parentVal = (Integer) parentObject; isEquals = childVal.equals(parentVal); break;/*from w w w. j ava2 s. c o m*/ case "String": String childValStr = (String) childObject; String parentValStr = (String) parentObject; isEquals = childValStr.equals(parentValStr); break; case "Long": Long childValLong = (Long) childObject; Long parentValLong = (Long) parentObject; isEquals = childValLong.equals(parentValLong); break; } return isEquals; }
From source file:edu.amrita.aview.gclm.helpers.UserHelper.java
/** * Creates the user.// w w w . j a va 2 s. c o m * * @param user the user * @param creatorId the creator id * @param statusId the status id * @throws AViewException */ public static void createUser(User user, Long creatorId, Integer statusId) throws AViewException { // Code added to use the master admin id, if the user registers through aview website User adminUser = null; logger.info( "User creation " + user.getUserName() + " by creator: " + creatorId + " with status " + statusId); //Fix for Bug #13729 start if (creatorId.equals(new Long(0))) //Fix for Bug #13729 end { statusId = StatusHelper.getPendingStatusId(); //adminUser = getUsersByRole(Constant.MASTER_ADMIN_ROLE); adminUser = getUserByUserName(Constant.MASTER_ADMIN_USER_NAME); creatorId = adminUser.getUserId(); //Fix for Bug #13729 start user.setCreatedFrom(Constant.CREATED_FROM_WEB); //Fix for Bug #13729 end } user.setCreatedAuditData(creatorId, TimestampUtils.getCurrentTimestamp(), statusId); UserDAO.createUser(user); if (adminUser != null) { EmailHelper.sendEmailForNewUserRegistration(user.getEmail()); EmailHelper.sendEmailToAdminForNewUserRegistration(user.getUserName(), user.getFname(), user.getLname(), user.getEmail()); } }
From source file:net.archenemy.archenemyapp.presenter.BackgroundWorkerFragment.java
@Override public void onFeedRequestCompleted(ArrayList<Tweet> tweets, Long id) { if ((users != null) && (users.size() > 0)) { synchronized (twitterCallbackCount) { if ((tweets != null) && (id != null) && (tweets.size() > 0)) { for (SocialMediaUser user : users) { if (id.equals(user.getTwitterUserId())) { user.setTweets(tweets); break; }//from w w w .j a v a 2s. com } } twitterCallbackCount += 1; if ((twitterCallbackCount == twitterCallbackTotal) && (callback != null)) { callback.onTwitterFeedReceived(); } Log.i(TAG, "Received Twitter feed for twitter user id " + id.toString() + "."); } } }
From source file:no.abmu.user.service.AbstractUserImportService.java
protected boolean checkThatOrganisationUnitsHasNoUser(OrganisationUnitImportExcelParser excelParser) { boolean checkWentOK = true; excelParser.load();/*from w ww . j a va 2 s . c o m*/ for (; excelParser.hasNext(); excelParser.next()) { Long user = excelParser.getUser(); if (user != null && user.equals(Long.valueOf(1))) { String orgUnitName = excelParser.getBokmaalName(); String abmuId = excelParser.getABMU_ID(); OrganisationUnit organisationUnit = getSingleOrganisationUnit(abmuId, orgUnitName); Long orgUnitId = organisationUnit.getId(); UserFinderSpecification finder = new UserFinderSpecification(orgUnitId); Collection<User> users = userService.find(finder); if (users.size() > 0) { logger.warn("OrganisationUnit id='" + orgUnitId + "' name='" + organisationUnit.getName().getReference() + "' has allready '" + users.size() + "' user(s)."); checkWentOK = false; } } } return checkWentOK; }