[MAGNOLIA-6689] Syndicator deprecates init but there is no alternative to set the parameters Created: 10/Jun/16 Updated: 08/Jul/16 Resolved: 08/Jul/16 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | activation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Teresa Miyar | Assignee: | Unassigned |
| Resolution: | Not an issue | Votes: | 0 |
| Labels: | support | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Template: |
|
||||
| Acceptance criteria: |
Empty
|
||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||
| Date of First Response: | |||||
| Comments |
| Comment by Jan Haderka [ 08/Jul/16 ] |
|
As javadoc comment on deprecated method says it is exactly to encourage initialization of parameters via IoC in <cinit> of concrete implementation rather then by arbitrary method. Currently you have to do:
syndicator = Components.getComponentProvider().newInstance(Syndicator.class);
syndicator.init(
MgnlContext.getUser(),
this.getRepository(),
ContentRepository.getDefaultWorkspace(this.getRepository()),
getRule());
but when one is not relying on deprecated method it should be possible to initialize implementation instead as:
syndicator = Components.getComponentProvider().newInstance(Syndicator.class,
MgnlContext.getUser(),
this.getRepository(),
ContentRepository.getDefaultWorkspace(this.getRepository()),
getRule());
or even with just (as user and default rule objects should be available in current context):
syndicator = Components.getComponentProvider().newInstance(Syndicator.class,
this.getRepository(),
ContentRepository.getDefaultWorkspace(this.getRepository()));
This whole construct then allows abstracting where user or rule is coming from making code that invokes Syndicator simpler and more flexible (e.g. we can easily inject correct user even if call is made from system context or asynchronously via workflow). |