{"action":"created","comment":{"url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/comments/24673106","id":24673106,"diff_hunk":"@@ -0,0 +1,119 @@\n+/*\n+ * Copyright 2015 Stormpath, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package com.stormpath.sdk.impl.directory;\n+\n+import com.stormpath.sdk.directory.PasswordPolicy;\n+import com.stormpath.sdk.directory.Strength;\n+import com.stormpath.sdk.impl.ds.InternalDataStore;\n+import com.stormpath.sdk.impl.resource.*;\n+import com.stormpath.sdk.lang.Assert;\n+import com.stormpath.sdk.mail.*;\n+\n+import java.util.Map;\n+\n+/**\n+ * @since 1.0.0\n+ */\n+public class DefaultPasswordPolicy extends AbstractInstanceResource implements PasswordPolicy {\n+\n+    // SIMPLE PROPERTIES\n+    static final IntegerProperty RESET_TOKEN_TTL = new IntegerProperty(\"resetTokenTtl\");\n+    static final StatusProperty<EmailStatus> RESET_EMAIL_STATUS = new StatusProperty<EmailStatus>(\"resetEmailStatus\", EmailStatus.class);\n+    static final StatusProperty<EmailStatus> RESET_SUCCESS_EMAIL_STATUS = new StatusProperty<EmailStatus>(\"resetSuccessEmailStatus\", EmailStatus.class);\n+\n+    // INSTANCE RESOURCE REFERENCES:\n+    static final ResourceReference<Strength> STRENGTH = new ResourceReference<Strength>(\"strength\", Strength.class);\n+\n+    //COLLECTION RESOURCE REFERENCES:\n+    static final CollectionReference<ResetEmailTemplateList, ResetEmailTemplate> RESET_EMAIL_TEMPLATES =\n+            new CollectionReference<ResetEmailTemplateList, ResetEmailTemplate>(\"resetEmailTemplates\", ResetEmailTemplateList.class, ResetEmailTemplate.class);\n+    static final CollectionReference<ResetSuccessEmailTemplateList, ResetSuccessEmailTemplate> RESET_SUCCESS_EMAIL_TEMPLATES =\n+            new CollectionReference<ResetSuccessEmailTemplateList, ResetSuccessEmailTemplate>(\"resetSuccessEmailTemplates\", ResetSuccessEmailTemplateList.class, ResetSuccessEmailTemplate.class);\n+\n+    private static final Map<String, Property> PROPERTY_DESCRIPTORS = createPropertyDescriptorMap(\n+            RESET_TOKEN_TTL, RESET_EMAIL_STATUS, RESET_SUCCESS_EMAIL_STATUS, STRENGTH, RESET_EMAIL_TEMPLATES, RESET_SUCCESS_EMAIL_TEMPLATES);\n+\n+    public DefaultPasswordPolicy(InternalDataStore dataStore) {\n+        super(dataStore);\n+    }\n+\n+    public DefaultPasswordPolicy(InternalDataStore dataStore, Map<String, Object> properties) {\n+        super(dataStore, properties);\n+    }\n+\n+    @Override\n+    public Map<String, Property> getPropertyDescriptors() {\n+        return PROPERTY_DESCRIPTORS;\n+    }\n+\n+    @Override\n+    public int getResetTokenTtl() {\n+        return getInt(RESET_TOKEN_TTL);\n+    }\n+\n+    @Override\n+    public PasswordPolicy setResetTokenTtl(int resetTokenTtl) {\n+        Assert.isTrue(resetTokenTtl >= 0, \"resetTokenTtl cannot be a negative number.\");\n+        setProperty(RESET_TOKEN_TTL, resetTokenTtl);\n+        return this;\n+    }\n+\n+    @Override\n+    public EmailStatus getResetEmailStatus() {\n+        String value = getStringProperty(RESET_EMAIL_STATUS.getName());\n+        if (value == null) {\n+            return null;\n+        }\n+        return EmailStatus.valueOf(value.toUpperCase());\n+    }\n+\n+    @Override\n+    public PasswordPolicy setResetEmailStatus(EmailStatus status) {\n+        setProperty(RESET_EMAIL_STATUS, status.name());\n+        return this;\n+    }\n+\n+    @Override\n+    public EmailStatus getResetSuccessEmailStatus() {\n+        String value = getStringProperty(RESET_SUCCESS_EMAIL_STATUS.getName());\n+        if (value == null) {\n+            return null;\n+        }\n+        return EmailStatus.valueOf(value.toUpperCase());\n+    }\n+\n+    @Override\n+    public PasswordPolicy setResetSuccessEmailStatus(EmailStatus status) {\n+        setProperty(RESET_SUCCESS_EMAIL_STATUS, status.name());","path":"impl/src/main/java/com/stormpath/sdk/impl/directory/DefaultPasswordPolicy.java","position":100,"original_position":100,"commit_id":"2c8bb85048ca84a4b6c9772ed3082036a8b15529","original_commit_id":"2c8bb85048ca84a4b6c9772ed3082036a8b15529","user":{"login":"maranai","id":2465107,"avatar_url":"https://avatars.githubusercontent.com/u/2465107?v=3","gravatar_id":"","url":"https://api.github.com/users/maranai","html_url":"https://github.com/maranai","followers_url":"https://api.github.com/users/maranai/followers","following_url":"https://api.github.com/users/maranai/following{/other_user}","gists_url":"https://api.github.com/users/maranai/gists{/gist_id}","starred_url":"https://api.github.com/users/maranai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maranai/subscriptions","organizations_url":"https://api.github.com/users/maranai/orgs","repos_url":"https://api.github.com/users/maranai/repos","events_url":"https://api.github.com/users/maranai/events{/privacy}","received_events_url":"https://api.github.com/users/maranai/received_events","type":"User","site_admin":false},"body":"Seems like this method is missing an assert for the case when the \"status\" object is null","created_at":"2015-02-13T15:53:27Z","updated_at":"2015-02-13T15:53:27Z","html_url":"https://github.com/stormpath/stormpath-sdk-java/pull/142#discussion_r24673106","pull_request_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/142","_links":{"self":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/comments/24673106"},"html":{"href":"https://github.com/stormpath/stormpath-sdk-java/pull/142#discussion_r24673106"},"pull_request":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/142"}}},"pull_request":{"url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/142","id":29016759,"html_url":"https://github.com/stormpath/stormpath-sdk-java/pull/142","diff_url":"https://github.com/stormpath/stormpath-sdk-java/pull/142.diff","patch_url":"https://github.com/stormpath/stormpath-sdk-java/pull/142.patch","issue_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/142","number":142,"state":"open","locked":false,"title":"Added PasswordPolicy Resource for directories","user":{"login":"antollinim","id":717498,"avatar_url":"https://avatars.githubusercontent.com/u/717498?v=3","gravatar_id":"","url":"https://api.github.com/users/antollinim","html_url":"https://github.com/antollinim","followers_url":"https://api.github.com/users/antollinim/followers","following_url":"https://api.github.com/users/antollinim/following{/other_user}","gists_url":"https://api.github.com/users/antollinim/gists{/gist_id}","starred_url":"https://api.github.com/users/antollinim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antollinim/subscriptions","organizations_url":"https://api.github.com/users/antollinim/orgs","repos_url":"https://api.github.com/users/antollinim/repos","events_url":"https://api.github.com/users/antollinim/events{/privacy}","received_events_url":"https://api.github.com/users/antollinim/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-10T15:39:46Z","updated_at":"2015-02-13T15:53:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a6c02aac879b2945f442fa56730a9bf0a7d71151","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/142/commits","review_comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/142/comments","review_comment_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/comments/{number}","comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/142/comments","statuses_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/statuses/2c8bb85048ca84a4b6c9772ed3082036a8b15529","head":{"label":"stormpath:PasswordPolicy_for_dirs","ref":"PasswordPolicy_for_dirs","sha":"2c8bb85048ca84a4b6c9772ed3082036a8b15529","user":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"repo":{"id":3913468,"name":"stormpath-sdk-java","full_name":"stormpath/stormpath-sdk-java","owner":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stormpath/stormpath-sdk-java","description":"Official Java SDK for the Stormpath User Management REST API","fork":false,"url":"https://api.github.com/repos/stormpath/stormpath-sdk-java","forks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/forks","keys_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/teams","hooks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/hooks","issue_events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/events{/number}","events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/events","assignees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/assignees{/user}","branches_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/branches{/branch}","tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/tags","blobs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/statuses/{sha}","languages_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/languages","stargazers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/stargazers","contributors_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/contributors","subscribers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/subscribers","subscription_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/subscription","commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/comments/{number}","contents_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/contents/{+path}","compare_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/merges","archive_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/downloads","issues_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues{/number}","pulls_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls{/number}","milestones_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/milestones{/number}","notifications_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/labels{/name}","releases_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/releases{/id}","created_at":"2012-04-03T01:22:09Z","updated_at":"2015-02-03T00:02:07Z","pushed_at":"2015-02-13T15:46:27Z","git_url":"git://github.com/stormpath/stormpath-sdk-java.git","ssh_url":"git@github.com:stormpath/stormpath-sdk-java.git","clone_url":"https://github.com/stormpath/stormpath-sdk-java.git","svn_url":"https://github.com/stormpath/stormpath-sdk-java","homepage":"","size":10426,"stargazers_count":36,"watchers_count":36,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":31,"forks":23,"open_issues":31,"watchers":36,"default_branch":"master"}},"base":{"label":"stormpath:master","ref":"master","sha":"21b89b618298c2375da4affb828ce9847e9d743f","user":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"repo":{"id":3913468,"name":"stormpath-sdk-java","full_name":"stormpath/stormpath-sdk-java","owner":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stormpath/stormpath-sdk-java","description":"Official Java SDK for the Stormpath User Management REST API","fork":false,"url":"https://api.github.com/repos/stormpath/stormpath-sdk-java","forks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/forks","keys_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/teams","hooks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/hooks","issue_events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/events{/number}","events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/events","assignees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/assignees{/user}","branches_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/branches{/branch}","tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/tags","blobs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/statuses/{sha}","languages_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/languages","stargazers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/stargazers","contributors_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/contributors","subscribers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/subscribers","subscription_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/subscription","commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/comments/{number}","contents_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/contents/{+path}","compare_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/merges","archive_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/downloads","issues_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues{/number}","pulls_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls{/number}","milestones_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/milestones{/number}","notifications_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/labels{/name}","releases_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/releases{/id}","created_at":"2012-04-03T01:22:09Z","updated_at":"2015-02-03T00:02:07Z","pushed_at":"2015-02-13T15:46:27Z","git_url":"git://github.com/stormpath/stormpath-sdk-java.git","ssh_url":"git@github.com:stormpath/stormpath-sdk-java.git","clone_url":"https://github.com/stormpath/stormpath-sdk-java.git","svn_url":"https://github.com/stormpath/stormpath-sdk-java","homepage":"","size":10426,"stargazers_count":36,"watchers_count":36,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":31,"forks":23,"open_issues":31,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/142"},"html":{"href":"https://github.com/stormpath/stormpath-sdk-java/pull/142"},"issue":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/142"},"comments":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/142/comments"},"review_comments":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/142/comments"},"review_comment":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/142/commits"},"statuses":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/statuses/2c8bb85048ca84a4b6c9772ed3082036a8b15529"}}}}