1

00:00:00,830  -->  00:00:07,590
OK now let's convert the remaining part of the share functionality and before doing that let's just

2

00:00:07,670  -->  00:00:13,480
boost like refactoring your far the previous feature which is marking as kid friendly.

3

00:00:13,620  -->  00:00:15,400
So we have some logic here.

4

00:00:15,720  -->  00:00:22,680
So let's actually do some changes here so that we move some of the logic into into controller and also

5

00:00:22,680  -->  00:00:25,160
into our manager classes.

6

00:00:25,380  -->  00:00:26,090
OK.

7

00:00:26,340  -->  00:00:28,540
So we have this here.

8

00:00:28,830  -->  00:00:34,670
Here's where the get friendly functionality starts so let's do this.

9

00:00:34,680  -->  00:00:37,450
Copy it from here.

10

00:00:38,970  -->  00:00:43,350
OK so here we are testing if bookmark is easy kid friendly eligible.

11

00:00:43,860  -->  00:00:49,950
And if the status is the status equals unknown for the kid friendly status then we are getting the kid

12

00:00:49,950  -->  00:00:51,500
friendly status information.

13

00:00:51,630  -->  00:00:57,930
So which means we are using randomisation but you can think that the user is actually giving giving

14

00:00:57,930  -->  00:01:00,730
his decision his or her decision.

15

00:01:00,750  -->  00:01:04,700
Now let's move this particular fart's functionality here.

16

00:01:04,710  -->  00:01:11,360
It's a very simple statement but let's do this and controller actually in manager.

17

00:01:11,400  -->  00:01:11,690
OK.

18

00:01:11,700  -->  00:01:14,330
So we are doing it in the view which is not right.

19

00:01:14,660  -->  00:01:18,580
So to do it the right way needs to be done in the back and not in the front.

20

00:01:18,660  -->  00:01:21,750
So let's So that's the reason why I want to refactor this.

21

00:01:21,900  -->  00:01:27,790
So let's just do that.

22

00:01:30,270  -->  00:01:33,720
Let's call them a second term illustrators let's use the same name

23

00:01:40,500  -->  00:01:43,330
and let's pass it friendly status

24

00:01:46,560  -->  00:01:49,510
as well as the bookmark.

25

00:01:49,650  -->  00:01:51,980
Now that's added automatically.

26

00:01:52,020  -->  00:01:54,090
So create matter.

27

00:01:54,720  -->  00:02:00,420
No let's just simply relayed this in to our manager because we shouldn't have too much of business logic

28

00:02:00,420  -->  00:02:00,720
.

29

00:02:00,720  -->  00:02:03,870
In fact we shouldn't have any business like logic here.

30

00:02:03,870  -->  00:02:04,920
So let's say

31

00:02:07,650  -->  00:02:12,940
.

32

00:02:16,560  -->  00:02:19,510
So in this year.

33

00:02:20,440  -->  00:02:25,930
And let's ontogeny that template.

34

00:02:26,580  -->  00:02:28,320
Now let's go back and go.

35

00:02:28,770  -->  00:02:33,920
View-Master let's just copy this whole thing.

36

00:02:35,420  -->  00:02:39,440
And that's just simply more work.

37

00:02:41,040  -->  00:02:41,780
So that said.

38

00:02:41,790  -->  00:02:43,490
So we are good with this.

39

00:02:43,550  -->  00:02:47,460
Me Yes we are good with this.

40

00:02:47,880  -->  00:02:48,900
And just you're on this

41

00:02:51,990  -->  00:02:55,280
seems fine.

42

00:02:56,220  -->  00:02:58,910
Now let's just do one more tang.

43

00:02:59,310  -->  00:03:02,040
So let's also do some bookkeeping.

44

00:03:02,040  -->  00:03:05,890
So here there is this user who is marking your desk friendly.

45

00:03:06,000  -->  00:03:08,830
Let's also save this information.

46

00:03:08,850  -->  00:03:15,180
Typically when you are implementing any software or any web application you would this kind of an application

47

00:03:15,180  -->  00:03:15,390
.

48

00:03:15,480  -->  00:03:21,900
You would also save who the user is who who though who is the user that has performed this action.

49

00:03:21,900  -->  00:03:27,900
So in this case there is a certain editor or a chief editor who is marking this particular item as kid

50

00:03:27,900  -->  00:03:34,530
friendly and it would be nice to him to also save that information who that particular users who's doing

51

00:03:34,530  -->  00:03:36,430
the marking action.

52

00:03:36,840  -->  00:03:39,850
So let's just go into the bookmark class here.

53

00:03:40,000  -->  00:03:43,760
So do a control shift our bookmark.

54

00:03:44,250  -->  00:03:54,550
So let's just either a new free or irate user let's call it does get friendly mocked by.

55

00:03:56,700  -->  00:04:02,510
So this will have a red card of the user who has performed this particular action.

56

00:04:02,640  -->  00:04:06,340
And that's also create get in and sergers

57

00:04:09,800  -->  00:04:10,560
reduce.

58

00:04:10,560  -->  00:04:11,790
So we are good with that.

59

00:04:11,820  -->  00:04:20,890
And so now from the weblink in the view class let's pass this information to the controller.

60

00:04:21,060  -->  00:04:24,420
So let's just see user.

61

00:04:24,420  -->  00:04:26,900
So let's pass this information user.

62

00:04:27,540  -->  00:04:33,300
But knowing how to accomplish compulsion Urso that this set change the let's pick this option set kid

63

00:04:33,300  -->  00:04:36,040
friendly status and parameter user.

64

00:04:36,180  -->  00:04:39,550
So eclipse is going to do the job for us.

65

00:04:39,680  -->  00:04:44,760
So let's also do the same for this with a manager class.

66

00:04:45,090  -->  00:04:47,250
And once again we will to the same option.

67

00:04:47,250  -->  00:04:51,650
So eclipse then automatically update the matter signature here.

68

00:04:51,680  -->  00:05:04,450
Now let's say Mark Dodds said he currently MMOG by it's supposed to be user here that's it.

69

00:05:04,470  -->  00:05:13,720
Now let's bring this information it into status here let's call it does mark by.

70

00:05:15,170  -->  00:05:20,240
Let's bring the user's e-mail.

71

00:05:23,280  -->  00:05:33,190
And let's also print just the book mark information and also do a control shift.

72

00:05:34,930  -->  00:05:36,300
So that's it.

73

00:05:36,400  -->  00:05:43,850
Now let's just go ahead and run this short of you though here.

74

00:05:45,490  -->  00:05:49,210
So the 30 was at first and second users are not staff members.

75

00:05:49,210  -->  00:05:53,520
The third is a staff member here and here it is.

76

00:05:53,530  -->  00:05:54,610
So this is rejected.

77

00:05:54,610  -->  00:05:59,620
This particular item is rejected and it is marked by this user user too.

78

00:06:00,000  -->  00:06:02,160
And this is of eyeblink information.

79

00:06:02,200  -->  00:06:10,480
Now there is a new item that's bookmarked and that item is approved as kid friendly and it was marked

80

00:06:10,480  -->  00:06:12,800
by once again the same user.

81

00:06:12,940  -->  00:06:17,240
So that's bookmarking and that's bookkeeping information.

82

00:06:17,250  -->  00:06:25,950
So now here in the bookmark manager we are simply we are not invoking that Dolliver are typically people

83

00:06:26,010  -->  00:06:31,650
invoke the dollar on past this bookmark and then store that information in the database.

84

00:06:31,810  -->  00:06:36,910
But in this case let's it's fine because bookmark is an object reference.

85

00:06:37,380  -->  00:06:41,540
So the value whatever value is set is is reflected.

86

00:06:41,590  -->  00:06:48,200
So just assume that it's also reflected in the database because this and to did it presents arrowing

87

00:06:48,250  -->  00:06:51,050
the database just think that it is also.

88

00:06:51,610  -->  00:06:58,300
So there is a reference to that particular object in the database anyway so it's not required.

89

00:06:58,300  -->  00:07:00,750
That really required that we save it.

90

00:07:00,970  -->  00:07:05,200
But you know we can in reality we would actually save it.

91

00:07:05,200  -->  00:07:07,910
But for now it is definitely fine.

92

00:07:08,560  -->  00:07:09,370
So that's about it.

93

00:07:09,370  -->  00:07:14,240
So let's just go ahead and continue our implementation of the shared functionality and let's complete

94

00:07:14,240  -->  00:07:15,770
data.

95

00:07:17,170  -->  00:07:20,330
So let's go back into our real class.

96

00:07:20,650  -->  00:07:25,010
OK so that's marking us get friendly now Ed..

97

00:07:25,060  -->  00:07:32,520
One of the staff members have has to do the sharing operation also so the staff member gets to bookmark

98

00:07:32,570  -->  00:07:32,660
.

99

00:07:32,690  -->  00:07:36,730
I'm also Marcus kid friendly and not share any bookmarks.

100

00:07:36,790  -->  00:07:39,710
So here lots.

101

00:07:39,880  -->  00:07:46,030
Since the condition is already here that if the user is an editor or the chief editor or need then the

102

00:07:46,020  -->  00:07:47,790
user will be able to market get friendly.

103

00:07:47,800  -->  00:07:51,130
Only then the user will be able to perform the shading operation.

104

00:07:51,120  -->  00:07:53,670
So let's have the sharing functionality here.

105

00:07:54,160  -->  00:07:58,250
And we know that there are some constraints for sharing.

106

00:07:58,420  -->  00:08:02,460
And one of them is that the get friendly status has to be approved.

107

00:08:02,470  -->  00:08:08,470
So if it is a bookmark that is approved only then we will be able to share it it needs to be a good

108

00:08:08,470  -->  00:08:09,740
friendly bookmark.

109

00:08:09,750  -->  00:08:10,740
So for that.

110

00:08:10,770  -->  00:08:14,770
So we already have this bookmark.

111

00:08:15,230  -->  00:08:20,140
Copy this on your differences died instead of unknown.

112

00:08:20,130  -->  00:08:24,490
It's supposed to be she approved.

113

00:08:26,180  -->  00:08:26,600
OK.

114

00:08:26,620  -->  00:08:29,070
So instead of on and on.

115

00:08:29,620  -->  00:08:31,950
This is this has to be a pro.

116

00:08:32,710  -->  00:08:35,770
No it means that it's a good friendly bookmark.

117

00:08:36,580  -->  00:08:36,960
OK.

118

00:08:37,020  -->  00:08:41,680
So now the second condition so this is only one of the conditions that it needs to be a good friendly

119

00:08:41,690  -->  00:08:42,260
bookmark.

120

00:08:42,390  -->  00:08:49,570
But the second constraint is that it needs to be either a book or eyeblink only then it can be shared

121

00:08:49,720  -->  00:08:55,400
which means that they are implementing those two kinds of items are implementing shareable.

122

00:08:55,540  -->  00:08:56,080
OK.

123

00:08:56,200  -->  00:08:57,720
So and this gives the bookmark.

124

00:08:57,730  -->  00:09:03,050
So here is a bookmark it needs to be an instance of Shater right.

125

00:09:03,070  -->  00:09:07,890
Because both book and weblink are implement being shareable.

126

00:09:08,130  -->  00:09:08,700
So.

127

00:09:08,800  -->  00:09:17,490
So the way we can ensure that is by using an instance of operator.

128

00:09:20,080  -->  00:09:26,970
So now we know that the bookmark is an instance of shareable and only then we will do the shading.

129

00:09:27,040  -->  00:09:34,460
So if the bookmarked on site will be movie then we won't do an end run into this if block.

130

00:09:35,330  -->  00:09:36,140
Import important.

131

00:09:36,270  -->  00:09:45,100
So even after it can be shared it may be that the editor the staff member does not want to share it

132

00:09:45,100  -->  00:09:50,210
so it's up to it's up to the staff member whether he or she wants to share it or not.

133

00:09:50,400  -->  00:09:59,070
So once again to use randomisation for that and it's good that it's hard to generate this

134

00:10:04,670  -->  00:10:18,560
that to use just a simple The same one here this is hybridize Boullion.

135

00:10:20,660  -->  00:10:22,230
So not to assign this

136

00:10:25,790  -->  00:10:33,610
to a variable called E share not the best name here but I guess it's OK.

137

00:10:34,050  -->  00:10:44,850
Now let's see if we share only then we would share it with the third party site.

138

00:10:45,280  -->  00:10:46,060
OK.

139

00:10:46,120  -->  00:10:49,320
So let's introduce a new method.

140

00:10:49,650  -->  00:10:55,560
So let's just assume that a user wants to share this idea he has clicked on the link shared with good

141

00:10:55,560  -->  00:11:06,200
snips and then a control will be sent back to the controller so that the necessary actions will be taken

142

00:11:06,210  -->  00:11:07,230
in the Bakken.

143

00:11:07,500  -->  00:11:14,060
So let's say Get instance and that's created a share here

144

00:11:17,540  -->  00:11:23,940
and we would also be doing some bookoo bookkeeping just like the way we have done for kid friendly status

145

00:11:23,950  -->  00:11:24,100
.

146

00:11:24,240  -->  00:11:29,510
So we want to know which user is sharing the item.

147

00:11:29,580  -->  00:11:30,640
OK so we're going to do that.

148

00:11:30,630  -->  00:11:36,880
So let's also pass that and let's pass the bookmark.

149

00:11:37,810  -->  00:11:38,430
OK.

150

00:11:38,620  -->  00:11:43,240
So we are sharing this you this user is sharing this bookmark.

151

00:11:43,430  -->  00:11:44,150
OK.

152

00:11:44,540  -->  00:11:47,280
So it is.

153

00:11:48,120  -->  00:11:57,450
And as always this one simply release to the bookmark manager

154

00:12:03,370  -->  00:12:06,570
and let's all go create this method.

155

00:12:07,690  -->  00:12:08,390
OK.

156

00:12:08,620  -->  00:12:19,830
So let's go back into this bookmark class and for bookkeeping Let's introduce a new variable which is

157

00:12:19,830  -->  00:12:24,520
of type user and let's say shared by.

158

00:12:24,780  -->  00:12:28,160
So it's very similar to good for me my bye.

159

00:12:28,920  -->  00:12:34,140
And let's also generally the getters and setters.

160

00:12:36,110  -->  00:12:37,680
OK there you go.

161

00:12:37,680  -->  00:12:39,050
Save it.

162

00:12:39,090  -->  00:12:41,630
Go back to manicure.

163

00:12:42,880  -->  00:12:47,800
Let's just say.

164

00:12:52,870  -->  00:12:57,430
So that's the user's information that's who's sharing.

165

00:12:57,960  -->  00:13:01,260
And let's put a system not a out statement here

166

00:13:01,260  -->  00:13:10,940
.

167

00:13:11,700  -->  00:13:16,610
So here is a bookmark but we don't know whether it is an instance of book of eyeblink.

168

00:13:16,650  -->  00:13:16,900
Right.

169

00:13:16,890  -->  00:13:23,220
We need to get the data that we need to invoke to get some data so far that we need to do or don't cast

170

00:13:23,960  -->  00:13:24,830
cast here.

171

00:13:24,960  -->  00:13:30,240
So because we need to share that we need to get that data and then we need to share it with the third

172

00:13:30,240  -->  00:13:31,380
party website.

173

00:13:31,650  -->  00:13:37,980
So let's just do this first let's check whether it is an instance of book or whether it's an instance

174

00:13:38,040  -->  00:13:45,060
of eyeblink sofort is an instance of book.

175

00:13:45,540  -->  00:13:55,830
You know we can pass the we can get item didn't diameter we can do this we can see a book bookmark so

176

00:13:55,830  -->  00:13:57,540
we can type.

177

00:13:58,290  -->  00:14:01,860
And then we can invoke the get item radiometer

178

00:14:04,550  -->  00:14:07,640
here and into this.

179

00:14:07,680  -->  00:14:17,400
So in this sense we there is not a real third party website it's just a fictitious website but we don't

180

00:14:17,400  -->  00:14:18,210
have it.

181

00:14:18,210  -->  00:14:24,240
So we are all we can do is let's just print it here probably in future we can just write it into a file

182

00:14:24,900  -->  00:14:31,690
so that some other you know some kind of a job of some kind of a scope will actually send that information

183

00:14:31,680  -->  00:14:33,450
to the third party website.

184

00:14:33,450  -->  00:14:36,360
Sometimes it's done that way or sometimes you may.

185

00:14:36,420  -->  00:14:42,600
The third party website might have a web service and we may pass this information directly programmatically

186

00:14:43,450  -->  00:14:49,330
using that web service soby but pass this information to that Web site was in a program category.

187

00:14:49,440  -->  00:15:01,350
Now let's also do as of just copy this here let's copy the whole thing in sternal instead instance of

188

00:15:01,480  -->  00:15:02,730
weblink.

189

00:15:03,330  -->  00:15:09,340
And here also eyeblink get our number.

190

00:15:09,350  -->  00:15:11,620
So we're invoking the get item radiometer.

191

00:15:11,970  -->  00:15:14,200
So that's right here.

192

00:15:14,310  -->  00:15:17,730
And it's just time to run this.

193

00:15:19,230  -->  00:15:24,820
It's just go ahead and run the launch.

194

00:15:24,870  -->  00:15:30,280
Let's just look at the 30 user here to get friendly straight as is proved.

195

00:15:30,540  -->  00:15:33,210
But maybe that the data will be shared.

196

00:15:33,330  -->  00:15:39,600
The randomisation function maybe or did not or did not it done True which means that they should not

197

00:15:39,610  -->  00:15:42,210
be share on Hensick was not shared.

198

00:15:42,540  -->  00:15:44,060
So in this case it was movie.

199

00:15:44,070  -->  00:15:49,390
It was rejected movie approved but movie is something that we should not be shared.

200

00:15:49,390  -->  00:15:51,260
So we don't have that now.

201

00:15:51,320  -->  00:16:00,120
Here you can see that this is a book and it is approved and that is here is the day that is to be shared

202

00:16:00,130  -->  00:16:00,200
.

203

00:16:00,270  -->  00:16:07,140
So this is the XM string which God created and that thing that we are passing this information to our

204

00:16:07,260  -->  00:16:10,360
partnerships right now here is the term user.

205

00:16:10,500  -->  00:16:13,130
Same thing your good friend Mr. does is approved.

206

00:16:13,550  -->  00:16:15,040
And it is have a blank.

207

00:16:15,110  -->  00:16:21,420
And I share so only book and book and ramblings can be shared.

208

00:16:21,690  -->  00:16:22,660
OK now

209

00:16:27,150  -->  00:16:33,510
so in future we are going to extend this right now the decisions are made by RR and a musician but in

210

00:16:33,510  -->  00:16:36,020
future we will get that we take the input.

211

00:16:36,030  -->  00:16:41,490
These methods will take input from the user itself and we will do it after completing the Iowa chapter

212

00:16:41,910  -->  00:16:43,570
so we can write it to here.

213

00:16:43,600  -->  00:16:46,100
Which means that we will be doing that in future.

214

00:16:46,200  -->  00:16:49,570
So I will say below methods thats

215

00:16:52,110  -->  00:16:58,390
simulate user and book score.

216

00:16:58,480  -->  00:17:02,600
I also read the book.

217

00:17:02,770  -->  00:17:03,510
Wow.

218

00:17:03,720  -->  00:17:05,450
Answer.

219

00:17:05,550  -->  00:17:06,060
OK.

220

00:17:06,120  -->  00:17:07,750
So thats a good Dudack.

221

00:17:07,980  -->  00:17:16,360
But the nice thing about this is this Dagget itself as something that Eclipse keeps track of.

222

00:17:16,410  -->  00:17:22,690
So if you want to see what all you do ask you how are unique gurus going to Windows show you and set

223

00:17:22,780  -->  00:17:28,920
tasks and he added this is here this is the one which we just brought.

224

00:17:29,250  -->  00:17:36,410
So that way you can easily find all the clues that you how it will show all the clues here.

225

00:17:36,510  -->  00:17:42,680
And that way you can go back and look at what youre interested in and then now.

226

00:17:42,720  -->  00:17:46,980
So if you think you're ready you can just go ahead and fill in the new implementation.

227

00:17:47,070  -->  00:17:55,900
Okay so that's a nice thing about to do and you may note is that we did not implement DDT for the last

228

00:17:55,890  -->  00:17:58,190
two features at least for this feature.

229

00:17:58,230  -->  00:18:00,580
We have done it for IIS good friendly eligible.

230

00:18:00,610  -->  00:18:03,440
That's because the logic is too simple here.

231

00:18:03,550  -->  00:18:07,790
For example in this case we are just taking an input from the user order.

232

00:18:07,840  -->  00:18:10,000
Here we are using randomisation.

233

00:18:10,130  -->  00:18:12,930
And it's just too simple process.

234

00:18:13,050  -->  00:18:16,380
In fact it doesn't even fit well for TDD.

235

00:18:16,440  -->  00:18:24,700
So we that's why we did not have DDD and the rest of the logic also and bookmark manager are very very

236

00:18:24,690  -->  00:18:26,340
it's very simple logic.

237

00:18:26,350  -->  00:18:31,940
So since it is so simple we did not use TDD approach.

238

00:18:32,110  -->  00:18:37,890
So we were used to really only if it is really required because if you think if we think that it's going

239

00:18:37,890  -->  00:18:44,840
to be you know the logic might break it has a possibility to break on lead then we would use DDT.

240

00:18:44,880  -->  00:18:50,700
But if it is very simple simple setting and you know using a set or Gurjars then we don't have to use

241

00:18:50,820  -->  00:18:51,600
DDT.

242

00:18:51,780  -->  00:18:53,530
OK so that's about it.

243

00:18:53,530  -->  00:18:58,070
And that's the final feature which we have implemented.

244

00:18:58,450  -->  00:19:05,160
And please go ahead and implement whatever we have implemented in this lesson.

245

00:19:05,300  -->  00:19:05,700
OK.

246

00:19:05,700  -->  00:19:06,430
Happy coding.

247

00:19:06,480  -->  00:19:07,520
Thank you.
