class ExecutableScriptExportDependencyResolver implements MetadataExportDependencyResolver {

    @Nonnull
    @Override
    public Collection<? extends Metadata> resolveAdditionalDependencies( @Nonnull Metadata metadata )
    {
        final ExecutableScript executableScript = (ExecutableScript) metadata;
        final Set<Metadata> dependencies = Sets.newIdentityHashSet();

        final Collection<ScriptArgValue> scriptArgValues = ScriptArgUtils.getScriptArgValues(
            ObjectUtils.defaultIfNull( executableScript.getScript().getArguments(), Collections.emptyList() ),
            ObjectUtils.defaultIfNull( executableScript.getOverrideArguments(), Collections.emptyList() ) );

        scriptArgValues.stream().filter( sav -> sav.getScriptArg().getDataType() == DataType.CODE ).forEach( sav -> {
            final Collection<String> codes = extractCodes( sav );

            if ( !codes.isEmpty() )
            {
                dependencies.addAll( codeRepository.findAllByCode( codes ) );
            }
        } );

        scriptArgValues.stream().filter( sav -> sav.getScriptArg().getDataType() == DataType.CODE_SET ).forEach( sav -> {
            final Collection<String> codes = extractCodes( sav );

            if ( !codes.isEmpty() )
            {
                dependencies.addAll( codeSetRepository.findAllByCode( codes ) );
            }
        } );

        return dependencies;
    }

    public  ExecutableScriptExportDependencyResolver( @Nonnull CodeRepository codeRepository, @Nonnull CodeSetRepository codeSetRepository );

}