{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-integration-java-dsl/issues/72","repository_url":"https://api.github.com/repos/spring-projects/spring-integration-java-dsl","labels_url":"https://api.github.com/repos/spring-projects/spring-integration-java-dsl/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-integration-java-dsl/issues/72/comments","events_url":"https://api.github.com/repos/spring-projects/spring-integration-java-dsl/issues/72/events","html_url":"https://github.com/spring-projects/spring-integration-java-dsl/issues/72","id":147000980,"number":72,"title":"`FileInboundChannelAdapterSpec` Filtering Not Fluent","user":{"login":"SingleShot","id":9001,"avatar_url":"https://avatars.githubusercontent.com/u/9001?v=3","gravatar_id":"","url":"https://api.github.com/users/SingleShot","html_url":"https://github.com/SingleShot","followers_url":"https://api.github.com/users/SingleShot/followers","following_url":"https://api.github.com/users/SingleShot/following{/other_user}","gists_url":"https://api.github.com/users/SingleShot/gists{/gist_id}","starred_url":"https://api.github.com/users/SingleShot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SingleShot/subscriptions","organizations_url":"https://api.github.com/users/SingleShot/orgs","repos_url":"https://api.github.com/users/SingleShot/repos","events_url":"https://api.github.com/users/SingleShot/events{/privacy}","received_events_url":"https://api.github.com/users/SingleShot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-08T18:21:08Z","updated_at":"2016-04-08T21:06:26Z","closed_at":null,"body":"By \"not fluent\" I mean that one cannot expect a particular behavior from the methods available - it produces unintuitive results. When one creates a `FileInboundChannelAdapterSpec`, it produces a default configuration that will ignore duplicates and hidden fields. If you then call `ignoreDuplicates()`, the behavior is that it no longer ignores hidden fields! Also there is no way to make it allow duplicates other than by completely replacing its `DirectoryScanner`, or by providing a list of filters that do not contain an `AcceptOnce` filter. The deprecated `preventDuplicatesFilter()` does not work correctly either. The reason this is all the case is because the default `DirectoryScanner` already has a set of filters.\r\n\r\nI suggest a fix would be to have the `FileInboundChannelAdapterSpec` default to an empty filter list that it always sets on the target object. Then methods like `ignoreDuplicates()` will make sense in that they add ignoring of duplicates and do not take away other filters."},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-integration-java-dsl/issues/comments/207606718","html_url":"https://github.com/spring-projects/spring-integration-java-dsl/issues/72#issuecomment-207606718","issue_url":"https://api.github.com/repos/spring-projects/spring-integration-java-dsl/issues/72","id":207606718,"user":{"login":"artembilan","id":1071590,"avatar_url":"https://avatars.githubusercontent.com/u/1071590?v=3","gravatar_id":"","url":"https://api.github.com/users/artembilan","html_url":"https://github.com/artembilan","followers_url":"https://api.github.com/users/artembilan/followers","following_url":"https://api.github.com/users/artembilan/following{/other_user}","gists_url":"https://api.github.com/users/artembilan/gists{/gist_id}","starred_url":"https://api.github.com/users/artembilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artembilan/subscriptions","organizations_url":"https://api.github.com/users/artembilan/orgs","repos_url":"https://api.github.com/users/artembilan/repos","events_url":"https://api.github.com/users/artembilan/events{/privacy}","received_events_url":"https://api.github.com/users/artembilan/received_events","type":"User","site_admin":false},"created_at":"2016-04-08T21:06:26Z","updated_at":"2016-04-08T21:06:26Z","body":"See the PR #73 .\r\n\r\nNow everything is based on the `FileListFilterFactoryBean`, like it is done in the SI File module.\r\nEven if we override the default setting in the `DefaultDirectoryScanner` like you pointed above, the `IgnoreHiddenFileListFilter` is still there, because of the `FileListFilterFactoryBean` logic like:\r\n````java\r\nif (!Boolean.FALSE.equals(this.ignoreHidden)) {\r\n\tfiltersNeeded.add(new IgnoreHiddenFileListFilter());\r\n}\r\nif (this.filter != null) {\r\n\tif (Boolean.TRUE.equals(this.preventDuplicates)) {\r\n\t\tfiltersNeeded.add(new AcceptOnceFileListFilter<File>());\r\n\t\tfiltersNeeded.add(this.filter);\r\n\t}\r\n\telse { // preventDuplicates is either FALSE or NULL\r\n\t\tfiltersNeeded.add(this.filter);\r\n\t}\r\n}\r\nelse if (this.filenamePattern != null || this.filenameRegex != null) {\r\n\tif (!Boolean.FALSE.equals(this.preventDuplicates)) {\r\n\t\tfiltersNeeded.add(new AcceptOnceFileListFilter<File>());\r\n\t}\r\n\tif (this.filenamePattern != null) {\r\n\t\tfiltersNeeded.add(new SimplePatternFileListFilter(this.filenamePattern));\r\n\t}\r\n\tif (this.filenameRegex != null) {\r\n\t\tfiltersNeeded.add(new RegexPatternFileListFilter(this.filenameRegex));\r\n\t}\r\n}\r\nelse if (Boolean.FALSE.equals(this.preventDuplicates)) {\r\n\tfiltersNeeded.add(new AcceptAllFileListFilter<File>());\r\n}\r\nelse { // preventDuplicates is either TRUE or NULL\r\n\tfiltersNeeded.add(new AcceptOnceFileListFilter<File>());\r\n}\r\n````\r\n\r\nRight now we fully delegate from the `FileInboundChannelAdapterSpec` to the `FileListFilterFactoryBean`, so any expected combinations should be fine.\r\n\r\nFeel free to share any feedback!"}}