mil.dod.th.ose.gui.webapp/src/mil/dod/th/ose/gui/webapp/asset/AssetMgrImpl.java
private void processFactoryEvent(final Event event, final String topic, final int systemId)
    {
        //pull out UUID and asset type
        final UUID uuid = UUID.fromString((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_UUID));
        final String assetType = (String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_TYPE);
        
        //get the model to update
        final AssetModel model = getAssetModelByUuid(uuid, systemId);

        //not all actions require the model
        if (topic.equals(FactoryDescriptor.TOPIC_FACTORY_OBJ_CREATED + RemoteConstants.REMOTE_TOPIC_SUFFIX))
        {
            //pull out PID
            final String pid = (String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_PID);
            final AssetModel newModel = new AssetModel(systemId, uuid, pid, assetType, this, configWrapper,
                    assetTypesMgr, m_AssetImageInterface);
            tryAddAssetModel(newModel);
            
            //send request for information
            sendRequestsForNewAssetInformation(SharedMessageUtils.convertUUIDToProtoUUID(uuid), systemId);
            
            m_GrowlMessageUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_INFO, "Asset created.",
                String.format("An asset of type %s, was created for controller 0x%08x", 
                    event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_TYPE), systemId));
            
            createAssetEvent(TOPIC_ASSET_ADDED, newModel, new HashMap<String, Object>());
        }
        //all further actions require that the model is not null
        else if (model == null)
        {
            //nothing to update if the model isn't known to the system
            return;
        }

        //process other types of events
        if (topic.equals(FactoryDescriptor.TOPIC_FACTORY_OBJ_DELETED + RemoteConstants.REMOTE_TOPIC_SUFFIX))
        {
            if (removeAssetModel(model))
            {
                m_GrowlMessageUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_INFO, "Asset removed.",
                    String.format("An asset from controller 0x%08x was removed.", systemId));
                
                createAssetEvent(TOPIC_ASSET_REMOVED, model, new HashMap<String, Object>());
            }
        }
        else if (topic.equals(FactoryDescriptor.TOPIC_FACTORY_OBJ_PID_CREATED + RemoteConstants.REMOTE_TOPIC_SUFFIX))
        {
            final String pid = (String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_PID);
            
            model.setPid(pid);
        }
        else if (topic.equals(FactoryDescriptor.TOPIC_FACTORY_OBJ_PID_REMOVED + RemoteConstants.REMOTE_TOPIC_SUFFIX))
        {
            model.setPid("");
        }
        else if (topic.equals(FactoryDescriptor.TOPIC_FACTORY_OBJ_NAME_UPDATED + RemoteConstants.REMOTE_TOPIC_SUFFIX))
        {
            final String name = (String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_NAME);
            if (name == null)
            {
                //null isn't a valid name value
                return;
            }
            m_GrowlMessageUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_INFO, "Asset updated.",
                String.format("Asset formerly named %s changed to %s, from controller 0x%08x.", model.getName(),
                    name, systemId));
            //update the name
            model.updateName(name);
            createAssetEvent(TOPIC_ASSET_UPDATED, model, new HashMap<String, Object>());
        }
    }
/**
     * Process factory object event.
     * @param event
     *     the event properties to check
     * @param topic
     *     the event's topic
     * @param systemId
     *     the system ID from which the response message originated
     */
Process factory object event.
@param event
the event properties to check
@param topic
the event's topic
@param systemId
the system ID from which the response message originated
Process factory object event . @param event the event properties to check @param topic the event ' s topic @param systemId the system ID from which the response message originated
private void processFactoryEvent(final Event event, final String topic, final int systemId)
    {
        final UUID uuid = UUID.fromString((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_UUID));
        final String assetType = (String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_TYPE);
        final AssetModel model = getAssetModelByUuid(uuid, systemId);
        if (topic.equals(FactoryDescriptor.TOPIC_FACTORY_OBJ_CREATED + RemoteConstants.REMOTE_TOPIC_SUFFIX))
        {
            final String pid = (String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_PID);
            final AssetModel newModel = new AssetModel(systemId, uuid, pid, assetType, this, configWrapper,
                    assetTypesMgr, m_AssetImageInterface);
            tryAddAssetModel(newModel);
            sendRequestsForNewAssetInformation(SharedMessageUtils.convertUUIDToProtoUUID(uuid), systemId);
            m_GrowlMessageUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_INFO, "Asset created.",
                String.format("An asset of type %s, was created for controller 0x%08x", 
                    event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_TYPE), systemId));
            createAssetEvent(TOPIC_ASSET_ADDED, newModel, new HashMap<String, Object>());
        }
        else if (model == null)
        {
            return;
        }
        if (topic.equals(FactoryDescriptor.TOPIC_FACTORY_OBJ_DELETED + RemoteConstants.REMOTE_TOPIC_SUFFIX))
        {
            if (removeAssetModel(model))
            {
                m_GrowlMessageUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_INFO, "Asset removed.",
                    String.format("An asset from controller 0x%08x was removed.", systemId));
                createAssetEvent(TOPIC_ASSET_REMOVED, model, new HashMap<String, Object>());
            }
        }
        else if (topic.equals(FactoryDescriptor.TOPIC_FACTORY_OBJ_PID_CREATED + RemoteConstants.REMOTE_TOPIC_SUFFIX))
        {
            final String pid = (String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_PID);
            model.setPid(pid);
        }
        else if (topic.equals(FactoryDescriptor.TOPIC_FACTORY_OBJ_PID_REMOVED + RemoteConstants.REMOTE_TOPIC_SUFFIX))
        {
            model.setPid("");
        }
        else if (topic.equals(FactoryDescriptor.TOPIC_FACTORY_OBJ_NAME_UPDATED + RemoteConstants.REMOTE_TOPIC_SUFFIX))
        {
            final String name = (String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_NAME);
            if (name == null)
            {
                return;
            }
            m_GrowlMessageUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_INFO, "Asset updated.",
                String.format("Asset formerly named %s changed to %s, from controller 0x%08x.", model.getName(),
                    name, systemId));
            model.updateName(name);
            createAssetEvent(TOPIC_ASSET_UPDATED, model, new HashMap<String, Object>());
        }
    }
private void processFactoryEvent ( final Event event , final String topic , final int systemId ) { final UUID uuid = UUID . fromString ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_UUID ) ) ; final String assetType = ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_TYPE ) ; final AssetModel model = getAssetModelByUuid ( uuid , systemId ) ; if ( topic . equals ( FactoryDescriptor . TOPIC_FACTORY_OBJ_CREATED + RemoteConstants . REMOTE_TOPIC_SUFFIX ) ) { final String pid = ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_PID ) ; final AssetModel newModel = new AssetModel ( systemId , uuid , pid , assetType , this , configWrapper , assetTypesMgr , m_AssetImageInterface ) ; tryAddAssetModel ( newModel ) ; sendRequestsForNewAssetInformation ( SharedMessageUtils . convertUUIDToProtoUUID ( uuid ) , systemId ) ; m_GrowlMessageUtil . createGlobalFacesMessage ( FacesMessage . SEVERITY_INFO , "Asset created." , String . format ( "An asset of type %s, was created for controller 0x%08x" , event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_TYPE ) , systemId ) ) ; createAssetEvent ( TOPIC_ASSET_ADDED , newModel , new HashMap < String , Object > ( ) ) ; } else if ( model == null ) { return ; } if ( topic . equals ( FactoryDescriptor . TOPIC_FACTORY_OBJ_DELETED + RemoteConstants . REMOTE_TOPIC_SUFFIX ) ) { if ( removeAssetModel ( model ) ) { m_GrowlMessageUtil . createGlobalFacesMessage ( FacesMessage . SEVERITY_INFO , "Asset removed." , String . format ( "An asset from controller 0x%08x was removed." , systemId ) ) ; createAssetEvent ( TOPIC_ASSET_REMOVED , model , new HashMap < String , Object > ( ) ) ; } } else if ( topic . equals ( FactoryDescriptor . TOPIC_FACTORY_OBJ_PID_CREATED + RemoteConstants . REMOTE_TOPIC_SUFFIX ) ) { final String pid = ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_PID ) ; model . setPid ( pid ) ; } else if ( topic . equals ( FactoryDescriptor . TOPIC_FACTORY_OBJ_PID_REMOVED + RemoteConstants . REMOTE_TOPIC_SUFFIX ) ) { model . setPid ( "" ) ; } else if ( topic . equals ( FactoryDescriptor . TOPIC_FACTORY_OBJ_NAME_UPDATED + RemoteConstants . REMOTE_TOPIC_SUFFIX ) ) { final String name = ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_NAME ) ; if ( name == null ) { return ; } m_GrowlMessageUtil . createGlobalFacesMessage ( FacesMessage . SEVERITY_INFO , "Asset updated." , String . format ( "Asset formerly named %s changed to %s, from controller 0x%08x." , model . getName ( ) , name , systemId ) ) ; model . updateName ( name ) ; createAssetEvent ( TOPIC_ASSET_UPDATED , model , new HashMap < String , Object > ( ) ) ; } }
Process factory object event.
Process factory object event .
//pull out UUID and asset type //get the model to update //not all actions require the model //pull out PID //send request for information //all further actions require that the model is not null //nothing to update if the model isn't known to the system //process other types of events //null isn't a valid name value //update the name