So far we created entities managers and feel constant exporting classes not its Creator didn't need 2
it for our application. 3
That is the database itself will create a class called data store. 4
Now in the resources section I'm adding 4 x files called user book movie and web link. 5
These files include the raw data needed for our application. 6
In this first version we will simply copy those values on hard code them in the data stored class laded 7
we will extend the project to direct read from those files. 8
But for now we'll be using the hardcoded values. 9
Let me just show you those files. 10
And for the user to find I will show you how to created. 11
So this is the book file. 12
Here it is. 13
And these are this is the raw data and the. 14
So this is one row andere within each and all the values are pops up record tab delimited. 15
So this is the ID field this is the title of the book. 16
This is the year when it was published and this is the publisher name. 17
And here this is the author's name. 18
Sometimes there can be multiple authors like in this case here. 19
And this is the genré and this is the rating. 20
And let's not worry about this final flip here. 21
It is related to a kid friendly feature. 22
And similarly we a book or movie free movie file here and this is the idea once again and the name of 23
the title of the movie year when it was released cast and director John Gray I am repudiating And once 24
again you can ignore this. 25
And similarly we have the book the weblink here. 26
And it has some for use here the idea and there is a you are all here. 27
And here we have the host information 28
which is nothing but the just the domain name off that you are. 29
And this is the Pitre here. 30
So those are the three files. 31
So let's just go ahead and create the user file. 32
So just right click on which is a project say name a new and click on this untidy text file because 33
we want to create a text file. 34
Let me just copy those values here for the user fine. 35
And let's just head control as and it is asking us to set up the page folder since we are dealing with 36
the project we just really don't know just click that and let's just call it user. 37
So that's the user ex-fighter. 38
And if we go here in on our desk so within JRD within really our project you can see that all the forefronts 39
God created had book we use and web link. 40
So those are the four files and you can find them in the resource section. 41
So let's just go ahead now and create the class the data store class and camarade semantics word or 42
three here which is like the root of the package structure 43
. 44
Class called it a store in the package sig com. 45
So in a calm semantics word through Leo and that's it. 46
So we have data store. 47
Now within this package. 48
So first thing is let's create the data structures needed to hold the data. 49
So let's create a data structure to hold just the users information. 50
Static. 51
So user information can be stored in a user array. 52
You can have five users initially. 53
That's just import. 54
Next let's create the data structure to hold. 55
Bookmark information just the bookmarks so it needs to be a two dimensional array because we have different 56
kinds of bookmarks so we need one dimension for that type. 57
And the other for the actual bookmarks 58
Coretta's bookmarks. 59
So we have three types and each type can have five bookmarks. 60
And let's also create one to hold the user bookmarks. 61
So whenever a user bookmarks a particular bookmark so it needs to be stored in some data structure let's 62
create one for that. 63
If you remember we hired this entity called user bookmark. 64
So that's also in court here in this bookmark here and it's Connard as user bookmarks. 65
Now there are five users and each user can bookmark five of them. 66
So that's the Lamech we how that's something for this. 67
So those are the three data structures that we have now. 68
It's not very good to hardcore these values here. 69
So let's use that straight to our students to be factor of this. 70
So let's go here and it's just right quick Reflektor and let's say extract constant and we can call 71
it as Dr. underscore user underskirt can't we do the same thing for here. 72
For sure we extract constant. 73
So it's the type so let's call it as bookmarks. 74
I don't 75
know this says the code the limits within each type. 76
So let's also rename this let's call it a bookmark call and type. 77
So that's the bookmark call and prototype. 78
So this is simply the user count. 79
And this is 80
the limit on the number of bookmarks that a user can bookmark so that Scollard does user bookmarklet 81
. 82
OK. 83
So those are the ones that we have next. 84
That's right Fuma that's now. 85
That's right a method called load data which is responsible for loading the data. 86
So let's make it a public topic. 87
LLOYD 88
So let's have separate methods to load users babblings. 89
Movies and books. 90
So first method let's call it does more users. 91
Now let's just make this as a private matter. 92
So initially we will call this method loading dock to load the data on dockworker internally invoke 93
all the private methods to load all the data for needed for the application 94
. 95
So the data that has to go into this idea needs to be stored into this array so fosters let's say users 96
who are they use 0 0 and let's get the values from or file the Ostrow. 97
So these are the values. 98
So these are all DAPs operator. 99
Let's just make it camos operator. 100
So the way we would do it is we would invoke. 101
If you look at the managers so we're going to call this method create user end user manager. 102
Again we are going to pass all those values from there. 103
So let's call it as a user manager. 104
Now let's get to get an instance method which returns a singleton is it not. 105
So it's just. 106
HARLOW This auto generated content. 107
So Id Dexters email 108
first is the password. 109
Next this is John as the host name. 110
This is the last name we just have a single character here or last name. 111
Now this is gender or gender 112
it's your 113
gender is actually supposed to be. 114
And so let's just go here and for male. 115
So if you look at gender here one stands for male it is zero. 116
So let's just go ahead and 117
let's just say gender dark mean so let's make use of the constant exploding glass here. 118
So that's how re-initialize we passed that. 119
The last one is the user which is a user type. 120
So if you go into user type. 121
So here we have user. 122
So let's just say user Ibaraki user 123
so that's the first rule. 124
So let me just take this offline and create the rest of the rules popular the rest of the rules and 125
then I will. 126
And then I will show you the entire method. 127
OK. 128
Here are the rest of the rules. 129
So we have five users here. 130
And just like the first rule we have we are populating the rest of the rules. 131
Also That's about the users on a new motor Kollek Lord doublings has been added. 132
I'm actually so that's popular does. 133
So before this goes into the bookmarks data structure. 134
So let's see. 135
So it's a two dimensional array. 136
So in the first dimension we are going to add on only babblings. 137
So within the first dimension we are going to add the first bookmark. 138
OK so that's the first bookmark. 139
And let's use the bookmark manager. 140
You get instance mattered. 141
And we already have this method called create weblink. 142
Now we just need to copy the values from our wabbling file. 143
So let me disclose this user right here. 144
You notice we don't need that last column for now. 145
So let's just name it 146
. 147
And this is the second argument. 148
It's a string 149
. 150
Third is the website you are ill. 151
And then there's string 152
Portlands the host information. 153
So let me just go ahead. 154
Offline and come back and show you the rest of the rows. 155
OK here are the rest of the rules. 156
Earlier there was a minor mistake that we made the index we had it as a run which is supposed to be 157
zero. 158
So that's corrected. 159
So we have all the babblings here in 0 8 row. 160
And so these are the column values and here we how all the blanks. 161
OK let's also call this to be consistent. 162
Let's make this L gap l ramblings and it's just do the same here and there. 163
So that's what blanks the next let's do it for movies no movies 164
good books. 165
So I mean just highlighted this create matter 166
create it to us. 167
So let's just go ahead and finish this thing first. 168
Let me just copy here. 169
That's how users first mumblings next. 170
And movies here. 171
So that's bookmarks. 172
So it's a new dimension in this dimension with how we won the first one. 173
As So the zero it raw as far ramblings. 174
So this one for the first one is for movies. 175
Next when we have Brooksville hybrids do. 176
Now the zeroth element within this dimension. 177
Copy this 178
. 179
Let's create a movie. 180
That's what we have. 181
And let's get the values from first here. 182
Let's ignore the last one here and it's just copy all of this 183
the 184
Citizen Kane and rustic movie. 185
And I guess this is cast here. 186
So it's a string array because there are cast has multiple values. 187
So let's do this new 188
next is directors directors can also be multiple directors. 189
So that's how I ended Stringer here 190
. 191
Next is genré. 192
We don't really let's make use of that. 193
And it's a classics 194
Lassman is the raping the I am the in. 195
So let me just go ahead and finish up. 196
Seems like you're missing something here. 197
So let's just go to Mark manager. 198
I do. 199
Sorry it's here and it's Id need to that profile of you are. 200
OK. 201
So let's put an M.D. over there because we don't have a profile of you on here. 202
OK. 203
All we are good. 204
So let me just go ahead and finish this method and I will also offer up the lord books matter and then 205
we can review the methods. 206
OK. 207
So the rest of the data has also been populated. 208
So within the last movies we have the rest of the Read here for all the different columns. 209
So this is the leader and the same thing has been done for books. 210
Sort of goes into the second row it's a new type. 211
And the data has been copied from the book filed here or here. 212
So that is here is the order list. 213
So it is a string theory and be made use of those constant exporting class book genré in order to set 214
up the genré information. 215
So this is notebook's. 216
So really with this we have all the data that's needed. 217
Now let's also ired couple of things. 218
Let's say we want to get hurt for this so that it can be invoked from some other process. 219
So that's how together for users and bookmarks. 220
So this is going to source ironer said Jondrette getters and setters. 221
Let's just how only get so let's say let's do that. 222
And it's created here is just fine. 223
Let's also do the same thing for bookmarks. 224
So that will written all the bookmarks so that's how to get her for that 225
. 226
So those are on the bookmarks now. 227
So that's there they just don't glass. 228
So we have some data structures here for holding the data. 229
And in order to populate the data we created this last date which is a public matter and it has it. 230
It didn't work for private methods for loading day for users of eyeblink movies and books and we also 231
have the guidelines for users and bookmarks. 232
So that started us store class for now.