com.ibm.tivoli.maximo.weather

Class WeatherAPIService

    • Constructor Detail

      • WeatherAPIService

        public WeatherAPIService(MXServer mxServer)
                          throws java.rmi.RemoteException
        Parameters:
        mxServer - The "Server Environment" this Service is being created in.
        Throws:
        java.rmi.RemoteException
      • WeatherAPIService

        public WeatherAPIService()
                          throws java.rmi.RemoteException
        Throws:
        java.rmi.RemoteException
    • Method Detail

      • getCurrentWeatherForGeocode

        public java.util.Map getCurrentWeatherForGeocode(UserInfo userInfo,
                                                         double latY,
                                                         double longX,
                                                         java.lang.String productName)
                                                  throws java.rmi.RemoteException,
                                                         MXException
        Get current weather by latitude and longitude.
        Parameters:
        userInfo - user info
        latY - latitude
        longX - longitude
        productName - Product Name
        Returns:
        Weather API current weather
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getDailyForecastForGeocode

        public java.util.Map getDailyForecastForGeocode(UserInfo userInfo,
                                                        double latY,
                                                        double longX,
                                                        int duration,
                                                        java.lang.String productName)
                                                 throws java.rmi.RemoteException,
                                                        MXException
        Get daily forecast by latitude and longitude.
        Parameters:
        userInfo - user info
        latY - latitude
        longX - longitude
        duration - duration of forecast (can be 10, 5, 3)
        productName - Product Name
        Returns:
        Weather API daily forecast
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getHourlyForecastForGeocode

        public java.util.Map getHourlyForecastForGeocode(UserInfo userInfo,
                                                         double latY,
                                                         double longX,
                                                         java.lang.String hours,
                                                         java.lang.String productName)
                                                  throws java.rmi.RemoteException,
                                                         MXException
        Get hourly forecast by latitude and longitude.
        Parameters:
        userInfo - user info
        latY - latitude
        longX - longitude
        duration - duration of forecast in hours
        productName - Product Name
        Returns:
        Weather API hourly forecast
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getHistoricalWeatherForGeocode

        public java.util.Map getHistoricalWeatherForGeocode(UserInfo userInfo,
                                                            double latY,
                                                            double longX,
                                                            java.util.Date startDate,
                                                            java.util.Date endDate,
                                                            java.lang.String productName)
                                                     throws java.rmi.RemoteException,
                                                            MXException
        Get historical weather by latitude and longitude.
        Parameters:
        userInfo - user info
        latY - latitude
        longX - longitude
        startDate - start date
        endDate - end date
        productName - Product Name
        Returns:
        Weather API historical weather
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getWeatherAlertsForGeocode

        public java.util.Map getWeatherAlertsForGeocode(UserInfo userInfo,
                                                        double latY,
                                                        double longX,
                                                        java.lang.String productName)
                                                 throws java.rmi.RemoteException,
                                                        MXException
        Get alerts by latitude and longitude.
        Parameters:
        userInfo - user info
        latY - latitude
        longX - longitude
        productName - Product Name
        Returns:
        Weather API weather alert
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getWeatherAlertsDetails

        public java.util.Map getWeatherAlertsDetails(UserInfo userInfo,
                                                     java.lang.String detailKey,
                                                     java.lang.String productName)
                                              throws java.rmi.RemoteException,
                                                     MXException
        Get alerts details.
        Parameters:
        userInfo - user info
        detailKey - detail key
        productName - Product Name
        Returns:
        Weather API alert detail
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getCurrentWeatherForLocation

        public java.util.Map getCurrentWeatherForLocation(UserInfo userInfo,
                                                          java.lang.String postalCode,
                                                          java.lang.String locationCode,
                                                          java.lang.String country,
                                                          java.lang.String productName)
                                                   throws java.rmi.RemoteException,
                                                          MXException
        Get current weather by postal code and country.
        Parameters:
        userInfo - user info
        postalCode - postal code
        locationCode - location code
        country - country
        productName - Product Name
        Returns:
        Weather API current weather
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getDailyForecastForLocation

        public java.util.Map getDailyForecastForLocation(UserInfo userInfo,
                                                         java.lang.String postalCode,
                                                         java.lang.String locationCode,
                                                         java.lang.String country,
                                                         int duration,
                                                         java.lang.String productName)
                                                  throws java.rmi.RemoteException,
                                                         MXException
        Get daily forecast by postal code and country.
        Parameters:
        userInfo - user info
        postalCode - postal code
        locationCode - location code
        country - country
        duration - duration of forecast (can be 10, 5, 3)
        productName - Product Name
        Returns:
        Weather API daily forecast
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getHourlyForecastForLocation

        public java.util.Map getHourlyForecastForLocation(UserInfo userInfo,
                                                          java.lang.String postalCode,
                                                          java.lang.String locationCode,
                                                          java.lang.String country,
                                                          java.lang.String hours,
                                                          java.lang.String productName)
                                                   throws java.rmi.RemoteException,
                                                          MXException
        Get hourly forecast by postal code and country.
        Parameters:
        userInfo - user info
        postalCode - postal code
        locationCode - location code
        country - country
        duration - duration of forecast in hours
        productName - Product Name
        Returns:
        Weather API hourly forecast
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getHistoricalWeatherForLocation

        public java.util.Map getHistoricalWeatherForLocation(UserInfo userInfo,
                                                             java.lang.String postalCode,
                                                             java.lang.String locationCode,
                                                             java.lang.String country,
                                                             java.util.Date startDate,
                                                             java.util.Date endDate,
                                                             java.lang.String productName)
                                                      throws java.rmi.RemoteException,
                                                             MXException
        Get historical weather by latitude and longitude.
        Parameters:
        userInfo - user info
        postalCode - postal code
        locationCode - location code
        country - country
        startDate - start date
        endDate - end date
        productName - Product Name
        Returns:
        Weather API historical weather
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getWeatherAlertsForLocation

        public java.util.Map getWeatherAlertsForLocation(UserInfo userInfo,
                                                         java.lang.String postalCode,
                                                         java.lang.String locationCode,
                                                         java.lang.String country,
                                                         java.lang.String productName)
                                                  throws java.rmi.RemoteException,
                                                         MXException
        Get weather alert by area id and country.
        Parameters:
        userInfo - user info
        postalCode - postal code
        locationCode - area id
        country - country
        productName - Product Name
        Returns:
        Weather API weather alerts
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • checkConnection

        public void checkConnection(MboRemote weatherOrg)
                             throws java.rmi.RemoteException,
                                    MXException
        Process Asset Registry. It will register, Update or Unregister
        Parameters:
        org - organization
        assetInfo - weather asset info
        apiKey - API Key
        endPointName - end point name
        userInfo - user info
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getServiceAddresses

        public MboSetRemote getServiceAddresses()
                                         throws java.rmi.RemoteException,
                                                MXException
        Register/Unregister Weather Organization End Points.
        Parameters:
        userInfo - user info
        Returns:
        respone
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • registryEndPointsForAlerts

        public void registryEndPointsForAlerts(boolean register)
                                        throws java.rmi.RemoteException,
                                               MXException
        Register/Unregister Weather Organization End Points.
        Parameters:
        userInfo - user info
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • processAssetsRegistry

        public void processAssetsRegistry(MboRemote weatherZone,
                                          java.lang.String actioncode)
                                   throws java.rmi.RemoteException,
                                          MXException
        Process Asset Registry. It will register, Update or Unregister
        Parameters:
        org - organization
        assetInfo - weather asset info
        apiKey - API Key
        endPointName - end point name
        userInfo - user info
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getProductCatalog

        public java.util.List getProductCatalog(java.lang.String org)
                                         throws java.rmi.RemoteException,
                                                MXException
        Get product catalog.
        Returns:
        list of all products in catalog
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • isWeatherLicenseInstalled

        public boolean isWeatherLicenseInstalled(java.lang.String productName)
                                          throws MXException,
                                                 java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • logWeatherAPICall

        public void logWeatherAPICall(java.lang.String productName,
                                      java.lang.String resourceName,
                                      UserInfo userInfo)
                               throws MXException,
                                      java.rmi.RemoteException
        Insert data to weather asset table
        Parameters:
        org - organization
        assetInfo - Weather Asset Info
        conn - database connection to execute statement
        jo - JSON Object
        Throws:
        MXException - MAXIMO exception
        java.rmi.RemoteException
      • distance

        public double distance(double lat1,
                               double lon1,
                               double lat2,
                               double lon2,
                               java.lang.String uom)
                        throws java.rmi.RemoteException,
                               MXException
        Calculate distance between 2 points using GPS Coordinates
        Parameters:
        org - organization
        refId - refercence Id
        conn - database connection to execute statement
        Throws:
        MXException - MAXIMO exception
        java.rmi.RemoteException