1

00:00:00,780  -->  00:00:07,710
So we implement it to reach so far one is bookmarking while the other is marking an item as kid friendly

2

00:00:07,710  -->  00:00:08,610
.

3

00:00:08,610  -->  00:00:14,420
Now we will implement the feature for sharing kid friendly bookmark with partner websites.

4

00:00:14,860  -->  00:00:21,450
However the constraint is that only a kid friendly bookmark that is either a book or of eyeblink can

5

00:00:21,450  -->  00:00:22,460
be shared.

6

00:00:22,650  -->  00:00:24,570
So a movie cannot be shared.

7

00:00:25,110  -->  00:00:30,610
You may recall the slide from one officer up chapter which introduced this new requirement.

8

00:00:30,970  -->  00:00:36,340
Here we have this strength to get friendly books so you can see that there is this link called shared

9

00:00:36,340  -->  00:00:40,950
with snips where courtships is a fictitious part on the website.

10

00:00:40,950  -->  00:00:45,380
This link will be shown only for books and ramblings but not for movies.

11

00:00:45,600  -->  00:00:52,140
You can assume that this link shows up as soon as a staff member mocks either a book or a blink as kid

12

00:00:52,140  -->  00:00:53,520
friendly.

13

00:00:53,520  -->  00:00:59,310
Clicking on this link will invoke shared method in the back in which we know will be a method in the

14

00:00:59,310  -->  00:01:01,950
controller in the Bakken.

15

00:01:01,970  -->  00:01:10,320
Did we have a logic that will generate the data to be shared in SML format with the partner site like

16

00:01:10,350  -->  00:01:11,450
in the case of marking.

17

00:01:11,460  -->  00:01:12,890
Get friendly bookmarks.

18

00:01:13,050  -->  00:01:18,900
We already discussed implementation because for this feature we did that well and are using interfaces

19

00:01:19,560  -->  00:01:22,670
as an interface is needed for this new requirement.

20

00:01:23,190  -->  00:01:29,610
So we're already familiar with this class diagram to enforce the constraint that only book on wabbling

21

00:01:29,610  -->  00:01:30,590
can be shared.

22

00:01:30,660  -->  00:01:37,310
We define an interface called sharable which is implemented by only book and Roblin classes he called

23

00:01:37,310  -->  00:01:44,020
a sharable cannot be an abstract class because our classes are already extending that abstract bookmark

24

00:01:44,030  -->  00:01:44,920
class.

25

00:01:45,420  -->  00:01:50,790
Moreover sharing is an optional capability and so we know that it would have to be represented using

26

00:01:50,790  -->  00:01:52,290
an interface.

27

00:01:52,470  -->  00:01:56,470
So let's get started now and let's first create the interface shippable.

28

00:01:56,880  -->  00:02:02,100
Let's create it in a new package called partner as shootable has something to do better.

29

00:02:02,190  -->  00:02:03,810
Third party partner websites

30

00:02:07,260  -->  00:02:08,890
so let's create a new package

31

00:02:12,890  -->  00:02:14,260
partner

32

00:02:15,840  -->  00:02:17,690
.

33

00:02:21,370  -->  00:02:25,910
Let's create an interface here shootable

34

00:02:29,710  -->  00:02:39,250
and that's how you define the method get item data.

35

00:02:39,310  -->  00:02:41,870
Next let's have rebeling on book.

36

00:02:41,910  -->  00:02:44,670
Implement this sharable interface.

37

00:02:44,880  -->  00:02:57,450
Let's just open the book Class control shift are just and this book is implemented in open

38

00:03:00,050  -->  00:03:04,680
court.

39

00:03:07,120  -->  00:03:11,560
So just sit ired unimplemented methods which is to get item data.

40

00:03:11,980  -->  00:03:17,890
So if you scroll down so be how the Templer generated automatically.

41

00:03:18,300  -->  00:03:25,980
OK so we know that this method returns information about this particular item which is a book in XML

42

00:03:25,980  -->  00:03:29,800
format which isn't shared with a partner website.

43

00:03:29,970  -->  00:03:37,150
Typically data exchange between Web sites is done either in examen or Jason farmer Gissen is another

44

00:03:37,170  -->  00:03:43,380
format but it is much more compact and XML in case you don't know what ex-head malice.

45

00:03:43,410  -->  00:03:50,510
It is short for Extensible Markup Language And it basically encapsulates doodah using meaningful examinee

46

00:03:50,520  -->  00:03:58,850
tax so the docs describe what the data is about the exim unstring that is generated is human readable

47

00:03:58,860  -->  00:03:58,960
.

48

00:03:59,030  -->  00:04:05,790
Art can also be processed by machines suitable ex-MIL string we will use a string builder as there are

49

00:04:05,790  -->  00:04:11,360
several fields in book class and we need to combine them into a single string.

50

00:04:11,370  -->  00:04:17,400
Recall that it's not recommended to use plus operator for string concatenation especially when performance

51

00:04:17,400  -->  00:04:18,810
is critical.

52

00:04:18,950  -->  00:04:21,240
That surplus should be used only sparingly.

53

00:04:21,480  -->  00:04:27,570
OK so let's just get started and belive this particular method.

54

00:04:29,320  -->  00:04:30,810
You can just delete this

55

00:04:33,780  -->  00:04:34,670
Arnaud's builder

56

00:04:39,540  -->  00:04:46,600
so a builder has happened matter.

57

00:04:48,420  -->  00:04:57,180
So let's have the first semantic tag as item and its cluelessness.

58

00:04:58,830  -->  00:05:04,710
So I accidently tax how the starting tag and name tags are it's have an ending tag a name tag would

59

00:05:04,710  -->  00:05:10,250
have a forward slash followed by the tag name item.

60

00:05:10,260  -->  00:05:19,230
Now since this is of Bible book so let's have an element just for book saying that it's a book so it's

61

00:05:19,230  -->  00:05:21,270
Connard as Bible

62

00:05:32,470  -->  00:05:37,840
so book is the real data type is another I.

63

00:05:38,560  -->  00:05:44,290
Let's have a burn at night here.

64

00:05:46,500  -->  00:05:48,350
But it has real value.

65

00:05:48,400  -->  00:05:49,780
So let's just remove this

66

00:05:52,340  -->  00:05:54,870
and rebuild that Shane.

67

00:05:55,190  -->  00:05:56,540
Yes.

68

00:05:56,990  -->  00:06:03,830
I mean that's good one more happened here for the name tag.

69

00:06:06,190  -->  00:06:10,710
Now the title is present in the supercross which is bookmark.

70

00:06:11,250  -->  00:06:20,040
And to get that we just need to do when we need to invoke the get Bitly method in the superclass.

71

00:06:20,380  -->  00:06:21,040
So next

72

00:06:24,190  -->  00:06:30,490
so we have all these feelings and we need to combine We need to include all these fields in our Exham

73

00:06:30,490  -->  00:06:31,940
of string.

74

00:06:33,700  -->  00:06:35,500
So next let's say publisher

75

00:06:39,200  -->  00:06:43,000
schoolbags public publisher publication here.

76

00:06:43,000  -->  00:06:46,110
OK it's good been publisher.

77

00:06:46,140  -->  00:06:48,270
So let's call the element as publisher

78

00:06:53,880  -->  00:07:00,370
since publisher is available in this class itself so we can directly access it

79

00:07:00,370  -->  00:07:08,040
.

80

00:07:08,380  -->  00:07:10,090
Next let's have publication here

81

00:07:10,120  -->  00:07:19,830
.

82

00:07:29,620  -->  00:07:31,960
Next let's have John Ray

83

00:07:32,340  -->  00:07:41,740
.

84

00:07:42,450  -->  00:07:44,320
Next is Amazon rating

85

00:07:45,180  -->  00:07:57,830
.

86

00:08:01,500  -->  00:08:11,520
One more we have is authors let's just keep it here because it's like an important field.

87

00:08:16,450  -->  00:08:22,320
However alter says a string array rather than a string or an.

88

00:08:22,480  -->  00:08:24,160
It is a string array.

89

00:08:24,250  -->  00:08:32,970
So what we can do is we can make use of a third party library here we can use Apache Commons slang because

90

00:08:32,980  -->  00:08:40,150
it has it has a class called String Udall's which can be used to join to combine to concatenate all

91

00:08:40,140  -->  00:08:43,230
of the authors using a single function.

92

00:08:43,380  -->  00:08:43,660
OK.

93

00:08:43,670  -->  00:08:50,060
So with a single function in the string utils class we can combine all the authors all the alternates

94

00:08:50,110  -->  00:08:53,580
into a single string and we can do that.

95

00:08:53,710  -->  00:08:57,540
So let's use the string utos grads from Apache Commons line.

96

00:08:57,790  -->  00:08:59,300
But we don't have it here.

97

00:08:59,400  -->  00:09:06,150
So what we need to do is we need to download Apache a common Lange's and use the Jarve file for doc

98

00:09:06,140  -->  00:09:06,580
.

99

00:09:06,610  -->  00:09:08,220
So I have already done that.

100

00:09:08,560  -->  00:09:16,910
So I have it here but you can just go ahead and can just type in about the Commons monster lying.

101

00:09:16,920  -->  00:09:18,470
Here it is.

102

00:09:18,700  -->  00:09:21,890
And you can download Apache Commons line.

103

00:09:22,330  -->  00:09:28,450
That's the latest version is 3.4 and it requires that I was 6 and just you can download the binary here

104

00:09:28,960  -->  00:09:37,160
and just unzip it and extract the folder and within that with no room for Ladu you will have a jar file

105

00:09:37,480  -->  00:09:41,090
so you can just extract that jar file and store it on your desk.

106

00:09:41,250  -->  00:09:45,880
And then we need to import it into our into our eclipse.

107

00:09:45,900  -->  00:09:55,100
So the way we do it is just right click on three are here is going to properties going to be part and

108

00:09:55,320  -->  00:10:02,390
I had external jars and this is an older one so to me

109

00:10:07,690  -->  00:10:08,280
your

110

00:10:12,320  -->  00:10:13,170
think Howard here.

111

00:10:13,170  -->  00:10:13,980
Yes.

112

00:10:14,020  -->  00:10:18,250
So this is the one and lie.

113

00:10:18,960  -->  00:10:20,600
OK.

114

00:10:21,550  -->  00:10:23,460
So here is the reference library.

115

00:10:23,470  -->  00:10:25,510
So it's already there.

116

00:10:25,500  -->  00:10:30,790
So Apache Commons Lang has this class called String Udalls.

117

00:10:30,790  -->  00:10:34,830
So let me do it and let's just search for it.

118

00:10:35,050  -->  00:10:36,130
We just show that

119

00:10:41,520  -->  00:10:44,710
string your DOS.

120

00:10:44,860  -->  00:10:53,720
Here is the class String utos class.

121

00:10:55,210  -->  00:11:02,290
So it has a lot of utility functions and I'm sure you will be making use of this class quite a bit.

122

00:11:02,430  -->  00:11:09,090
So here there is one function called Join in and this is the one.

123

00:11:09,280  -->  00:11:11,140
So this can take a string array.

124

00:11:11,130  -->  00:11:16,440
It's an object array but you can pass a string array and you will pass on any operator like a hybrid

125

00:11:16,440  -->  00:11:18,770
of can be Ostrower or anything like that.

126

00:11:19,210  -->  00:11:24,220
And we will pass on common so that we get a comma separated string.

127

00:11:24,390  -->  00:11:30,740
So it will combine all the auteurs into it and into a single string which is operated by comma.

128

00:11:30,860  -->  00:11:32,910
And so let's just make use of this function

129

00:11:39,520  -->  00:11:41,410
.

130

00:11:41,940  -->  00:11:47,830
So you join others.

131

00:11:47,860  -->  00:11:51,890
Now the second argument is a comma.

132

00:11:51,980  -->  00:11:54,340
OK so that's it.

133

00:11:54,340  -->  00:11:57,490
So that's the string Udalls it's already imported.

134

00:11:57,690  -->  00:11:59,250
She's next.

135

00:11:59,250  -->  00:12:08,620
And let's just see written Berliner got to string.

136

00:12:10,090  -->  00:12:10,670
OK.

137

00:12:10,680  -->  00:12:12,630
So this would work on a string.

138

00:12:13,000  -->  00:12:15,110
So that's the good item there Dummett there.

139

00:12:15,490  -->  00:12:18,690
Let me just go ahead and do the same.

140

00:12:18,740  -->  00:12:24,400
Godard under Dummett that let me implement the Guitard underdone method in the grappling class because

141

00:12:24,390  -->  00:12:27,480
wabbling also implements this interface.

142

00:12:27,750  -->  00:12:32,760
And then I'll do this offline and I'll come back and show it to you.

143

00:12:34,540  -->  00:12:34,780
OK.

144

00:12:34,780  -->  00:12:35,670
Here it is.

145

00:12:35,860  -->  00:12:37,670
So we are implementing shareable.

146

00:12:37,960  -->  00:12:40,420
And of course we are extending bookmark.

147

00:12:41,130  -->  00:12:43,800
So here is the get item re-admitted.

148

00:12:44,350  -->  00:12:47,810
And as you can see we are once again using string builder.

149

00:12:48,400  -->  00:12:51,020
And so we have this item tags here.

150

00:12:51,040  -->  00:12:52,740
Opening tag on the closing tag.

151

00:12:53,380  -->  00:12:55,530
And we have pipe which is wabbling.

152

00:12:55,930  -->  00:13:02,260
Let's actually make this gap to be consistent and then the next element is title and the next is you

153

00:13:02,250  -->  00:13:04,510
aren't on the next as host.

154

00:13:04,720  -->  00:13:09,450
So those are the only fields that we have for for the ruling class.

155

00:13:09,490  -->  00:13:10,970
So that's about it for now.

156

00:13:11,020  -->  00:13:14,960
So just go ahead and implement what we covered so far here.

157

00:13:15,250  -->  00:13:20,580
Next we will complete the remaining part of this feature in the next lesson and we will code the logic

158

00:13:20,640  -->  00:13:23,920
in view controller and the manager process.

159

00:13:24,070  -->  00:13:30,320
OK so please just go ahead and call whatever has been shown in this class and this lesson
