public MatchResult matches ( ProductDefinition def ) { Collection < AppliesToFilterInfo > atfiList = _asset . getWlpInformation ( ) . getAppliesToFilterInfo ( ) ; if ( atfiList == null || atfiList . isEmpty ( ) ) { return MatchResult . NOT_APPLICABLE ; } MatchResult matchResult = MatchResult . MATCHED ; for ( AppliesToFilterInfo atfi : atfiList ) { if ( ! ! ! atfi . getProductId ( ) . equals ( def . getId ( ) ) ) { // This one isn't applicable, maybe the next one is matchResult = MatchResult . NOT_APPLICABLE ; continue ; } else { if ( def . getVersion ( ) != null && ! def . getVersion ( ) . isEmpty ( ) ) { Version checkVersion = new Version ( def . getVersion ( ) ) ; VersionRange vr = FilterVersion . getFilterRange ( atfi . getMinVersion ( ) , atfi . getMaxVersion ( ) ) ; if ( ! vr . includes ( checkVersion ) ) { return MatchResult . INVALID_VERSION ; } } if ( atfi . getRawEditions ( ) != null && ! ! ! atfi . getRawEditions ( ) . isEmpty ( ) && ! ! ! atfi . getRawEditions ( ) . contains ( def . getEdition ( ) ) ) { return MatchResult . INVALID_EDITION ; } if ( atfi . getInstallType ( ) != null && ! ! ! atfi . getInstallType ( ) . equals ( def . getInstallType ( ) ) ) { return MatchResult . INVALID_INSTALL_TYPE ; } // Got here so this must have been a match, only need one of the array to match, not all return MatchResult . MATCHED ; } } return matchResult ; }
Check if this resources matches the supplied product definition