public static boolean matchAppliesTo ( String assetType , String assetName , String fileName , String appliesTo , String productId , String productVersion , String productInstallType , String productLcenseType , String productEdition ) { if ( appliesTo == null ) return true ; List < AppliesToFilterInfo > atfis = AppliesToProcessor . parseAppliesToHeader ( appliesTo ) ; for ( AppliesToFilterInfo atfi : atfis ) { String pId = atfi . getProductId ( ) ; if ( pId != null && ! pId . equals ( productId ) ) { debug ( "matchAppliesTo()" , String . format ( "The specified product installation is for product %s and the asset(%s) %s from %s only applies to product %s." , productId , assetType , assetName , fileName , pId ) ) ; return false ; } if ( productVersion != null && atfi . getMinVersion ( ) != null && atfi . getMaxVersion ( ) != null ) { Version min = VersionUtility . stringToVersion ( atfi . getMinVersion ( ) . getValue ( ) ) ; Version max = VersionUtility . stringToVersion ( atfi . getMaxVersion ( ) . getValue ( ) ) ; Version v = VersionUtility . stringToVersion ( productVersion ) ; if ( v . compareTo ( min ) < 0 || v . compareTo ( max ) > 0 ) { debug ( "matchAppliesTo()" , String . format ( "The specified product installation is at version %s and the asset(%s) %s from %s only applies to versions [%s,%s]." , productVersion , assetType , assetName , fileName , atfi . getMinVersion ( ) . getValue ( ) , atfi . getMaxVersion ( ) . getValue ( ) ) ) ; return false ; } } String pInstallType = atfi . getInstallType ( ) ; if ( productInstallType != null && pInstallType != null && ! pInstallType . equalsIgnoreCase ( productInstallType ) ) { debug ( "matchAppliesTo()" , String . format ( "The specified product installation is at type %s and the asset(%s) %s from %s only applies to type %s." , productInstallType , assetType , assetName , fileName , pInstallType ) ) ; return false ; } List < String > pRawEditions = atfi . getRawEditions ( ) ; if ( productEdition != null && pRawEditions != null && ! pRawEditions . contains ( productEdition ) ) { debug ( "matchAppliesTo()" , String . format ( "The specified product installation is edition %s and the asset(%s) %s from %s only applies to the editions %s." , productEdition , assetType , assetName , fileName , atfi . getEditions ( ) ) ) ; return false ; } } return true ; }
Parses through the appliesTo header and checks if all parameters of the header matches the input values .