---Presenter: Eric WeatherSubject: EntitiesDuration: 00:11:02---00:00:05.920 --> 00:00:10.012 - All right, in this video, we're going to be going over entities 00:00:10.012 --> 00:00:14.786 - how to create them, how we use the abstract, and why we use the 00:00:14.786 --> 00:00:16.832 - abstract, and how to pull them 00:00:16.832 --> 00:00:21.284 - into our. Our client specific app, so we have this training 00:00:21.284 --> 00:00:25.444 - connector here. Right now it's just a blank blank connector. 00:00:25.444 --> 00:00:27.940 - We're going to get started with 00:00:27.940 --> 00:00:31.440 - entities. So the first thing we're going to add an entity 00:00:31.440 --> 00:00:35.738 - and. Right now, they're currently the only the only 00:00:35.738 --> 00:00:37.382 - entity we have on. 00:00:38.610 --> 00:00:45.180 - On the API that I am using is a product, so we're going to name 00:00:45.180 --> 00:00:52.574 - this product. All right, so we're going to make this a 00:00:52.574 --> 00:00:54.542 - public abstract class. 00:00:54.550 --> 00:00:58.055 - We are going to do 00:00:58.055 --> 00:01:03.600 - abstract for. The main reason that we want a little bit of 00:01:03.600 --> 00:01:08.982 - safety in here. The reason we use abstract is that a lot of 00:01:08.982 --> 00:01:13.536 - ERP's have base core properties that every iteration of that ERP 00:01:13.536 --> 00:01:18.090 - will have. So every client that uses NetSuite, for example, will 00:01:18.090 --> 00:01:23.058 - all have these 50 fields or whatever they are on the number 00:01:23.058 --> 00:01:27.198 - of fields on the entity. However, they allow for some 00:01:27.198 --> 00:01:30.510 - customization, so it's possible that they could have. 00:01:30.530 --> 00:01:34.355 - Additional fields that are client specific, so for example, 00:01:34.355 --> 00:01:40.305 - client a may have an extra 10 fields, or client B may have an 00:01:40.305 --> 00:01:45.830 - extra 1 field or client. See may not have any extra fields, but 00:01:45.830 --> 00:01:50.930 - we always want to make sure that we are inheriting from the 00:01:50.930 --> 00:01:55.180 - abstract class into our main entity here and then we're 00:01:55.180 --> 00:02:00.280 - always going to use this client specific into T at this level, 00:02:00.280 --> 00:02:04.168 - so. We're going to put some products on here. I have some 00:02:04.168 --> 00:02:07.048 - product, so let's go ahead and throw. Those are some 00:02:07.048 --> 00:02:10.504 - properties. Let's go ahead and throw those on and then we'll go 00:02:10.504 --> 00:02:12.232 - ahead and put public on these. 00:02:13.800 --> 00:02:14.290 - Oops. 00:02:16.800 --> 00:02:19.980 - OK, so now we have our properties on our product. 00:02:21.180 --> 00:02:24.276 - And this one is going to be pretty simple. All we're going 00:02:24.276 --> 00:02:27.114 - to do is we're going to go into our entities class. 00:02:30.900 --> 00:02:32.560 - We're going to name this. 00:02:33.180 --> 00:02:37.276 - Clients product you can replace the product, the 00:02:37.276 --> 00:02:39.324 - client, the client here. 00:02:40.590 --> 00:02:46.664 - With. Eh? With whatever the prefixes. So for 00:02:46.664 --> 00:02:48.440 - example, if we're using. 00:02:48.450 --> 00:02:52.230 - Clarity, so we would put CD 00:02:52.230 --> 00:02:57.216 - I. And then this is going to be the training product CPI 00:02:57.216 --> 00:03:00.780 - training product because training is the ERP. If you're 00:03:00.780 --> 00:03:04.740 - using that sweet, this would be Cephei, NetSuite, product or. 00:03:05.370 --> 00:03:10.141 - CDI CRM product or you get the picture so we're going to name 00:03:10.141 --> 00:03:14.178 - it a naming convention of client. The ERP that it's coming 00:03:14.178 --> 00:03:16.013 - from and then the entity. 00:03:17.300 --> 00:03:21.557 - So we'll add that. Alright, so we're going to do a 00:03:21.557 --> 00:03:22.331 - public class. 00:03:24.050 --> 00:03:29.198 - An in this one we are going to need to get this product 00:03:29.198 --> 00:03:32.762 - so this is going to be inheriting from product. 00:03:34.610 --> 00:03:38.162 - And our control period shows us in here because we have access 00:03:38.162 --> 00:03:42.010 - to it in the solution that we need to add the clarity training 00:03:42.010 --> 00:03:45.562 - dot entities eventually once. If this is not a new connector and 00:03:45.562 --> 00:03:49.706 - the this entity is already set up, you can just pull in the new 00:03:49.706 --> 00:03:53.258 - get package and reference the new get package. But we can go 00:03:53.258 --> 00:03:56.514 - over that in a different video, but for now, because we're 00:03:56.514 --> 00:03:57.994 - creating this new this new 00:03:57.994 --> 00:04:01.390 - connector. We're going to go ahead and add or out of 00:04:01.390 --> 00:04:03.931 - reference to the project directly. That way if we need to 00:04:03.931 --> 00:04:06.934 - make any direct changes, we can make them quickly on the fly and 00:04:06.934 --> 00:04:10.168 - then we can package all of this into a new get package later to 00:04:10.168 --> 00:04:16.280 - reference for production. But let's say my client 00:04:16.280 --> 00:04:20.950 - uses. Uses an extra couple fields on here, so let's say 00:04:20.950 --> 00:04:24.700 - that they have a public string that is their internal. 00:04:26.580 --> 00:04:27.530 - Skew. 00:04:30.230 --> 00:04:33.638 - And let's say that they have 00:04:33.638 --> 00:04:39.300 - also a. They want to use a sale price so all products have a 00:04:39.300 --> 00:04:43.655 - price and they have a sale price so that will use a public 00:04:43.655 --> 00:04:45.320 - decimal. Sale price 00:04:47.480 --> 00:04:52.430 - And that's going to be so, because this product here is 00:04:52.430 --> 00:04:56.480 - abstract. We can't ever instantiate this, so we can't 00:04:56.480 --> 00:05:00.530 - ever get it confused and accidentally use this product 00:05:00.530 --> 00:05:04.130 - that would that would unintentionally leave off the 00:05:04.130 --> 00:05:09.080 - extra 2 SKUs that are client specific. So all iterations of 00:05:09.080 --> 00:05:14.030 - this training ERP have these fields on them. Then we would 00:05:14.030 --> 00:05:18.530 - add these two client specific fields in the concrete version. 00:05:18.590 --> 00:05:22.506 - Of connect and then we would. All will always instantiate this 00:05:22.506 --> 00:05:26.422 - one whenever we're using it. That way we always get this. 00:05:26.422 --> 00:05:29.626 - It's very possible that you'll use an ERP where. 00:05:30.480 --> 00:05:33.492 - It just looks like this, but you'll always want to use this 00:05:33.492 --> 00:05:35.249 - one because this one needs to be 00:05:35.249 --> 00:05:40.589 - abstract. Going further on that, so let me. 00:05:41.350 --> 00:05:45.886 - Put this back in here. Let's create a new entity here and 00:05:45.886 --> 00:05:50.800 - we're going to create a new item and we're going to call this. 00:05:51.540 --> 00:05:52.970 - Eh? 00:05:55.550 --> 00:05:56.960 - A invoice. 00:06:00.330 --> 00:06:03.872 - OK, so again, we're going to make this a public abstract 00:06:03.872 --> 00:06:09.032 - class. And we're going to make this one fairly simple just so 00:06:09.032 --> 00:06:13.868 - it can show how we're going to use this. So on an invoice, 00:06:13.868 --> 00:06:16.100 - let's say an invoice contains a. 00:06:17.900 --> 00:06:20.690 - A reference to a customer number. 00:06:22.970 --> 00:06:26.159 - Let's say it. 00:06:26.160 --> 00:06:30.534 - References a total, so we'll do it decimal total. 00:06:32.500 --> 00:06:38.415 - And then let's say that in here it also references the list of 00:06:38.415 --> 00:06:40.690 - products that are on this 00:06:40.690 --> 00:06:46.998 - invoice so. The issue with doing the abstract and then also 00:06:46.998 --> 00:06:52.520 - having needing to have client specifics is that we would not 00:06:52.520 --> 00:06:57.540 - want to. What we can't first of all do a. 00:06:59.940 --> 00:07:02.388 - We cannot do it like this. 00:07:08.440 --> 00:07:12.340 - The reason for that is that we can't instantiate of new product 00:07:12.340 --> 00:07:15.590 - because it's abstract. The secondary part of this, and this 00:07:15.590 --> 00:07:20.140 - is where the abstract for safety comes into play is that if I am 00:07:20.140 --> 00:07:22.415 - doing a list of product at this 00:07:22.415 --> 00:07:29.402 - level. If when I do this I will be missing out on these 00:07:29.402 --> 00:07:33.911 - extra entities that a client specific product uses so. 00:07:34.510 --> 00:07:37.480 - All of the products will miss the missing their internal skew 00:07:37.480 --> 00:07:41.530 - and their sales price. If I was eight, if I was even able to do 00:07:41.530 --> 00:07:44.770 - this, they would not have those two fields on them. So instead 00:07:44.770 --> 00:07:48.550 - of doing them at this level, we have to do it at the client 00:07:48.550 --> 00:07:51.790 - specific level. So let's say that these are the only two base 00:07:51.790 --> 00:07:53.410 - properties on an invoice for the 00:07:53.410 --> 00:07:57.936 - training connector. But the client we're going to 00:07:57.936 --> 00:08:02.625 - add another class here. We're going to call this 00:08:02.625 --> 00:08:04.188 - cephei training invoice. 00:08:06.790 --> 00:08:12.634 - All right, we're going to make this public, and this is going 00:08:12.634 --> 00:08:15.069 - to inherit from the invoice. 00:08:17.860 --> 00:08:20.965 - Again, will need to add are using clarity training 00:08:20.965 --> 00:08:24.070 - entities because you could have another ERP at you. 00:08:24.070 --> 00:08:27.865 - Can't just do entities and it might be called Invoice so. 00:08:28.960 --> 00:08:33.460 - Let's say on the CPI training invoice we have 00:08:33.460 --> 00:08:37.960 - have an extra extra line called reference number. So 00:08:37.960 --> 00:08:40.460 - let's do a public string. 00:08:41.720 --> 00:08:42.839 - The reference number. 00:08:44.260 --> 00:08:44.820 - Oops. 00:08:46.290 --> 00:08:52.198 - And at this level now we can do a public list of not just 00:08:52.198 --> 00:08:56.418 - products, but we actually need a public list of CPI 00:08:56.418 --> 00:08:57.262 - training products. 00:08:58.570 --> 00:09:00.160 - Called products. 00:09:01.900 --> 00:09:06.157 - So now we can instantiate a CPI training product and then 00:09:06.157 --> 00:09:10.414 - all of these lists will have all of the necessary internal 00:09:10.414 --> 00:09:11.575 - skuin sale price. 00:09:13.770 --> 00:09:18.404 - The last thing that we want to do, and we should have done this 00:09:18.404 --> 00:09:22.045 - in the first place, is we're going to actually move these 00:09:22.045 --> 00:09:23.700 - into a cephei entities folder. 00:09:25.640 --> 00:09:28.896 - Wanna grab these two? I'm going to put them in there. 00:09:30.740 --> 00:09:35.290 - So now our CI entities have our CI. So if we were then 00:09:35.290 --> 00:09:39.490 - also let's say going with Jeff, we can add a new folder 00:09:39.490 --> 00:09:40.890 - here called stuff entities. 00:09:44.940 --> 00:09:49.092 - And I do apologize. This is actually not going to be Cephei 00:09:49.092 --> 00:09:52.552 - entities, but this is going to be training entities because 00:09:52.552 --> 00:09:56.704 - that is the name of our connector here. So in here will 00:09:56.704 --> 00:10:00.510 - have our training entities. We have our CPI training and voice. 00:10:00.510 --> 00:10:04.316 - So for example, in our Steven cities, obviously Seth has its 00:10:04.316 --> 00:10:05.700 - own new get packages. 00:10:06.530 --> 00:10:10.898 - Is a different different kind of animal. If you will. We don't 00:10:10.898 --> 00:10:15.266 - necessarily use the. We wouldn't use the concrete since F, but we 00:10:15.266 --> 00:10:20.362 - can get that to get to that when we go over the 70s and 00:10:20.362 --> 00:10:24.366 - integrating with stuff. But for now, if you're creating a new 00:10:24.366 --> 00:10:28.006 - ERP connector, you would use training entities and then you 00:10:28.006 --> 00:10:32.738 - would need to create your base and then even if these are blank 00:10:32.738 --> 00:10:37.834 - they still need to have the list of the. So even if this was. 00:10:37.900 --> 00:10:39.490 - Even if these did not exist. 00:10:40.620 --> 00:10:44.592 - We would still need to do it this way because we can't 00:10:44.592 --> 00:10:48.233 - instantiate a regular product and we want to have safety in 00:10:48.233 --> 00:10:49.888 - case that the client introduces 00:10:49.888 --> 00:10:52.942 - a custom. Property on this on 00:10:52.942 --> 00:10:56.540 - this entity. We don't have to go back and change a bunch of 00:10:56.540 --> 00:10:58.440 - code, it just we just have access to a here. 00:11:00.070 --> 00:11:02.790 - OK, I think that does it for now on entities.