private static String getUrlFromProps ( Map < String , String > properties ) throws RottenTomatoesException { if ( properties . containsKey ( PROPERTY_URL ) && StringUtils . isNotBlank ( properties . get ( PROPERTY_URL ) ) ) { String url = properties . get ( PROPERTY_URL ) ; // If we have the ID, then we need to replace the "{movie-id}" in the URL if ( properties . containsKey ( PROPERTY_ID ) && StringUtils . isNotBlank ( properties . get ( PROPERTY_ID ) ) ) { url = url . replace ( MOVIE_ID , String . valueOf ( properties . get ( PROPERTY_ID ) ) ) ; // We don't need this property anymore properties . remove ( PROPERTY_ID ) ; } // We don't need this property anymore properties . remove ( PROPERTY_URL ) ; return url ; } else { throw new RottenTomatoesException ( ApiExceptionType . INVALID_URL , "No URL specified" ) ; } }
Get and process the URL from the properties map