List of usage examples for java.lang Long equals
public boolean equals(Object obj)
From source file:com.redhat.rhn.domain.session.test.WebSessionFactoryTest.java
public void testSetUserId() throws Exception { WebSession s = WebSessionFactory.createSession(); verifySession(s);/*ww w .j a v a2s .c o m*/ assertNotNull(s); Long userId = UserTestUtils.createUser("sessionTest1", "SessionTestOrg"); s.setWebUserId(userId); User u = s.getUser(); assertNotNull(u); assertEquals(userId, u.getId()); Long userId2 = UserTestUtils.createUser("sessionTest2", "SessionTestOrg"); assertFalse(userId.equals(userId2)); try { s.setWebUserId(userId2); } catch (IllegalArgumentException iae) { fail("setWebUserId should not throw an IllegalArgumentException"); } s.setWebUserId(null); assertNull(s.getUser()); }
From source file:net.mindengine.oculus.frontend.web.controllers.project.ProjectEditController.java
@SuppressWarnings("unchecked") @Override/*from w w w . j av a 2 s. com*/ protected Map referenceData(HttpServletRequest request) throws Exception { Map map = new HashMap(); Long projectId = new Long(request.getParameter("id")); Long rootId = projectDAO.getProjectRootId(projectId, 5); map.put("dataFolder", config.getDataFolder()); /* * Checking whether this project is root or not The following code is * only for sub-projects */ if (!projectId.equals(rootId)) { map.put("customizationGroups", CustomizationUtils.fetchCustomizationGroups(customizationDAO, userDAO, rootId, projectId, Customization.UNIT_PROJECT)); } map.put("title", getTitle()); return map; }
From source file:fredboat.audio.player.GuildPlayer.java
public void skipTracks(Collection<Long> trackIds) { boolean skipCurrentTrack = false; List<Long> toRemove = new ArrayList<>(); AudioTrackContext playing = player.getPlayingTrack() != null ? context : null; for (Long trackId : trackIds) { if (playing != null && trackId.equals(playing.getTrackId())) { //Should be skipped last, in respect to PlayerEventListener skipCurrentTrack = true;/* ww w. j a v a 2 s . com*/ } else { toRemove.add(trackId); } } audioTrackProvider.removeAllById(toRemove); if (skipCurrentTrack) { skip(); } }
From source file:org.openregistry.core.domain.jpa.sor.JpaSorRoleImpl.java
public synchronized Url removeURLById(final Long id) { Url urlToDelete = null;//w w w . j a va 2 s . co m for (final Url url : this.urls) { final Long urlId = url.getId(); if (urlId != null && urlId.equals(id)) { urlToDelete = url; break; } } if (urlToDelete != null) { this.urls.remove(urlToDelete); return urlToDelete; } return null; }
From source file:org.openregistry.core.domain.jpa.sor.JpaSorRoleImpl.java
public synchronized Phone removePhoneById(final Long id) { Phone phoneToDelete = null;/*ww w .j a v a 2 s.c o m*/ for (final Phone phone : this.phones) { final Long phoneId = phone.getId(); if (phoneId != null && phoneId.equals(id)) { phoneToDelete = phone; break; } } if (phoneToDelete != null) { this.phones.remove(phoneToDelete); return phoneToDelete; } return null; }
From source file:dpfmanager.shell.modules.threading.core.ThreadingService.java
private void cancelRequest(Long uuid) { // Check if is pending FileCheck pending = null;//from w ww.java 2 s . co m for (FileCheck check : pendingChecks) { if (uuid.equals(check.getUuid())) { pending = check; break; } } if (pending != null) { // Cancel pending pendingChecks.remove(pending); context.send(GuiConfig.COMPONENT_PANE, new CheckTaskMessage(CheckTaskMessage.Target.CANCEL, uuid)); } else { // Cancel threads myExecutor.cancel(uuid); } }
From source file:org.openregistry.core.domain.jpa.sor.JpaSorRoleImpl.java
public synchronized Address removeAddressById(final Long id) { Address addressToDelete = null;//from ww w . j av a2 s . co m for (final Address address : this.addresses) { final Long addressId = address.getId(); if (addressId != null && addressId.equals(id)) { addressToDelete = address; break; } } if (addressToDelete != null) { this.addresses.remove(addressToDelete); return addressToDelete; } return null; }
From source file:whitelabel.cloud.webapp.impl.controller.NewCloudServersController.java
private final int validateEthParams(NewCloudServer newCloudServer) { Long selSwitchEth2 = newCloudServer.getVlan_eth02(); Long selSwitchEth3 = newCloudServer.getVlan_eth03(); if (selSwitchEth2 != null && selSwitchEth2.intValue() > 0 && selSwitchEth2.equals(selSwitchEth3)) { return 23; // can not connect same switch to two different ethernets }//from ww w. j a v a2 s. co m if (selSwitchEth2.intValue() > 0) { if (newCloudServer.getEth02_IP() == null || newCloudServer.getEth02_IP().isEmpty()) { return 2; // can not bind same IP to different ethernets } if (newCloudServer.getEth02_IP().equals(newCloudServer.getEth03_IP())) { return 23; } if (newCloudServer.getEth02_IP() != null && !newCloudServer.getEth02_IP().isEmpty()) { if (newCloudServer.getEth02_NM() == null || newCloudServer.getEth02_NM().isEmpty()) { return 2; } } } if (selSwitchEth3.intValue() > 0) { if (newCloudServer.getEth03_IP() == null || newCloudServer.getEth03_IP().isEmpty()) { return 3; } if (newCloudServer.getEth03_IP() != null && !newCloudServer.getEth03_IP().isEmpty()) { if (newCloudServer.getEth03_NM() == null || newCloudServer.getEth03_NM().isEmpty()) { return 3; } } } return 0; }
From source file:org.openregistry.core.domain.jpa.JpaPersonImpl.java
public Role findRoleBySoRRoleId(final Long sorRoleId) { Assert.notNull(sorRoleId);//from w ww .ja v a 2s.com for (final Role role : this.roles) { if (sorRoleId.equals(role.getSorRoleId())) { return role; } } return null; }
From source file:jp.primecloud.auto.ui.ServiceTable.java
public void setButtonStatus(ComponentDto dto) { //????????// www. ja va 2 s . com // START,EDIT,STOP // ? START,EDIT,DELETE // ??? // WARNINGEDIT,STOP jp.primecloud.auto.entity.crud.Component component = dto.getComponent(); for (Entry<Long, List<Button>> entry : map.entrySet()) { Long key = entry.getKey(); if (key.equals(component.getComponentNo())) { for (Button button : entry.getValue()) { if ("".equals(dto.getStatus()) || "STOPPED".equals(dto.getStatus())) { if (("STOP".equals(button.getCaption()))) { button.setEnabled(false); } else if (("START".equals(button.getCaption()))) { button.setIcon(Icons.PLAY.resource()); button.setDescription(ViewProperties.getCaption("description.startService")); button.setEnabled(true); } else { button.setEnabled(true); } } else if ("RUNNING".equals(dto.getStatus())) { if (("STOP".equals(button.getCaption()))) { button.setEnabled(true); } else if (("START".equals(button.getCaption()))) { button.setIcon(Icons.RELOAD.resource()); button.setDescription(ViewProperties.getCaption("description.reloadService")); button.setEnabled(true); } else if (("EDIT".equals(button.getCaption()))) { button.setEnabled(true); } else { button.setEnabled(false); } } else if ("WARNING".equals(dto.getStatus())) { if (("STOP".equals(button.getCaption()))) { button.setEnabled(true); } else if ("START".equals(button.getCaption())) { button.setIcon(Icons.RELOAD.resource()); button.setDescription(ViewProperties.getCaption("description.reloadService")); button.setEnabled(true); } else if ("EDIT".equals(button.getCaption())) { // ???????????? boolean processing = false; for (ComponentInstanceDto componentInstance : dto.getComponentInstances()) { ComponentInstanceStatus status = ComponentInstanceStatus .fromStatus(componentInstance.getComponentInstance().getStatus()); if (status != ComponentInstanceStatus.RUNNING && status != ComponentInstanceStatus.WARNING && status != ComponentInstanceStatus.STOPPED) { processing = true; break; } } button.setEnabled(!processing); } else { button.setEnabled(false); } } else { button.setEnabled(false); } } } else { for (Button button : entry.getValue()) { button.setEnabled(false); } } } }