{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/product-mdm/pulls/comments/51457184","id":51457184,"diff_hunk":"@@ -686,38 +512,268 @@ private Item appendReplaceInfo(Operation operation) throws JSONException {\n         return null;\n     }\n \n-    public Exec executeCommand(Operation operation) {\n-        Exec execElement = new Exec();\n+    public ExecuteTag executeCommand(Operation operation) {\n+        ExecuteTag execElement = new ExecuteTag();\n         execElement.setCommandId(operation.getId());\n-        List<Item> itemsExec = new ArrayList<Item>();\n+        List<Item> itemsExec = new ArrayList<>();\n         Item itemExec = appendExecInfo(operation);\n         itemsExec.add(itemExec);\n         execElement.setItems(itemsExec);\n         return execElement;\n     }\n \n-    public Sequence buildSequence(Operation operation, Sequence sequenceElement) {\n+    public Sequence buildSequence(Operation operation, Sequence sequenceElement) throws WindowsOperationException,\n+            JSONException {\n+\n         sequenceElement.setCommandId(operation.getId());\n+        List<Replace> replaceItems = new ArrayList<>();\n+\n+        if (operation.getCode().equals(PluginConstants.OperationCodes.LOCK_RESET)) {\n+            ExecuteTag execElement = executeCommand(operation);\n+            Get getElements = new Get();\n+            getElements.setCommandId(operation.getId());\n+            List<Item> getItems = new ArrayList<>();\n+            Item itemGets = appendGetInfo(operation);\n+            getItems.add(itemGets);\n+            getElements.setItems(getItems);\n+\n+            sequenceElement.setExec(execElement);\n+            sequenceElement.setGet(getElements);\n+            return sequenceElement;\n+\n+        } else if (operation.getCode().equals(PluginConstants.OperationCodes.POLICY_BUNDLE)) {\n+            List<? extends Operation> policyOperations;\n+            try {\n+                policyOperations = (List<? extends Operation>) operation.getPayLoad();\n+            }catch (ClassCastException e) {\n+                throw new ClassCastException();\n+            }\n+            for (Operation policy : policyOperations) {\n+                if (policy.getCode().equals(PluginConstants.OperationCodes.CAMERA)) {\n+                    Replace replaceCameraConfig = new Replace();\n+                    Item cameraItem;\n+                    List<Item> cameraItems = new ArrayList<>();\n+                    try {\n+                        cameraItem = appendReplaceInfo(policy);\n+                        cameraItems.add(cameraItem);\n+                    } catch (JSONException e) {\n+                        throw new WindowsOperationException(\"Error occurred while parsing payload object to json.\");\n+                    }\n+                    replaceCameraConfig.setCommandId(operation.getId());\n+                    replaceCameraConfig.setItems(cameraItems);\n+                    replaceItems.add(replaceCameraConfig);\n+                }\n+                if (policy.getCode().equals(PluginConstants.OperationCodes.ENCRYPT_STORAGE)) {\n+\n+                    Replace replaceStorageConfig = new Replace();\n+                    Item storageItem;\n+                    List<Item> storageItems = new ArrayList<>();\n+                    try {\n+                        storageItem = appendReplaceInfo(policy);\n+                        storageItems.add(storageItem);\n+                    } catch (JSONException e) {\n+                        throw new WindowsOperationException(\"Error occurred while parsing payload object to json.\", e);\n+                    }\n+                    replaceStorageConfig.setCommandId(operation.getId());\n+                    replaceStorageConfig.setItems(storageItems);\n+                    replaceItems.add(replaceStorageConfig);\n \n-        Exec execElement = new Exec();\n-        execElement.setCommandId(operation.getId());\n-        List<Item> itemsExec = new ArrayList<Item>();\n-        Item itemExec = appendExecInfo(operation);\n-        itemsExec.add(itemExec);\n-        execElement.setItems(itemsExec);\n+                }\n+                if (policy.getCode().equals(PluginConstants.OperationCodes.PASSCODE_POLICY)) {\n+","path":"modules/mobile-agents/windows/jax-rs/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/util/OperationReply.java","position":914,"original_position":914,"commit_id":"04e20b3dce16f39af05a53b57bad90404704bb6a","original_commit_id":"04e20b3dce16f39af05a53b57bad90404704bb6a","user":{"login":"prabathabey","id":6664125,"avatar_url":"https://avatars.githubusercontent.com/u/6664125?v=3","gravatar_id":"","url":"https://api.github.com/users/prabathabey","html_url":"https://github.com/prabathabey","followers_url":"https://api.github.com/users/prabathabey/followers","following_url":"https://api.github.com/users/prabathabey/following{/other_user}","gists_url":"https://api.github.com/users/prabathabey/gists{/gist_id}","starred_url":"https://api.github.com/users/prabathabey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prabathabey/subscriptions","organizations_url":"https://api.github.com/users/prabathabey/orgs","repos_url":"https://api.github.com/users/prabathabey/repos","events_url":"https://api.github.com/users/prabathabey/events{/privacy}","received_events_url":"https://api.github.com/users/prabathabey/received_events","type":"User","site_admin":false},"body":"Remove unnecessary new line.","created_at":"2016-02-01T18:20:55Z","updated_at":"2016-02-01T18:20:55Z","html_url":"https://github.com/wso2/product-mdm/pull/77#discussion_r51457184","pull_request_url":"https://api.github.com/repos/wso2/product-mdm/pulls/77","_links":{"self":{"href":"https://api.github.com/repos/wso2/product-mdm/pulls/comments/51457184"},"html":{"href":"https://github.com/wso2/product-mdm/pull/77#discussion_r51457184"},"pull_request":{"href":"https://api.github.com/repos/wso2/product-mdm/pulls/77"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/product-mdm/pulls/77","id":48121628,"html_url":"https://github.com/wso2/product-mdm/pull/77","diff_url":"https://github.com/wso2/product-mdm/pull/77.diff","patch_url":"https://github.com/wso2/product-mdm/pull/77.patch","issue_url":"https://api.github.com/repos/wso2/product-mdm/issues/77","number":77,"state":"closed","locked":false,"title":"Refactored Windows Opeartion and Policy","user":{"login":"hasunie","id":11287689,"avatar_url":"https://avatars.githubusercontent.com/u/11287689?v=3","gravatar_id":"","url":"https://api.github.com/users/hasunie","html_url":"https://github.com/hasunie","followers_url":"https://api.github.com/users/hasunie/followers","following_url":"https://api.github.com/users/hasunie/following{/other_user}","gists_url":"https://api.github.com/users/hasunie/gists{/gist_id}","starred_url":"https://api.github.com/users/hasunie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasunie/subscriptions","organizations_url":"https://api.github.com/users/hasunie/orgs","repos_url":"https://api.github.com/users/hasunie/repos","events_url":"https://api.github.com/users/hasunie/events{/privacy}","received_events_url":"https://api.github.com/users/hasunie/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-19T20:26:47Z","updated_at":"2016-02-01T18:20:55Z","closed_at":"2015-10-19T23:47:04Z","merged_at":"2015-10-19T23:47:04Z","merge_commit_sha":"49854510f063e89e2fb671d3d1d9a42b6c9afefc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wso2/product-mdm/pulls/77/commits","review_comments_url":"https://api.github.com/repos/wso2/product-mdm/pulls/77/comments","review_comment_url":"https://api.github.com/repos/wso2/product-mdm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/product-mdm/issues/77/comments","statuses_url":"https://api.github.com/repos/wso2/product-mdm/statuses/04e20b3dce16f39af05a53b57bad90404704bb6a","head":{"label":"hasuniea:master","ref":"master","sha":"04e20b3dce16f39af05a53b57bad90404704bb6a","user":{"login":"hasuniea","id":12996810,"avatar_url":"https://avatars.githubusercontent.com/u/12996810?v=3","gravatar_id":"","url":"https://api.github.com/users/hasuniea","html_url":"https://github.com/hasuniea","followers_url":"https://api.github.com/users/hasuniea/followers","following_url":"https://api.github.com/users/hasuniea/following{/other_user}","gists_url":"https://api.github.com/users/hasuniea/gists{/gist_id}","starred_url":"https://api.github.com/users/hasuniea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasuniea/subscriptions","organizations_url":"https://api.github.com/users/hasuniea/orgs","repos_url":"https://api.github.com/users/hasuniea/repos","events_url":"https://api.github.com/users/hasuniea/events{/privacy}","received_events_url":"https://api.github.com/users/hasuniea/received_events","type":"User","site_admin":false},"repo":{"id":41124441,"name":"product-mdm","full_name":"hasuniea/product-mdm","owner":{"login":"hasuniea","id":12996810,"avatar_url":"https://avatars.githubusercontent.com/u/12996810?v=3","gravatar_id":"","url":"https://api.github.com/users/hasuniea","html_url":"https://github.com/hasuniea","followers_url":"https://api.github.com/users/hasuniea/followers","following_url":"https://api.github.com/users/hasuniea/following{/other_user}","gists_url":"https://api.github.com/users/hasuniea/gists{/gist_id}","starred_url":"https://api.github.com/users/hasuniea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasuniea/subscriptions","organizations_url":"https://api.github.com/users/hasuniea/orgs","repos_url":"https://api.github.com/users/hasuniea/repos","events_url":"https://api.github.com/users/hasuniea/events{/privacy}","received_events_url":"https://api.github.com/users/hasuniea/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hasuniea/product-mdm","description":"","fork":true,"url":"https://api.github.com/repos/hasuniea/product-mdm","forks_url":"https://api.github.com/repos/hasuniea/product-mdm/forks","keys_url":"https://api.github.com/repos/hasuniea/product-mdm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hasuniea/product-mdm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hasuniea/product-mdm/teams","hooks_url":"https://api.github.com/repos/hasuniea/product-mdm/hooks","issue_events_url":"https://api.github.com/repos/hasuniea/product-mdm/issues/events{/number}","events_url":"https://api.github.com/repos/hasuniea/product-mdm/events","assignees_url":"https://api.github.com/repos/hasuniea/product-mdm/assignees{/user}","branches_url":"https://api.github.com/repos/hasuniea/product-mdm/branches{/branch}","tags_url":"https://api.github.com/repos/hasuniea/product-mdm/tags","blobs_url":"https://api.github.com/repos/hasuniea/product-mdm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hasuniea/product-mdm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hasuniea/product-mdm/git/refs{/sha}","trees_url":"https://api.github.com/repos/hasuniea/product-mdm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hasuniea/product-mdm/statuses/{sha}","languages_url":"https://api.github.com/repos/hasuniea/product-mdm/languages","stargazers_url":"https://api.github.com/repos/hasuniea/product-mdm/stargazers","contributors_url":"https://api.github.com/repos/hasuniea/product-mdm/contributors","subscribers_url":"https://api.github.com/repos/hasuniea/product-mdm/subscribers","subscription_url":"https://api.github.com/repos/hasuniea/product-mdm/subscription","commits_url":"https://api.github.com/repos/hasuniea/product-mdm/commits{/sha}","git_commits_url":"https://api.github.com/repos/hasuniea/product-mdm/git/commits{/sha}","comments_url":"https://api.github.com/repos/hasuniea/product-mdm/comments{/number}","issue_comment_url":"https://api.github.com/repos/hasuniea/product-mdm/issues/comments{/number}","contents_url":"https://api.github.com/repos/hasuniea/product-mdm/contents/{+path}","compare_url":"https://api.github.com/repos/hasuniea/product-mdm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hasuniea/product-mdm/merges","archive_url":"https://api.github.com/repos/hasuniea/product-mdm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hasuniea/product-mdm/downloads","issues_url":"https://api.github.com/repos/hasuniea/product-mdm/issues{/number}","pulls_url":"https://api.github.com/repos/hasuniea/product-mdm/pulls{/number}","milestones_url":"https://api.github.com/repos/hasuniea/product-mdm/milestones{/number}","notifications_url":"https://api.github.com/repos/hasuniea/product-mdm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hasuniea/product-mdm/labels{/name}","releases_url":"https://api.github.com/repos/hasuniea/product-mdm/releases{/id}","deployments_url":"https://api.github.com/repos/hasuniea/product-mdm/deployments","created_at":"2015-08-21T00:04:21Z","updated_at":"2016-01-20T05:48:45Z","pushed_at":"2016-02-01T07:49:29Z","git_url":"git://github.com/hasuniea/product-mdm.git","ssh_url":"git@github.com:hasuniea/product-mdm.git","clone_url":"https://github.com/hasuniea/product-mdm.git","svn_url":"https://github.com/hasuniea/product-mdm","homepage":null,"size":72558,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"wso2:master","ref":"master","sha":"fdcc284f0b3538bbac92f04dd2d25a4474941d36","user":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"repo":{"id":29459213,"name":"product-mdm","full_name":"wso2/product-mdm","owner":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wso2/product-mdm","description":"","fork":false,"url":"https://api.github.com/repos/wso2/product-mdm","forks_url":"https://api.github.com/repos/wso2/product-mdm/forks","keys_url":"https://api.github.com/repos/wso2/product-mdm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/product-mdm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/product-mdm/teams","hooks_url":"https://api.github.com/repos/wso2/product-mdm/hooks","issue_events_url":"https://api.github.com/repos/wso2/product-mdm/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/product-mdm/events","assignees_url":"https://api.github.com/repos/wso2/product-mdm/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/product-mdm/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/product-mdm/tags","blobs_url":"https://api.github.com/repos/wso2/product-mdm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/product-mdm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/product-mdm/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/product-mdm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/product-mdm/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/product-mdm/languages","stargazers_url":"https://api.github.com/repos/wso2/product-mdm/stargazers","contributors_url":"https://api.github.com/repos/wso2/product-mdm/contributors","subscribers_url":"https://api.github.com/repos/wso2/product-mdm/subscribers","subscription_url":"https://api.github.com/repos/wso2/product-mdm/subscription","commits_url":"https://api.github.com/repos/wso2/product-mdm/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/product-mdm/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/product-mdm/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/product-mdm/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/product-mdm/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/product-mdm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/product-mdm/merges","archive_url":"https://api.github.com/repos/wso2/product-mdm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/product-mdm/downloads","issues_url":"https://api.github.com/repos/wso2/product-mdm/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/product-mdm/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/product-mdm/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/product-mdm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/product-mdm/labels{/name}","releases_url":"https://api.github.com/repos/wso2/product-mdm/releases{/id}","deployments_url":"https://api.github.com/repos/wso2/product-mdm/deployments","created_at":"2015-01-19T07:36:01Z","updated_at":"2016-01-28T22:36:26Z","pushed_at":"2016-02-01T16:04:30Z","git_url":"git://github.com/wso2/product-mdm.git","ssh_url":"git@github.com:wso2/product-mdm.git","clone_url":"https://github.com/wso2/product-mdm.git","svn_url":"https://github.com/wso2/product-mdm","homepage":null,"size":72730,"stargazers_count":14,"watchers_count":14,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":5,"forks":33,"open_issues":5,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/product-mdm/pulls/77"},"html":{"href":"https://github.com/wso2/product-mdm/pull/77"},"issue":{"href":"https://api.github.com/repos/wso2/product-mdm/issues/77"},"comments":{"href":"https://api.github.com/repos/wso2/product-mdm/issues/77/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/product-mdm/pulls/77/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/product-mdm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/product-mdm/pulls/77/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/product-mdm/statuses/04e20b3dce16f39af05a53b57bad90404704bb6a"}}}}