Package models

Examples of models.CommentThread


public class CommentThreadApp extends Controller {

    @Transactional
    public static Result updateState(Long id, CommentThread.ThreadState state) {
        CommentThread thread = CommentThread.find.byId(id);

        if (thread == null) {
            return notFound();
        }

        Operation operation;

        switch(state) {
            case OPEN:
                operation = Operation.REOPEN;
                break;
            case CLOSED:
                operation = Operation.CLOSE;
                break;
            default:
                throw new UnsupportedOperationException();
        }

        if (!AccessControl.isAllowed(UserApp.currentUser(), thread.asResource(), operation)) {
            return forbidden();
        }

        CommentThread.ThreadState previousState = thread.state;
        thread.state = state;
        thread.update();

        try {
            NotificationEvent.afterStateChanged(previousState, thread);
        } catch (Exception e) {
            play.Logger.warn(
View Full Code Here

TOP

Related Classes of models.CommentThread

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.