-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: JohnNiang <[email protected]>
- Loading branch information
Showing
14 changed files
with
107 additions
and
121 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
api/src/main/java/run/halo/app/event/post/PostDeletedEvent.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,22 @@ | ||
package run.halo.app.event.post; | ||
|
||
import run.halo.app.core.extension.content.Post; | ||
|
||
public class PostDeletedEvent extends PostEvent { | ||
|
||
private final Post post; | ||
|
||
public PostDeletedEvent(Object source, Post post) { | ||
super(source, post.getMetadata().getName()); | ||
this.post = post; | ||
} | ||
|
||
/** | ||
* Get original post. | ||
* | ||
* @return original post. | ||
*/ | ||
public Post getPost() { | ||
return post; | ||
} | ||
} |
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,27 @@ | ||
package run.halo.app.event.post; | ||
|
||
import org.springframework.context.ApplicationEvent; | ||
|
||
/** | ||
* An abstract class for post events. | ||
* | ||
* @author johnniang | ||
*/ | ||
public abstract class PostEvent extends ApplicationEvent { | ||
|
||
private final String name; | ||
|
||
public PostEvent(Object source, String name) { | ||
super(source); | ||
this.name = name; | ||
} | ||
|
||
/** | ||
* Gets post metadata name. | ||
* | ||
* @return post metadata name | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
api/src/main/java/run/halo/app/event/post/PostPublishedEvent.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,12 @@ | ||
package run.halo.app.event.post; | ||
|
||
import run.halo.app.plugin.SharedEvent; | ||
|
||
@SharedEvent | ||
public class PostPublishedEvent extends PostEvent { | ||
|
||
public PostPublishedEvent(Object source, String postName) { | ||
super(source, postName); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
api/src/main/java/run/halo/app/event/post/PostUnpublishedEvent.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,9 @@ | ||
package run.halo.app.event.post; | ||
|
||
public class PostUnpublishedEvent extends PostEvent { | ||
|
||
public PostUnpublishedEvent(Object source, String postName) { | ||
super(source, postName); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
api/src/main/java/run/halo/app/event/post/PostUpdatedEvent.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,9 @@ | ||
package run.halo.app.event.post; | ||
|
||
public class PostUpdatedEvent extends PostEvent { | ||
|
||
public PostUpdatedEvent(Object source, String postName) { | ||
super(source, postName); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
api/src/main/java/run/halo/app/event/post/PostVisibleChangedEvent.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,22 @@ | ||
package run.halo.app.event.post; | ||
|
||
import lombok.Getter; | ||
import org.springframework.lang.Nullable; | ||
import run.halo.app.core.extension.content.Post; | ||
|
||
@Getter | ||
public class PostVisibleChangedEvent extends PostEvent { | ||
|
||
@Nullable | ||
private final Post.VisibleEnum oldVisible; | ||
|
||
private final Post.VisibleEnum newVisible; | ||
|
||
public PostVisibleChangedEvent(Object source, String postName, | ||
Post.VisibleEnum oldVisible, Post.VisibleEnum newVisible) { | ||
super(source, postName); | ||
this.oldVisible = oldVisible; | ||
this.newVisible = newVisible; | ||
} | ||
|
||
} |
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
21 changes: 0 additions & 21 deletions
21
application/src/main/java/run/halo/app/event/post/PostDeletedEvent.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
application/src/main/java/run/halo/app/event/post/PostEvent.java
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
application/src/main/java/run/halo/app/event/post/PostPublishedEvent.java
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
application/src/main/java/run/halo/app/event/post/PostUnpublishedEvent.java
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
application/src/main/java/run/halo/app/event/post/PostUpdatedEvent.java
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
application/src/main/java/run/halo/app/event/post/PostVisibleChangedEvent.java
This file was deleted.
Oops, something went wrong.