Implementation Details (Shared Campaigns)
Change log:
Date: | Author: | Version: | Changes: | Completed | Ext. | Int. | Is in Core | Jira Ref. |
---|---|---|---|---|---|---|---|---|
14 Juni 2013 | Thomas Hjorth
| 0.1 | Doc. created | No |
| x | Not yet | CDRP-5829 and CDRP-6067 |
18 June 2013 | THJ | 1.0 | Doc. finished in Version 1.0 | Yes |
| x | 8.18 | CDRP-5829 and CDRP-6067 |
Handling Shared Campaigns in the Java Code
In order to handle campaign sharing, service interfaces and abstract classes have been defined.
The interface, abstract classes, and specific implementations can be grouped into two layers: Backend Layer and Core Layer.
Backend Layer
This layer has the basic building blocks. The classes in this layer basically only handle one thing for one class. It can be a bean which is just a collection of classes that shares some kind of relationship, but it does not operate on them (= only implements getters and setters).
Core Layer
This layer has the elements that bind the system's basic building blocks and actions together. The classes in this layer often handle more than one object, using Core logic to relate the objects and the actions you perform on each of them.
The classes in this layer should operate on objects in the Backend Layer through interfaces and abstract methods, or on other objects in the Core Layer.
Core Layer
SubscriptionCampaignRelationFinder
This is the "main entry" into finding relations in the Subscription/SubscriptionCampaign area. Core logic (and business logic) should most often initiate work in this area through classes that implement this interface.
For most actual work you will get another object through this interface, and this other object will then be used to handle the more specific requests, e.g. if you want to find all the SubscriptionCampaigns owned by a specific Subscription, then this interface is asked to get an object that implements the SubscriptionCampaignFinder interface, and this other object is asked to find the Subscription's SubscriptionCampaigns.
Also through this interface it can be checked whether SubscriptionCampaign sharing is enabled at all.
In Core, this interface is implemented by the class CoreSubscriptionCampaignRelationFinder.
SubscriptionCampaignFinder
A class that implements this interface is used for finding SubscriptionCampaigns for a specific Subscription. It can either be the SCs owned by the subscription itself, or the SCs that the Subscription can access through sharing. These are the relations that are called 2A and 2B on /wiki/spaces/Billing/pages/109165251.
In Core, this interface is implemented by the class CoreSubscriptionCampaignFinder.
SubscriptionCampaignSharingMapper
A class that implements this interface is used for finding all the Sharing Groups relations a specific SubscriptionCampaign participates in. This is the relation that is called 1B on /wiki/spaces/Billing/pages/109165251.
Note that the returned result is not a specific SubscriptionCampaign, but rather a SubscriptionCampaignSharingBean (or some collection of these).
In Core, this interface is implemented by the class CoreSubscriptionCampaignSharingMapper.
Backend Layer
SubscriptionCampaignSharingBean
This class collects the information about a shared SubscriptionCampaign: Which specific SubscriptionCampaign it is, which method that is used for sharing it, and which group it is shared with.
SubscriptionCampaignSharingMethodMember
A class that implements this interface knows how to translate information about a shared SubscriptionCampaign into a SubscriptionCampaignSharingBean. There will be one class implementing this interface per sharing method. Each of these classes knows which specific sharing method it covers.
In Backend, this interface is implemented by the classes SharedServiceMember and SubscriptionCampaignMember.
SubscriptionCampaignSharingGroup
A class that implements this interface can be used as a sharing group.
In Backend, this interface is implemented by the classes Subscription, BillingGroup, and Account.