List of usage examples for java.lang Long equals
public boolean equals(Object obj)
From source file:com.emergya.persistenceGeo.web.RestTreeFolderController.java
/** * Obtain folders by type//from w ww . jav a 2 s. c o m * * @param typeId * folder type id. If -1 is received, we don't discriminate by type and return all root folders. * @param filter * to decorate the result * @param showLayers * flag to show layers in tree * * @return all folders of the type */ protected List<TreeFolderDto> getFoldersByType(Long typeId, String filter, boolean showLayers) { List<FolderDto> serviceFolders; if (typeId == null || typeId.equals(ID_ANY_FOLDER_TYPE)) { serviceFolders = foldersAdminService.rootFolders(); } else { serviceFolders = foldersAdminService.rootFoldersByType(typeId); } List<TreeFolderDto> folders = getFolderDecoration(serviceFolders, showLayers); if (filter != null && filter.contains(SHOW_UNASSIGNED_FOLDER_FILTER)) { FolderDto unassingedLayersFolder = new FolderDto(); unassingedLayersFolder.setId(RestFoldersAdminController.UNASSIGNED_LAYERS_VIRTUAL_FOLDER_ID); unassingedLayersFolder.setName("Otros"); folders.add(new TreeFolderDto(unassingedLayersFolder)); } Collections.sort(folders); return folders; }
From source file:ext.msg.model.Message.java
public static boolean deleteMessageBySenderRevicer(Long senderId, Long consumeId, Long groupId, Collection<?> msgTypes) { List<Message> resultList = JPA.em().createQuery( "from Message m where m.senderOnly = :senderId and m.consumeOnly = :consumeId and m.msgType in (:msgTypes)", Message.class).setParameter("senderId", senderId.toString()) .setParameter("consumeId", consumeId.toString()).setParameter("msgTypes", msgTypes).getResultList(); if (CollectionUtils.isEmpty(resultList)) { return false; }/* www . ja v a 2 s . c om*/ for (Message message : resultList) { if (StringUtils.isNotBlank(message.content)) { JsonNode jn = play.libs.Json.parse(message.content); Long cGroupId = jn.findPath("groupId").asLong(0); if (groupId.equals(cGroupId) && message.isHandler == false) JPA.em().remove(message); } } return true; }
From source file:io.wcm.handler.mediasource.dam.impl.RenditionMetadata.java
@Override public int compareTo(RenditionMetadata obj) { // always prefer the virtual crop rendition if (this instanceof VirtualCropRenditionMetadata) { return -1; } else if (obj instanceof VirtualCropRenditionMetadata) { return 1; }//from ww w.ja va 2 s. c o m // order by width, height, rendition path Long thisWidth = getWidth(); Long otherWidth = obj.getWidth(); if (thisWidth.equals(otherWidth)) { Long thisHeight = getHeight(); Long otherHeight = obj.getHeight(); if (thisHeight.equals(otherHeight)) { String thisPath = getRendition().getPath(); String otherPath = obj.getRendition().getPath(); if (!StringUtils.equals(thisPath, otherPath)) { // same with/height - prefer original rendition if (isOriginalRendition(getRendition())) { return -1; } else if (isOriginalRendition(obj.getRendition())) { return 1; } else { return thisPath.compareTo(otherPath); } } else { return 0; } } else { return thisHeight.compareTo(otherHeight); } } else { return thisWidth.compareTo(otherWidth); } }
From source file:org.apache.fluo.recipes.core.map.it.CollisionFreeMapIT.java
public void diff(Map<String, Long> m1, Map<String, Long> m2) { for (String word : m1.keySet()) { Long v1 = m1.get(word); Long v2 = m2.get(word);//from w w w . ja v a 2s . c om if (v2 == null || !v1.equals(v2)) { System.out.println(word + " " + v1 + " != " + v2); } } for (String word : m2.keySet()) { Long v1 = m1.get(word); Long v2 = m2.get(word); if (v1 == null) { System.out.println(word + " null != " + v2); } } }
From source file:org.apache.hadoop.hive.ql.io.orc.ExternalCache.java
private int getAndVerifyIndex(HashMap<Long, Integer> posMap, List<HdfsFileStatusWithId> files, OrcTail[] result, Long fileId) { int ix = posMap.get(fileId); assert result[ix] == null; assert fileId != null && fileId.equals(files.get(ix).getFileId()); return ix;//from www. j av a 2 s. c o m }
From source file:com.healthcit.cacure.dao.FormDao.java
@Transactional(propagation = Propagation.REQUIRED) public void reorderForms(Long sourceFormId, Long targetFormId, boolean before) { Validate.notNull(sourceFormId);//from w ww .j av a 2 s .c o m Validate.notNull(targetFormId); if (sourceFormId.equals(targetFormId)) { return; } Query query = em.createQuery("SELECT ord, module.id FROM BaseForm WHERE id = :id"); Object[] result = (Object[]) query.setParameter("id", sourceFormId).getSingleResult(); int sOrd = (Integer) result[0]; long sModuleId = (Long) result[1]; result = (Object[]) query.setParameter("id", targetFormId).getSingleResult(); int tOrd = (Integer) result[0]; long tModuleId = (Long) result[1]; Validate.isTrue(sModuleId == tModuleId); if (sOrd == tOrd || (before && sOrd == tOrd - 1) || (!before && sOrd == tOrd + 1)) { return; } else if (sOrd < tOrd) { em.createQuery("UPDATE BaseForm SET ord = ord - 1 WHERE ord > :sOrd and ord " + (before ? "<" : "<=") + " :tOrd and module.id = :moduleId").setParameter("sOrd", sOrd).setParameter("tOrd", tOrd) .setParameter("moduleId", sModuleId).executeUpdate(); em.createQuery("UPDATE BaseForm SET ord = :tOrd WHERE id = :fId").setParameter("fId", sourceFormId) .setParameter("tOrd", before ? tOrd - 1 : tOrd).executeUpdate(); } else if (sOrd > tOrd) { em.createQuery("UPDATE BaseForm SET ord = ord + 1 WHERE ord < :sOrd and ord " + (before ? ">=" : ">") + " :tOrd and module.id = :moduleId").setParameter("sOrd", sOrd).setParameter("tOrd", tOrd) .setParameter("moduleId", sModuleId).executeUpdate(); em.createQuery("UPDATE BaseForm SET ord = :tOrd WHERE id = :fId").setParameter("fId", sourceFormId) .setParameter("tOrd", before ? tOrd : tOrd + 1).executeUpdate(); } }
From source file:controllers.PropertyController.java
@RequestMapping("/show") public String showProperties(Map<String, Object> model, @RequestParam(value = "propId", required = false) Long propId) throws Exception { if (propId != null) { //List<String> pnamelist = propertyNameService.getUniquePropertyNames(propId); List<PropertyName> pnamelist = propertyNameService.getUniquePropertyNames(propId); if (!propId.equals((long) 0)) { CarProperty cp = carPropertyService.find(propId); BaseParam bp = baseParamService.getBaseParam(cp.getUid().trim()); if (bp.getParamType().equals(ParamType.PERCENTE)) { model.put("PercentParam", "true"); model.put("baseParam", bp); }//ww w .j av a 2 s . c o m } model.put("uniquePropNames", pnamelist); model.put("oldPropertyId", propId); } return "PropertiesShow"; }
From source file:org.openregistry.core.domain.jpa.sor.JpaSorPersonImpl.java
@Override public SorRole findSorRoleById(final Long roleId) { Assert.notNull(roleId);/* w w w. j av a 2 s . c om*/ for (final SorRole role : this.roles) { if (roleId.equals(role.getId())) { return role; } } return null; }
From source file:ome.services.scripts.test.ScriptRepoHelperTest.java
public void testFileModificationsAreFoundManually() throws Exception { testLoadAddsObjects();/*w w w .ja v a2 s . c om*/ Long fileID = files.get(0).getId(); RepoFile file = helper.write(path, "changed"); files = helper.loadAll(false); assertEquals(fileID, files.get(0).getId()); helper.modificationCheck(); files = helper.loadAll(false); assertFalse(fileID.equals(files.get(0).getId())); }
From source file:io.onedecision.engine.decisions.web.DecisionUIModelController.java
@Override @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public @ResponseBody DecisionModel updateModelForTenant(@PathVariable("id") Long id, @RequestBody DecisionModel model, @PathVariable("tenantId") String tenantId) { LOGGER.info(String.format("Updating decision model %2$s for tenant %1$s", tenantId, id)); // id may be null depending on the configuration of if (model.getId() != null && !id.equals(model.getId())) { throw new IllegalStateException("Proposed model does not match the resource identifier"); }// w ww . jav a2 s . c om // TODO perform checks that the model changes are not destructive. return repo.save(model); }