Package org.jasig.portal.portlet.om

Examples of org.jasig.portal.portlet.om.PortletLifecycleState


        /*
         * Manage the metadata for each possible lifecycle state in turn...
         */

        Date now = new Date()// Will be entered as the timestamp for states that we trigger
        PortletLifecycleState selectedLifecycleState = form.getLifecycleState();

        /*
         * APPROVED
         */
        if (selectedLifecycleState.isEqualToOrAfter(PortletLifecycleState.APPROVED)) {
            // We are the 'approver' if it isn't previously approved...
            if (portletDef.getApprovalDate() == null) {
                portletDef.setApproverId(publisher.getID());
                portletDef.setApprovalDate(now);
            }
            if (selectedLifecycleState.equals(PortletLifecycleState.APPROVED)
                    && form.getPublishDate() != null
                    // Permissions check required (of course) to use the auto-publish feature
                    && hasLifecyclePermission(publisher, PortletLifecycleState.PUBLISHED, form.getCategories())) {
                // We are also the 'publisher' if we scheduled the portlet for (future) publication...
                portletDef.setPublishDate(form.getPublishDateTime());
                portletDef.setPublisherId(publisher.getID());
            }
        } else {
            // Clear previous approval fields, if present...
            portletDef.setApprovalDate(null);
            portletDef.setApproverId(-1);
        }

        /*
         * PUBLISHED
         */
        if (selectedLifecycleState.isEqualToOrAfter(PortletLifecycleState.PUBLISHED)) {
            // We are the 'publisher' if it isn't previously published...
            if (portletDef.getPublishDate() == null) {
                portletDef.setPublisherId(publisher.getID());
                portletDef.setPublishDate(now);
            }
            if (selectedLifecycleState.equals(PortletLifecycleState.PUBLISHED)
                    && form.getExpirationDate() != null
                    // Permissions check required (of course) to use the auto-expire feature
                    && hasLifecyclePermission(publisher, PortletLifecycleState.EXPIRED, form.getCategories())) {
                // We are also the 'expirer' if we scheduled the portlet for (future) expiration...
                portletDef.setExpirationDate(form.getExpirationDateTime());
                portletDef.setExpirerId(publisher.getID());
            }
        } else {
            // Clear previous publishing fields, if present...
            portletDef.setPublishDate(null);
            portletDef.setPublisherId(-1);
        }

        /*
         * EXPIRED
         */
        if (selectedLifecycleState.equals(PortletLifecycleState.EXPIRED)) {
            // We are only the 'expirer' if we specifically choose EXPIRED
            // (MAINTENANCE mode is not considered expired)
            portletDef.setExpirerId(publisher.getID());
            portletDef.setExpirationDate(now);
        } else {
            // Clear previous expiration fields, if present...
            portletDef.setExpirationDate(null);
            portletDef.setExpirerId(-1);
        }

        /*
         * MAINTENANCE
         */
        if (selectedLifecycleState.equals(PortletLifecycleState.MAINTENANCE)) {
            // We are placing the portlet into MAINTENANCE mode;
            // an admin will restore it (manually) when available
            portletDef.addParameter(PortletLifecycleState.MAINTENANCE_MODE_PARAMETER_NAME, "true");
        } else {
            // Otherwise we must remove the MAINTENANCE flag, if present
View Full Code Here


    if (portlet == null){
      return doesPrincipalHavePermission(principal, owner,
        IPermission.PORTLET_MANAGER_APPROVED_ACTIVITY, target);
//      throw new AuthorizationException("Unable to locate channel " + channelPublishId);
    }   
    PortletLifecycleState state = portlet.getLifecycleState();
    int order = state.getOrder();
   
    /*
     * The following code assumes that later lifecycle states imply permission
     * for earlier lifecycle states.  For example, if a user has permission to
     * manage an expired channel, we assume s/he also has permission to
View Full Code Here

      return false;
    }

    String target = PermissionHelper.permissionTargetIdForPortletDefinition(portlet);

    PortletLifecycleState state = portlet.getLifecycleState();
   
    /*
     * Each channel lifecycle state now has its own subscribe permission.  The
     * following logic checks the appropriate permission for the lifecycle.
     */
    String permission;
    if (state.equals(PortletLifecycleState.PUBLISHED)
            || state.equals(PortletLifecycleState.MAINTENANCE)) {
        // NB:  There is no separate SUBSCRIBE permission for MAINTENANCE
        // mode;  everyone simply sees the 'out of service' message
        permission = IPermission.PORTLET_SUBSCRIBER_ACTIVITY;
    } else if (state.equals(PortletLifecycleState.APPROVED)) {
      permission = IPermission.PORTLET_SUBSCRIBER_APPROVED_ACTIVITY;
    } else if (state.equals(PortletLifecycleState.CREATED)) {
      permission = IPermission.PORTLET_SUBSCRIBER_CREATED_ACTIVITY;
    } else if (state.equals(PortletLifecycleState.EXPIRED)) {
      permission = IPermission.PORTLET_SUBSCRIBER_EXPIRED_ACTIVITY;
    } else {
      throw new AuthorizationException(
          "Unrecognized lifecycle state for channel "
              + portletDefinitionId);
View Full Code Here

TOP

Related Classes of org.jasig.portal.portlet.om.PortletLifecycleState

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.