List of usage examples for java.lang Long equals
public boolean equals(Object obj)
From source file:com.wms.utils.DataUtil.java
public static boolean isNullOrZero(Long value) { return (value == null || value.equals(0L)); }
From source file:ips1ap101.lib.core.control.Controlador.java
static FuncionBase getFuncion(Long id) { if (id == null) { return null; }// w ww . java 2s . com List<? extends FuncionBase> funciones = getFunciones(); if (funciones == null || funciones.isEmpty()) { return null; } for (FuncionBase funcion : funciones) { if (id.equals(funcion.getIdFuncion())) { return funcion; } } return null; }
From source file:net.spfbl.data.Trap.java
private synchronized static boolean addTrapExact(String token) { if (token == null) { return false; } else {//w w w . j ava2s . c o m Long time = MAP.put(token, 0L); if (time == null || !time.equals(0L)) { return CHANGED = true; } else { return false; } } }
From source file:org.apache.openmeetings.web.app.Application.java
public static boolean isUserOnline(Long userId) { MapIterator<MultiKey<? extends String>, org.apache.openmeetings.web.app.Client> it = ONLINE_USERS .mapIterator();//from www . j a v a 2s. c om boolean isUserOnline = false; while (it.hasNext()) { MultiKey<? extends String> multi = it.next(); if (multi.size() > 0 && userId.equals(multi.getKey(0))) { isUserOnline = true; break; } } return isUserOnline; }
From source file:edu.harvard.iq.dvn.core.web.StudyListing.java
public static StudyListing getStudyListingFromMap(String slIndex, Map sessionMap, Long currentVdcId) { OrderedMap slMap = (OrderedMap) sessionMap.get("studyListings"); if (slMap != null) { StudyListing sl = (StudyListing) slMap.get(slIndex); if (sl != null) { // make sure the user is in the current vdc for this study listing //Long currentVdcId = getVDCRequestBean().getCurrentVDCId(); if (currentVdcId == null) { if (sl.getVdcId() != null) { sl = new StudyListing(StudyListing.INCORRECT_VDC); }//from ww w. j a v a 2s .c o m } else { if (!currentVdcId.equals(sl.getVdcId())) { sl = new StudyListing(StudyListing.INCORRECT_VDC); } } return sl; } } // this means that this studyListing or the session has expired return new StudyListing(StudyListing.EXPIRED_LIST); }
From source file:mailbox.EmailHandler.java
/** * Fetches new emails from the given IMAP folder and process them. * * @param folder//from ww w.j a va 2 s.c o m * @throws MessagingException */ static void handleNewMessages(IMAPFolder folder) throws MessagingException { Long lastUIDValidity = Property.getLong(Property.Name.MAILBOX_LAST_UID_VALIDITY); Long lastSeenUID = Property.getLong(Property.Name.MAILBOX_LAST_SEEN_UID); long uidValidity = folder.getUIDValidity(); // Get new messages and handle them if (lastUIDValidity != null && lastUIDValidity.equals(uidValidity) && lastSeenUID != null) { // Use the next uid instead of folder.LASTUID which possibly be // smaller than lastSeenUID + 1. handleMessages(folder, folder.getMessagesByUID(lastSeenUID + 1, folder.getUIDNext())); } Property.set(Property.Name.MAILBOX_LAST_UID_VALIDITY, uidValidity); }
From source file:org.apache.openmeetings.web.app.Application.java
public static List<org.apache.openmeetings.web.app.Client> getClients(Long userId) { List<org.apache.openmeetings.web.app.Client> result = new ArrayList<org.apache.openmeetings.web.app.Client>(); MapIterator<MultiKey<? extends String>, org.apache.openmeetings.web.app.Client> it = ONLINE_USERS .mapIterator();/*from ww w. j a v a 2 s. c o m*/ while (it.hasNext()) { MultiKey<? extends String> multi = it.next(); if (multi.size() > 1 && userId.equals(multi.getKey(0))) { result.add(getClientByKeys(userId, (String) (multi.getKey(1)))); break; } } return result; }
From source file:ome.tools.hibernate.HibernateUtils.java
/** * returns true under the following circumstatnces: * <ul>// w w w . ja v a 2 s . c om * <li>both arguments are null, or</li> * <li>both arguments are identical (==), or</li> * <li>both arguments have the same id value(equals)</li> * </ul> */ public static boolean idEqual(IObject arg1, IObject arg2) { // arg1 is null if (arg1 == null) { // both are null, therefore equal if (arg2 == null) { return true; } // just arg1 is null, can't be equal return false; } // just arg2 is null, also can't be equal else if (arg2 == null) { return false; } // neither argument is null, // so let's move a level down, // but first test reference equality // as a performance op. if (arg1 == arg2) { return true; // OP } Long arg1_id = arg1.getId(); Long arg2_id = arg2.getId(); // arg1_id is null if (arg1_id == null) { // both are null, and not identical (see OP above) // therefore different if (arg2_id == null) { return false; } // just arg2_id is null, can't be equal return false; } // just arg2_id null, and also can't be equal else if (arg2_id == null) { return false; } else { return arg1_id.equals(arg2_id); } }
From source file:org.test.skeleton.core.security.MessagePermissionEvaluator.java
@Override public boolean hasPermission(Authentication authentication, Object targetDomainObject, Object permission) { if (authentication == null) { return false; }/*ww w .java 2 s. c o m*/ Message message = (Message) targetDomainObject; if (message == null) { return true; } User currentUser = (User) authentication.getPrincipal(); Long currentId = currentUser.getId(); return currentId.equals(message.getTo().getId()) || currentId.equals(message.getFrom().getId()); }
From source file:cz.muni.fi.editor.services.commons.impl.EditorAccessVoterImpl.java
@Override public boolean profile(Long target, UserDTO principal) { return target.equals(principal.getId()); }