mil.dod.th.ose.gui.webapp/src/mil/dod/th/ose/gui/webapp/controller/ControllerHistoryMgr.java
private void handleSocketData(final int controllerId, final SocketChannel socketChannel)
    {
        final Collection<PersistentData> controllerCollection = 
                m_PersistentDataStore.query(ControllerHistory.class, createDataDescription(socketChannel));
        if (controllerCollection.size() == 1)
        {
            final PersistentData data = controllerCollection.iterator().next();
            final ControllerHistory controllerData = (ControllerHistory)data.getEntity();
            controllerData.setControllerId(controllerId);
            controllerData.setSslEnabled(socketChannel.isSslEnabled());
            controllerData.setLastConnected(System.currentTimeMillis());
            data.setEntity(controllerData);
            try
            {
                m_PersistentDataStore.merge(data);
            }
            catch (final IllegalArgumentException | PersistenceFailedException | ValidationFailedException ex)
            {
                m_GrowlUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_TITLE, 
                        ERROR_MSG, ex);
            }
        }
        else if (controllerCollection.isEmpty())
        {
            final ControllerHistory controllerData = new ControllerHistory();
            controllerData.setControllerId(controllerId);
            controllerData.setHostName(socketChannel.getHost());
            controllerData.setPort(socketChannel.getPort());
            controllerData.setSslEnabled(socketChannel.isSslEnabled());
            controllerData.setLastConnected(System.currentTimeMillis());
            m_PersistentDataStore.persist(ControllerHistory.class, UUID.randomUUID(), 
                    createDataDescription(socketChannel), controllerData);
        }
    }
/**
     * Method that handles adding or updating controller history for the specified socket channel.
     * 
     * @param controllerId
     *      Controller ID the socket channel is associated with.
     * @param socketChannel
     *      Socket channel to update or create a controller history record for.
     */
Method that handles adding or updating controller history for the specified socket channel.

@param controllerId
Controller ID the socket channel is associated with.
@param socketChannel
Socket channel to update or create a controller history record for.
Method that handles adding or updating controller history for the specified socket channel . @param controllerId Controller ID the socket channel is associated with . @param socketChannel Socket channel to update or create a controller history record for .
private void handleSocketData(final int controllerId, final SocketChannel socketChannel)
    {
        final Collection<PersistentData> controllerCollection = 
                m_PersistentDataStore.query(ControllerHistory.class, createDataDescription(socketChannel));
        if (controllerCollection.size() == 1)
        {
            final PersistentData data = controllerCollection.iterator().next();
            final ControllerHistory controllerData = (ControllerHistory)data.getEntity();
            controllerData.setControllerId(controllerId);
            controllerData.setSslEnabled(socketChannel.isSslEnabled());
            controllerData.setLastConnected(System.currentTimeMillis());
            data.setEntity(controllerData);
            try
            {
                m_PersistentDataStore.merge(data);
            }
            catch (final IllegalArgumentException | PersistenceFailedException | ValidationFailedException ex)
            {
                m_GrowlUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_TITLE, 
                        ERROR_MSG, ex);
            }
        }
        else if (controllerCollection.isEmpty())
        {
            final ControllerHistory controllerData = new ControllerHistory();
            controllerData.setControllerId(controllerId);
            controllerData.setHostName(socketChannel.getHost());
            controllerData.setPort(socketChannel.getPort());
            controllerData.setSslEnabled(socketChannel.isSslEnabled());
            controllerData.setLastConnected(System.currentTimeMillis());
            m_PersistentDataStore.persist(ControllerHistory.class, UUID.randomUUID(), 
                    createDataDescription(socketChannel), controllerData);
        }
    }
private void handleSocketData ( final int controllerId , final SocketChannel socketChannel ) { final Collection < PersistentData > controllerCollection = m_PersistentDataStore . query ( ControllerHistory . class , createDataDescription ( socketChannel ) ) ; if ( controllerCollection . size ( ) == 1 ) { final PersistentData data = controllerCollection . iterator ( ) . next ( ) ; final ControllerHistory controllerData = ( ControllerHistory ) data . getEntity ( ) ; controllerData . setControllerId ( controllerId ) ; controllerData . setSslEnabled ( socketChannel . isSslEnabled ( ) ) ; controllerData . setLastConnected ( System . currentTimeMillis ( ) ) ; data . setEntity ( controllerData ) ; try { m_PersistentDataStore . merge ( data ) ; } catch ( final IllegalArgumentException | PersistenceFailedException | ValidationFailedException ex ) { m_GrowlUtil . createGlobalFacesMessage ( FacesMessage . SEVERITY_ERROR , ERROR_TITLE , ERROR_MSG , ex ) ; } } else if ( controllerCollection . isEmpty ( ) ) { final ControllerHistory controllerData = new ControllerHistory ( ) ; controllerData . setControllerId ( controllerId ) ; controllerData . setHostName ( socketChannel . getHost ( ) ) ; controllerData . setPort ( socketChannel . getPort ( ) ) ; controllerData . setSslEnabled ( socketChannel . isSslEnabled ( ) ) ; controllerData . setLastConnected ( System . currentTimeMillis ( ) ) ; m_PersistentDataStore . persist ( ControllerHistory . class , UUID . randomUUID ( ) , createDataDescription ( socketChannel ) , controllerData ) ; } }
Method that handles adding or updating controller history for the specified socket channel.
Method that handles adding or updating controller history for the specified socket channel .