-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(plugin): #29276 - Fix portlet serialization using immutables and …
…jackson (#29345) ### Proposed Changes * JAXB Serialisation was causing issues due to the masking of fields from the base Portlet by DotPortlet. When you reference the cast to Portlet you get the field on that class, and get different results when cast as DotPotlet. Instead of extending Portlet in this way, or tying the serialization to the underlying object we can make use of the immutables framework to create a serializable specific version of Portlet that can easily be mapped to and from the underlying Portlet. This model can be used in many cases providing an abstraction layer that is more flexible to changes and easier to test. ### Testing * Portlets need to be able to load and should test the Plugins page loads and check the logs for error * Add plugins including the cdn plugin and ensure it starts up correctly. * Add the CDN Plugin to the menus and browse to the plugin page. It will show loading spinners and show an error in the log as it is not configured but the page headings should show and there should not be other errors. * On stop of the plugin there may be an error. This is expected when the jersey servlet container is restarted. The plugin should be able to be started again after. ```[18/07/24 17:48:21:869 GMT] WARN mapper.RuntimeExceptionMapper: ServiceLocatorImpl(__HK2_Generated_46,47,1198896597) has been shut down java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_46,47,1198896597) has been shut down``` related to #29276
- Loading branch information
Showing
24 changed files
with
1,436 additions
and
909 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
dotCMS/src/main/java/com/dotcms/annotations/AllowNulls.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.dotcms.annotations; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* This annotation is used in Immutables to allow null values in the generated classes collections | ||
* See <a href="https://immutables.github.io/immutable.html#nulls-in-collection">https://immutables.github.io/immutable.html#nulls-in-collection</a> | ||
*/ | ||
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface AllowNulls { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.dotcms.annotations; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* This annotation is used in Immutables to allow null values in the generated classes collections | ||
* See <a href="https://immutables.github.io/immutable.html#nulls-in-collection">https://immutables.github.io/immutable.html#nulls-in-collection</a> | ||
*/ | ||
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface Nullable { | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
dotCMS/src/main/java/com/dotcms/annotations/SkipNulls.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.dotcms.annotations; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
/** | ||
* This annotation is used in Immutables to skip null values in the generated classes collections | ||
* See <a href="https://immutables.github.io/immutable.html#nulls-in-collection">https://immutables.github.io/immutable.html#nulls-in-collection</a> | ||
*/ | ||
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface SkipNulls { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.