Example usage for java.lang Long equals

List of usage examples for java.lang Long equals

Introduction

In this page you can find the example usage for java.lang Long equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this object to the specified object.

Usage

From source file:edu.wustl.geneconnect.postwork.MetadataManager.java

/**
 * Gives information about the requsted base table column.
 * @param columnId Id of the column whose information is required.
 * @return TableColumn object which describes coulmn in the base table. 
 */// www .  j av a  2  s  . c om
public TableColumn getColumnInformation(Long columnId) {
    TableColumn columnInformation = null;
    Iterator iterator = columnMetaData.values().iterator();
    while (iterator.hasNext()) {
        columnInformation = (TableColumn) iterator.next();
        if (columnId.equals(columnInformation.getId())) {
            return columnInformation;
        }
    }
    Logger.log("ERROR : Column Information for columnId " + columnId + " is not available.", Logger.FATAL);
    Logger.log("Please check the GC graph configuration file and GCMetadataPopulation.sql "
            + "in script folder and re-run the server.", Logger.FATAL);
    return null;
}

From source file:io.cloudslang.worker.management.monitor.WorkerMonitorsImplTest.java

@Test
public void testWorkerMonitors() {
    when(workerManager.getWorkerUuid()).thenReturn("1");
    when(workerManager.getExecutionThreadsCount()).thenReturn(5);
    when(inBuffer.getCapacity()).thenReturn(55);
    when(outBuffer.getCapacity()).thenReturn(66);

    Map<WorkerMonitorInfoEnum, Serializable> monitorInfo = workerMonitors.getMonitorInfo();
    assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.TOTAL_MEMORY));
    assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.FREE_MEMORY));
    assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.MAX_MEMORY));
    assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.WORKER_ID));
    assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.EXECUTION_THREADS_AMOUNT));
    assertEquals(5, monitorInfo.get(WorkerMonitorInfoEnum.EXECUTION_THREADS_AMOUNT));
    assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.OUTBUFFER_CAPACITY));
    assertEquals(66, monitorInfo.get(WorkerMonitorInfoEnum.OUTBUFFER_CAPACITY));
    assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.INBUFFER_CAPACITY));
    assertEquals(55, monitorInfo.get(WorkerMonitorInfoEnum.INBUFFER_CAPACITY));

    assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_START_TIME));
    assertNotNull(monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_END_TIME));

    Long firstStart = (Long) monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_START_TIME);
    Long firstEnd = (Long) monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_END_TIME);

    try {/*from  w  ww .  j av  a 2  s  .c om*/
        Thread.sleep(50);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    monitorInfo = workerMonitors.getMonitorInfo();

    Long secondStart = (Long) monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_START_TIME);
    Long secondEnd = (Long) monitorInfo.get(WorkerMonitorInfoEnum.MONITOR_END_TIME);

    assertFalse(firstStart.equals(secondStart));
    assertFalse(firstEnd.equals(secondEnd));
}

From source file:org.openmeetings.app.remote.red5.ClientListManager.java

/**
 * Get all ClientList Objects of that room and domain This Function is
 * needed cause it is invoked internally AFTER the current user has been
 * already removed from the ClientList to see if the Room is empty again and
 * the PollList can be removed//from   w w  w.j a v  a  2 s  .  c om
 * 
 * @return
 */
// FIXME seems like there is no need to return HashMap
public synchronized HashMap<String, RoomClient> getClientListByRoom(Long room_id) {
    HashMap<String, RoomClient> roomClientList = new HashMap<String, RoomClient>();
    try {
        for (Iterator<String> iter = clientList.keySet().iterator(); iter.hasNext();) {
            String key = iter.next();
            RoomClient rcl = clientList.get(key);

            // client initialized and same room
            if (rcl.getRoom_id() == null || !room_id.equals(rcl.getRoom_id())) {
                continue;
            }
            if (rcl.getIsScreenClient() == null || rcl.getIsScreenClient()) {
                continue;
            }
            if (rcl.getIsAVClient()) {
                continue;
            }

            //Only parse really those users out that are really a full session object 
            //and no pseudo session object like the audio/video or screen sharing connection 
            roomClientList.put(key, rcl);

        }
    } catch (Exception err) {
        log.error("[getClientListByRoom]", err);
    }
    return roomClientList;
}

From source file:edu.ur.hibernate.file.db.HbTreeFolderInfoDAOTest.java

/**
 * Test adding files to a folder/* w  w w . j  a v  a  2  s .c o  m*/
 * @throws LocationAlreadyExistsException 
 * @throws IllegalFileSystemNameException 
 * 
  */
@Test
public void treeFolderInfoFileDAOTest() throws LocationAlreadyExistsException, IllegalFileSystemNameException {
    TransactionStatus ts = tm.getTransaction(td);
    // get a unique name for the folder
    assert uniqueNameGenerator.getNextName() != null : "Next unique should not be null";

    DefaultFileServer fileServer = new DefaultFileServer("fileServerFileDAOTest");

    DefaultFileDatabase fd = fileServer.createFileDatabase("display_file_db_1", "file_db_1",
            properties.getProperty("HbFolderDAOTest.folder_path"), "Description");

    fileServerDAO.makePersistent(fileServer);

    // path for creating a folder or folders
    TreeFolderInfo treeFolderInfo1 = fd.createRootFolder("displayName1", uniqueNameGenerator.getNextName());

    TreeFolderInfo treeFolderInfo2 = fd.createRootFolder("displayName2", uniqueNameGenerator.getNextName());

    File directory = new File(treeFolderInfo2.getFullPath());

    // helper to create the file
    FileUtil testUtil = new FileUtil();
    // create the first file to store in the temporary folder
    File f = testUtil.creatFile(directory, "testFile", "Hello  -  This is text in a file");

    DefaultFileInfo fileInfo = treeFolderInfo1.createFileInfo(f, "testName");
    fileInfo.setDisplayName("hbTestFile1");

    assert treeFolderInfo1.getFiles().contains(fileInfo) : "tree folder info 1 should contain " + fileInfo;

    treeFolderInfoDAO.makePersistent(treeFolderInfo1);

    assert treeFolderInfo1.getId() != null : "tree folder info 1 id should not be null";

    tm.commit(ts);

    // start new transaction
    ts = tm.getTransaction(td);

    TreeFolderInfo other = treeFolderInfoDAO.getById(treeFolderInfo1.getId(), false);

    assert other != null : "Folder info should be found";
    assert other.getFiles().contains(fileInfo) : "tree folder info 1 should contain " + fileInfo;
    assert other.getFileInfo(fileInfo.getId()).equals(fileInfo) : "File information should be the same";

    //make sure the count returns 1
    Long count = treeFolderInfoDAO.getFileCount(other.getId());
    assert count.equals(1l) : "Should find one file but found " + count;
    // commit the transaction - this block is only needed when lazy loading
    // must occur in testing
    tm.commit(ts);

    ts = tm.getTransaction(td);
    // delete the database information
    treeFolderInfoDAO.makeTransient(other);
    fileServerDAO.makeTransient(fileServerDAO.getById(fileServer.getId(), false));
    assert fileServer.deleteDatabase(fd.getName());
    tm.commit(ts);

    ts = tm.getTransaction(td);
    assert fileServerDAO.getById(fileServer.getId(), false) == null : "Should not be able to find "
            + fileServer;
    tm.commit(ts);
}

From source file:org.openmeetings.app.remote.WhiteBoardService.java

public Boolean deleteWhiteboard(Long whiteBoardId) {
    try {//from   w  ww.  j  a  v  a 2s  . c o m
        IConnection current = Red5.getConnectionLocal();
        String streamid = current.getClient().getId();
        RoomClient currentClient = this.clientListManager.getClientByStreamId(streamid);
        Long room_id = currentClient.getRoom_id();

        WhiteboardObjectList whiteboardObjectList = this.whiteBoardObjectListManagerById
                .getWhiteBoardObjectListByRoomId(room_id);

        for (Iterator<Long> iter = whiteboardObjectList.getWhiteboardObjects().keySet().iterator(); iter
                .hasNext();) {
            Long storedWhiteboardId = iter.next();

            log.debug(" :: storedWhiteboardId :: " + storedWhiteboardId);

            if (storedWhiteboardId.equals(whiteBoardId)) {
                log.debug("Found Whiteboard to Remove");
            }
        }
        Object returnValue = whiteboardObjectList.getWhiteboardObjects().remove(whiteBoardId);

        log.debug(" :: whiteBoardId :: " + whiteBoardId);

        this.whiteBoardObjectListManagerById.setWhiteBoardObjectListRoomObj(room_id, whiteboardObjectList);

        if (returnValue != null) {
            return true;
        } else {
            return false;
        }

    } catch (Exception err) {
        log.error("[deleteWhiteboard]", err);
    }
    return null;
}

From source file:jp.primecloud.auto.ui.data.ComponentParameterContainer.java

public ComponentParameterContainer(ComponentDto componentDto, Collection<InstanceDto> instanceDtos) {
    super(ComponentParameter.class);

    ComponentType componentType = componentDto.getComponentType();

    List<ComponentParameter> parameters = new ArrayList<ComponentParameter>();

    // /*from  w  w  w  . j  a  v  a2s .  c  om*/
    String diskSize = null;
    for (ComponentConfig config : componentDto.getComponentConfigs()) {
        if (ComponentConstants.CONFIG_NAME_DISK_SIZE.equals(config.getConfigName())) {
            diskSize = config.getConfigValue();
        }
    }
    if (StringUtils.isNotEmpty(diskSize)) {
        String mountPoint = null;
        if (MySQLConstants.COMPONENT_TYPE_NAME.equals(componentType.getComponentTypeName())) {
            mountPoint = "/mnt/db";
        } else if (TomcatConstants.COMPONENT_TYPE_NAME.equals(componentType.getComponentTypeName())) {
            mountPoint = "/mnt/ap";
        } else if (GeronimoConstants.COMPONENT_TYPE_NAME.equals(componentType.getComponentTypeName())) {
            mountPoint = "/mnt/ap";
        } else if (ApacheConstants.COMPONENT_TYPE_NAME.equals(componentType.getComponentTypeName())) {
            mountPoint = "/mnt/web";
        } else if (PrjserverConstants.COMPONENT_TYPE_NAME.equals(componentType.getComponentTypeName())) {
            mountPoint = "/mnt/data01";
        }

        String captionDisk = ViewProperties.getCaption("param.disk");
        parameters.add(new ComponentParameter(captionDisk, ViewProperties.getCaption("param.disk.size"),
                diskSize + ViewProperties.getCaption("param.disk.gb")));
        parameters.add(new ComponentParameter(captionDisk, ViewProperties.getCaption("param.disk.mountpoint"),
                mountPoint));
    }

    // MySQL
    if (MySQLConstants.COMPONENT_TYPE_NAME.equals(componentType.getComponentTypeName())) {
        // Master
        Long masterInstanceNo = null;
        for (InstanceConfig config : componentDto.getInstanceConfigs()) {
            if (MySQLConstants.CONFIG_NAME_MASTER_INSTANCE_NO.equals(config.getConfigName())) {
                if (StringUtils.isEmpty(config.getConfigValue())) {
                    masterInstanceNo = config.getInstanceNo();
                    break;
                }
            }
        }
        InstanceDto masterInstance = null;
        if (masterInstanceNo != null) {
            for (InstanceDto instance : instanceDtos) {
                if (masterInstanceNo.equals(instance.getInstance().getInstanceNo())) {
                    masterInstance = instance;
                    break;
                }
            }
        }
        String master = masterInstance != null ? masterInstance.getInstance().getFqdn() : "";
        String captionMysql = ViewProperties.getCaption("param.mysql");
        parameters.add(
                new ComponentParameter(captionMysql, ViewProperties.getCaption("param.mysql.master"), master));

        // phpMyAdmin
        boolean phpMyAdmin = false;
        for (ComponentConfig config : componentDto.getComponentConfigs()) {
            if (MySQLConstants.CONFIG_NAME_PHP_MY_ADMIN.equals(config.getConfigName())) {
                phpMyAdmin = BooleanUtils.toBoolean(config.getConfigValue());
            }
        }
        String usePhpMyAdmin = phpMyAdmin ? ViewProperties.getCaption("param.phpmyadmin.enable")
                : ViewProperties.getCaption("param.phpmyadmin.disable");
        parameters.add(new ComponentParameter(captionMysql, ViewProperties.getCaption("param.phpmyadmin"),
                usePhpMyAdmin));
    }

    for (ComponentParameter parameter : parameters) {
        addItem(parameter);
    }
}

From source file:com.wooki.domain.biz.BookManagerImpl.java

public void updateChapterIndex(Long bookId, Long chapterId, int to) {
    assert bookId != null;
    assert chapterId != null;

    Book book = bookDao.findById(bookId);

    if (!this.securityCtx.isLoggedIn() || !this.securityCtx.canWrite(book)) {
        throw new AuthorizationException("Action not authorized");
    }/*from   w  ww.  j a v a 2s .c  om*/

    List<Chapter> chapters = book.getChapters();
    Chapter toMove = null;
    for (Chapter chapter : chapters) {
        if (chapterId.equals(chapter.getId())) {
            toMove = chapter;
            break;
        }
    }

    if (toMove == null) {
        throw new IllegalArgumentException("Chapter does not exist");
    }
    book.getChapters().remove(toMove);
    book.getChapters().add(to, toMove);
    bookDao.update(book);
}

From source file:edu.brown.hstore.TransactionInitializer.java

/**
 * Register a new LocalTransaction handle with this HStoreSite
 * We will return a txnId that is guaranteed to be globally unique
 * @param ts//from  w  w  w.  j a  va2s  .  c o m
 * @param base_partition
 * @return
 */
protected Long registerTransaction(LocalTransaction ts, int base_partition) {
    TransactionIdManager idManager = this.txnIdManagers[base_partition];
    Long txn_id = idManager.getNextUniqueTransactionId();

    // For some odd reason we sometimes get duplicate transaction ids from the VoltDB id generator
    // So we'll just double check to make sure that it's unique, and if not, we'll just ask for a new one
    LocalTransaction dupe = (LocalTransaction) this.inflight_txns.put(txn_id, ts);
    if (dupe != null) {
        // HACK!
        this.inflight_txns.put(txn_id, dupe);
        Long new_txn_id = idManager.getNextUniqueTransactionId();
        if (new_txn_id.equals(txn_id)) {
            String msg = "Duplicate transaction id #" + txn_id;
            LOG.fatal("ORIG TRANSACTION:\n" + dupe);
            LOG.fatal("NEW TRANSACTION:\n" + ts);
            Exception error = new Exception(msg);
            this.hstore_site.getCoordinator().shutdownClusterBlocking(error);
        }
        LOG.warn(String.format("Had to fix duplicate txn ids: %d -> %d", txn_id, new_txn_id));
        txn_id = new_txn_id;
        this.inflight_txns.put(txn_id, ts);
    }

    return (txn_id);
}

From source file:edu.wustl.geneconnect.postwork.MetadataManager.java

/**
 * This method gives base table information given a data source Ids of source and destination
 * @param sourceDataSourceId Id of the source datasource
 * @param destinationDataSourceId Id of the destination datasource
 * @return BaseTable base table information object 
 *//*from   ww w.  j av  a 2s .  c o m*/
public BaseTable getBaseTableInformation(Long sourceDataSourceId, Long destinationDataSourceId) {
    BaseTable baseTable = null;
    Iterator iterator = baseTableMetaData.values().iterator();
    while (iterator.hasNext()) {
        baseTable = (BaseTable) iterator.next();
        if (sourceDataSourceId.equals(baseTable.getSourceDataSourceId())
                && destinationDataSourceId.equals(baseTable.getDestinationDataSourceId())) {
            return baseTable;
        }
    }
    Logger.log("ERROR : Base Table Information for data sources " + sourceDataSourceId + " - "
            + destinationDataSourceId + " is not available.", Logger.FATAL);
    Logger.log("Please check the GC graph configuration file and GCMetadataPopulation.sql "
            + "in script folder and rerun the server.", Logger.FATAL);
    return null;
}

From source file:edu.wustl.geneconnect.postwork.MetadataManager.java

/**
 * List of column infromation objects describing all columns in the requsted base table. 
 * @param tableId Id of the base table /* w w  w .ja v a2  s.  c o m*/
 * @return List of TableColumn objects. Each object describes single column in the requestes base table.
 */
public List getAllColumns(Long tableId) {
    List columns = new ArrayList();
    TableColumn columnInformation = null;

    Iterator iterator = columnMetaData.values().iterator();
    while (iterator.hasNext()) {
        columnInformation = (TableColumn) iterator.next();
        if (tableId.equals(columnInformation.getTableId())) {
            columns.add(columnInformation);
        }
    }
    return columns;
}