{"action":"created","comment":{"url":"https://api.github.com/repos/OSGP/Platform/pulls/comments/45034948","id":45034948,"diff_hunk":"@@ -0,0 +1,117 @@\n+/**\n+ * Copyright 2015 Smart Society Services B.V.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ */\n+package com.alliander.osgp.adapter.domain.smartmetering.application.mapping;\n+\n+import java.util.ArrayList;\n+import java.util.Collection;\n+\n+import ma.glasnost.orika.converter.BidirectionalConverter;\n+import ma.glasnost.orika.metadata.Type;\n+\n+import com.alliander.osgp.domain.core.valueobjects.smartmetering.ActivityCalendar;\n+import com.alliander.osgp.domain.core.valueobjects.smartmetering.DayProfile;\n+import com.alliander.osgp.domain.core.valueobjects.smartmetering.DayProfileAction;\n+import com.alliander.osgp.domain.core.valueobjects.smartmetering.SeasonProfile;\n+import com.alliander.osgp.domain.core.valueobjects.smartmetering.WeekProfile;\n+\n+public class ActivityCalendarConverter extends\n+        BidirectionalConverter<com.alliander.osgp.dto.valueobjects.smartmetering.ActivityCalendar, ActivityCalendar> {\n+\n+    @Override\n+    public ActivityCalendar convertTo(final com.alliander.osgp.dto.valueobjects.smartmetering.ActivityCalendar source,\n+            final Type<ActivityCalendar> destinationType) {\n+        if (source == null) {\n+            return null;\n+        }\n+\n+        final ActivityCalendar activityCalendar = new ActivityCalendar();\n+\n+        return activityCalendar;\n+    }\n+\n+    @Override\n+    public com.alliander.osgp.dto.valueobjects.smartmetering.ActivityCalendar convertFrom(\n+            final ActivityCalendar source,\n+            final Type<com.alliander.osgp.dto.valueobjects.smartmetering.ActivityCalendar> destinationType) {\n+        if (source == null) {\n+            return null;\n+        }\n+\n+        final com.alliander.osgp.dto.valueobjects.smartmetering.ActivityCalendar activityCalendar = new com.alliander.osgp.dto.valueobjects.smartmetering.ActivityCalendar();\n+\n+        activityCalendar.setCalendarName(source.getCalendarName());\n+        activityCalendar.setLogicalName(source.getLogicalName());\n+        activityCalendar.setSeasonProfileCollection(this.processSeasonProfile(source.getSeasonProfileCollection()));\n+\n+        return activityCalendar;\n+    }\n+\n+    private Collection<com.alliander.osgp.dto.valueobjects.smartmetering.SeasonProfile> processSeasonProfile(\n+            final Collection<SeasonProfile> seasonProfiles) {\n+        final Collection<com.alliander.osgp.dto.valueobjects.smartmetering.SeasonProfile> spl = new ArrayList<>();\n+\n+        for (final SeasonProfile sp : seasonProfiles) {\n+            spl.add(this.processSeasonProfile(sp));\n+        }\n+\n+        return spl;\n+    }\n+\n+    private com.alliander.osgp.dto.valueobjects.smartmetering.SeasonProfile processSeasonProfile(final SeasonProfile sp) {\n+        final com.alliander.osgp.dto.valueobjects.smartmetering.SeasonProfile spDto = new com.alliander.osgp.dto.valueobjects.smartmetering.SeasonProfile();\n+        spDto.setSeasonProfileName(sp.getSeasonProfileName());\n+        if (sp.getSeasonStart() != null) {\n+            spDto.setSeasonStart(sp.getSeasonStart());\n+        }\n+        spDto.setWeekProfile(this.processWeekProfile(sp.getWeekProfile()));\n+        return spDto;\n+    }\n+\n+    private com.alliander.osgp.dto.valueobjects.smartmetering.WeekProfile processWeekProfile(\n+            final WeekProfile weekProfile) {\n+        final com.alliander.osgp.dto.valueobjects.smartmetering.WeekProfile wp = new com.alliander.osgp.dto.valueobjects.smartmetering.WeekProfile();\n+        wp.setMonday(this.processDayProfile(weekProfile.getMonday()));\n+        wp.setTuesday(this.processDayProfile(weekProfile.getTuesday()));\n+        wp.setWednesday(this.processDayProfile(weekProfile.getWednesday()));\n+        wp.setThursday(this.processDayProfile(weekProfile.getThursday()));\n+        wp.setFriday(this.processDayProfile(weekProfile.getFriday()));\n+        wp.setSaturday(this.processDayProfile(weekProfile.getSaturday()));\n+        wp.setSunday(this.processDayProfile(weekProfile.getSunday()));\n+        return wp;\n+    }\n+\n+    private com.alliander.osgp.dto.valueobjects.smartmetering.DayProfile processDayProfile(final DayProfile dp) {\n+        final com.alliander.osgp.dto.valueobjects.smartmetering.DayProfile dpDto = new com.alliander.osgp.dto.valueobjects.smartmetering.DayProfile();\n+        if (dp.getDayId() != null) {\n+            dpDto.setDayId(dp.getDayId().intValue());\n+        }\n+        dpDto.setDayProfileActionCollection(this.processDayProfileAction(dp.getDayProfileActionCollection()));\n+        return dpDto;\n+    }\n+\n+    private Collection<com.alliander.osgp.dto.valueobjects.smartmetering.DayProfileAction> processDayProfileAction(","path":"osgp-adapter-domain-smartmetering/src/main/java/com/alliander/osgp/adapter/domain/smartmetering/application/mapping/ActivityCalendarConverter.java","position":null,"original_position":97,"commit_id":"c92eedd7893f805488abba8c5e718ced8347e0b6","original_commit_id":"776643697c9d382d6cf1475e205597a9a3216094","user":{"login":"hannek24","id":6457709,"avatar_url":"https://avatars.githubusercontent.com/u/6457709?v=3","gravatar_id":"","url":"https://api.github.com/users/hannek24","html_url":"https://github.com/hannek24","followers_url":"https://api.github.com/users/hannek24/followers","following_url":"https://api.github.com/users/hannek24/following{/other_user}","gists_url":"https://api.github.com/users/hannek24/gists{/gist_id}","starred_url":"https://api.github.com/users/hannek24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hannek24/subscriptions","organizations_url":"https://api.github.com/users/hannek24/orgs","repos_url":"https://api.github.com/users/hannek24/repos","events_url":"https://api.github.com/users/hannek24/events{/privacy}","received_events_url":"https://api.github.com/users/hannek24/received_events","type":"User","site_admin":false},"body":"List is now used","created_at":"2015-11-17T08:57:54Z","updated_at":"2015-11-17T08:57:54Z","html_url":"https://github.com/OSGP/Platform/pull/229#discussion_r45034948","pull_request_url":"https://api.github.com/repos/OSGP/Platform/pulls/229","_links":{"self":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/comments/45034948"},"html":{"href":"https://github.com/OSGP/Platform/pull/229#discussion_r45034948"},"pull_request":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/229"}}},"pull_request":{"url":"https://api.github.com/repos/OSGP/Platform/pulls/229","id":50624999,"html_url":"https://github.com/OSGP/Platform/pull/229","diff_url":"https://github.com/OSGP/Platform/pull/229.diff","patch_url":"https://github.com/OSGP/Platform/pull/229.patch","issue_url":"https://api.github.com/repos/OSGP/Platform/issues/229","number":229,"state":"open","locked":false,"title":"Feat smartmeter set tariff","user":{"login":"hannek24","id":6457709,"avatar_url":"https://avatars.githubusercontent.com/u/6457709?v=3","gravatar_id":"","url":"https://api.github.com/users/hannek24","html_url":"https://github.com/hannek24","followers_url":"https://api.github.com/users/hannek24/followers","following_url":"https://api.github.com/users/hannek24/following{/other_user}","gists_url":"https://api.github.com/users/hannek24/gists{/gist_id}","starred_url":"https://api.github.com/users/hannek24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hannek24/subscriptions","organizations_url":"https://api.github.com/users/hannek24/orgs","repos_url":"https://api.github.com/users/hannek24/repos","events_url":"https://api.github.com/users/hannek24/events{/privacy}","received_events_url":"https://api.github.com/users/hannek24/received_events","type":"User","site_admin":false},"body":"OSGP/Platform#200","created_at":"2015-11-13T10:24:44Z","updated_at":"2015-11-17T08:57:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OSGP/Platform/pulls/229/commits","review_comments_url":"https://api.github.com/repos/OSGP/Platform/pulls/229/comments","review_comment_url":"https://api.github.com/repos/OSGP/Platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OSGP/Platform/issues/229/comments","statuses_url":"https://api.github.com/repos/OSGP/Platform/statuses/c92eedd7893f805488abba8c5e718ced8347e0b6","head":{"label":"OSGP:feat-smartmeter-set-tariff","ref":"feat-smartmeter-set-tariff","sha":"c92eedd7893f805488abba8c5e718ced8347e0b6","user":{"login":"OSGP","id":11352045,"avatar_url":"https://avatars.githubusercontent.com/u/11352045?v=3","gravatar_id":"","url":"https://api.github.com/users/OSGP","html_url":"https://github.com/OSGP","followers_url":"https://api.github.com/users/OSGP/followers","following_url":"https://api.github.com/users/OSGP/following{/other_user}","gists_url":"https://api.github.com/users/OSGP/gists{/gist_id}","starred_url":"https://api.github.com/users/OSGP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSGP/subscriptions","organizations_url":"https://api.github.com/users/OSGP/orgs","repos_url":"https://api.github.com/users/OSGP/repos","events_url":"https://api.github.com/users/OSGP/events{/privacy}","received_events_url":"https://api.github.com/users/OSGP/received_events","type":"Organization","site_admin":false},"repo":{"id":32739388,"name":"Platform","full_name":"OSGP/Platform","owner":{"login":"OSGP","id":11352045,"avatar_url":"https://avatars.githubusercontent.com/u/11352045?v=3","gravatar_id":"","url":"https://api.github.com/users/OSGP","html_url":"https://github.com/OSGP","followers_url":"https://api.github.com/users/OSGP/followers","following_url":"https://api.github.com/users/OSGP/following{/other_user}","gists_url":"https://api.github.com/users/OSGP/gists{/gist_id}","starred_url":"https://api.github.com/users/OSGP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSGP/subscriptions","organizations_url":"https://api.github.com/users/OSGP/orgs","repos_url":"https://api.github.com/users/OSGP/repos","events_url":"https://api.github.com/users/OSGP/events{/privacy}","received_events_url":"https://api.github.com/users/OSGP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OSGP/Platform","description":"The main components of OSGP.","fork":false,"url":"https://api.github.com/repos/OSGP/Platform","forks_url":"https://api.github.com/repos/OSGP/Platform/forks","keys_url":"https://api.github.com/repos/OSGP/Platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OSGP/Platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OSGP/Platform/teams","hooks_url":"https://api.github.com/repos/OSGP/Platform/hooks","issue_events_url":"https://api.github.com/repos/OSGP/Platform/issues/events{/number}","events_url":"https://api.github.com/repos/OSGP/Platform/events","assignees_url":"https://api.github.com/repos/OSGP/Platform/assignees{/user}","branches_url":"https://api.github.com/repos/OSGP/Platform/branches{/branch}","tags_url":"https://api.github.com/repos/OSGP/Platform/tags","blobs_url":"https://api.github.com/repos/OSGP/Platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OSGP/Platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OSGP/Platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/OSGP/Platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OSGP/Platform/statuses/{sha}","languages_url":"https://api.github.com/repos/OSGP/Platform/languages","stargazers_url":"https://api.github.com/repos/OSGP/Platform/stargazers","contributors_url":"https://api.github.com/repos/OSGP/Platform/contributors","subscribers_url":"https://api.github.com/repos/OSGP/Platform/subscribers","subscription_url":"https://api.github.com/repos/OSGP/Platform/subscription","commits_url":"https://api.github.com/repos/OSGP/Platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/OSGP/Platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/OSGP/Platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/OSGP/Platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/OSGP/Platform/contents/{+path}","compare_url":"https://api.github.com/repos/OSGP/Platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OSGP/Platform/merges","archive_url":"https://api.github.com/repos/OSGP/Platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OSGP/Platform/downloads","issues_url":"https://api.github.com/repos/OSGP/Platform/issues{/number}","pulls_url":"https://api.github.com/repos/OSGP/Platform/pulls{/number}","milestones_url":"https://api.github.com/repos/OSGP/Platform/milestones{/number}","notifications_url":"https://api.github.com/repos/OSGP/Platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OSGP/Platform/labels{/name}","releases_url":"https://api.github.com/repos/OSGP/Platform/releases{/id}","created_at":"2015-03-23T15:05:40Z","updated_at":"2015-07-20T09:45:24Z","pushed_at":"2015-11-17T08:51:55Z","git_url":"git://github.com/OSGP/Platform.git","ssh_url":"git@github.com:OSGP/Platform.git","clone_url":"https://github.com/OSGP/Platform.git","svn_url":"https://github.com/OSGP/Platform","homepage":null,"size":24094,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":58,"forks":2,"open_issues":58,"watchers":5,"default_branch":"development"}},"base":{"label":"OSGP:development","ref":"development","sha":"f69622ac7ce041dcb50f5e5081a82e55fe855da2","user":{"login":"OSGP","id":11352045,"avatar_url":"https://avatars.githubusercontent.com/u/11352045?v=3","gravatar_id":"","url":"https://api.github.com/users/OSGP","html_url":"https://github.com/OSGP","followers_url":"https://api.github.com/users/OSGP/followers","following_url":"https://api.github.com/users/OSGP/following{/other_user}","gists_url":"https://api.github.com/users/OSGP/gists{/gist_id}","starred_url":"https://api.github.com/users/OSGP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSGP/subscriptions","organizations_url":"https://api.github.com/users/OSGP/orgs","repos_url":"https://api.github.com/users/OSGP/repos","events_url":"https://api.github.com/users/OSGP/events{/privacy}","received_events_url":"https://api.github.com/users/OSGP/received_events","type":"Organization","site_admin":false},"repo":{"id":32739388,"name":"Platform","full_name":"OSGP/Platform","owner":{"login":"OSGP","id":11352045,"avatar_url":"https://avatars.githubusercontent.com/u/11352045?v=3","gravatar_id":"","url":"https://api.github.com/users/OSGP","html_url":"https://github.com/OSGP","followers_url":"https://api.github.com/users/OSGP/followers","following_url":"https://api.github.com/users/OSGP/following{/other_user}","gists_url":"https://api.github.com/users/OSGP/gists{/gist_id}","starred_url":"https://api.github.com/users/OSGP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSGP/subscriptions","organizations_url":"https://api.github.com/users/OSGP/orgs","repos_url":"https://api.github.com/users/OSGP/repos","events_url":"https://api.github.com/users/OSGP/events{/privacy}","received_events_url":"https://api.github.com/users/OSGP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OSGP/Platform","description":"The main components of OSGP.","fork":false,"url":"https://api.github.com/repos/OSGP/Platform","forks_url":"https://api.github.com/repos/OSGP/Platform/forks","keys_url":"https://api.github.com/repos/OSGP/Platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OSGP/Platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OSGP/Platform/teams","hooks_url":"https://api.github.com/repos/OSGP/Platform/hooks","issue_events_url":"https://api.github.com/repos/OSGP/Platform/issues/events{/number}","events_url":"https://api.github.com/repos/OSGP/Platform/events","assignees_url":"https://api.github.com/repos/OSGP/Platform/assignees{/user}","branches_url":"https://api.github.com/repos/OSGP/Platform/branches{/branch}","tags_url":"https://api.github.com/repos/OSGP/Platform/tags","blobs_url":"https://api.github.com/repos/OSGP/Platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OSGP/Platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OSGP/Platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/OSGP/Platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OSGP/Platform/statuses/{sha}","languages_url":"https://api.github.com/repos/OSGP/Platform/languages","stargazers_url":"https://api.github.com/repos/OSGP/Platform/stargazers","contributors_url":"https://api.github.com/repos/OSGP/Platform/contributors","subscribers_url":"https://api.github.com/repos/OSGP/Platform/subscribers","subscription_url":"https://api.github.com/repos/OSGP/Platform/subscription","commits_url":"https://api.github.com/repos/OSGP/Platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/OSGP/Platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/OSGP/Platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/OSGP/Platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/OSGP/Platform/contents/{+path}","compare_url":"https://api.github.com/repos/OSGP/Platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OSGP/Platform/merges","archive_url":"https://api.github.com/repos/OSGP/Platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OSGP/Platform/downloads","issues_url":"https://api.github.com/repos/OSGP/Platform/issues{/number}","pulls_url":"https://api.github.com/repos/OSGP/Platform/pulls{/number}","milestones_url":"https://api.github.com/repos/OSGP/Platform/milestones{/number}","notifications_url":"https://api.github.com/repos/OSGP/Platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OSGP/Platform/labels{/name}","releases_url":"https://api.github.com/repos/OSGP/Platform/releases{/id}","created_at":"2015-03-23T15:05:40Z","updated_at":"2015-07-20T09:45:24Z","pushed_at":"2015-11-17T08:51:55Z","git_url":"git://github.com/OSGP/Platform.git","ssh_url":"git@github.com:OSGP/Platform.git","clone_url":"https://github.com/OSGP/Platform.git","svn_url":"https://github.com/OSGP/Platform","homepage":null,"size":24094,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":58,"forks":2,"open_issues":58,"watchers":5,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/229"},"html":{"href":"https://github.com/OSGP/Platform/pull/229"},"issue":{"href":"https://api.github.com/repos/OSGP/Platform/issues/229"},"comments":{"href":"https://api.github.com/repos/OSGP/Platform/issues/229/comments"},"review_comments":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/229/comments"},"review_comment":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/229/commits"},"statuses":{"href":"https://api.github.com/repos/OSGP/Platform/statuses/c92eedd7893f805488abba8c5e718ced8347e0b6"}}}}