public List<TaggableActivity> getActivities(String context, TaggingProvider provider) {
   // We aren't picky about the provider, so ignore that argument.
   List<TaggableActivity> activities = new ArrayList<TaggableActivity>();
   for (WizardPageDefinition def : wizardManager.findWizardPageDefs(context, true)) {
     activities.add(getActivity(def));
   }
   return activities;
 }
 private boolean canEvaluate(WizardPage page) {
   boolean allowed = false;
   CompletedWizard cw = wizardManager.getCompletedWizardByPage(page.getId());
   allowed =
       authzManager.isAuthorized(
           (cw != null)
               ? WizardFunctionConstants.EVALUATE_SPECIFIC_WIZARDPAGE
               : MatrixFunctionConstants.EVALUATE_SPECIFIC_MATRIXCELL,
           page.getId());
   return allowed;
 }
 public TaggableActivity getActivity(String activityRef, TaggingProvider provider) {
   // We aren't picky about the provider, so ignore that argument.
   TaggableActivity activity = null;
   if (checkReference(activityRef)) {
     WizardReference reference = WizardReference.getReference(activityRef);
     if (reference != null) {
       WizardPageDefinition def =
           wizardManager.getWizardPageDefinition(idManager.getId(reference.getId()), true);
       activity = getActivity(def);
     }
   }
   return activity;
 }
 public String getContext(String ref) {
   String context = null;
   WizardReference reference = WizardReference.getReference(ref);
   if (reference != null) {
     if (WizardReference.REF_DEF.equals(reference.getType())) {
       context =
           wizardManager.getWizardPageDefinition(idManager.getId(reference.getId())).getSiteId();
     } else {
       context =
           matrixManager
               .getWizardPage(idManager.getId(reference.getId()))
               .getPageDefinition()
               .getSiteId();
     }
   }
   return context;
 }
 public boolean allowRemoveTags(TaggableActivity activity) {
   WizardPageDefinition pageDef = (WizardPageDefinition) activity.getObject();
   // Try to get a wizard page sequence
   WizardPageSequence ps = wizardManager.getWizardPageSeqByDef(pageDef.getId());
   boolean authorized = false;
   if (ps != null) {
     Wizard wizard = ps.getCategory().getWizard();
     /*
      * If you own the wizard, or if you can delete wizards, or if you
      * can revise wizards, then you are able to delete page definitions
      * and can, therefore, remove tags.
      */
     authorized =
         sessionManager
                 .getCurrentSessionUserId()
                 .equalsIgnoreCase(wizard.getOwner().getId().getValue())
             || authzManager.isAuthorized(WizardFunctionConstants.EDIT_WIZARD, wizard.getId())
             || authzManager.isAuthorized(WizardFunctionConstants.DELETE_WIZARD, wizard.getId());
   } else {
     ScaffoldingCell cell = matrixManager.getScaffoldingCellByWizardPageDef(pageDef.getId());
     /*
      * If you can create or delete scaffolding, then you are able to
      * delete scaffolding cells and can, therefore, remove tags.
      */
     authorized =
         authzManager.isAuthorized(
                 MatrixFunctionConstants.CREATE_SCAFFOLDING, cell.getScaffolding().getId())
             || authzManager.isAuthorized(
                 MatrixFunctionConstants.DELETE_SCAFFOLDING_ANY, cell.getScaffolding().getId())
             || (authzManager.isAuthorized(
                     MatrixFunctionConstants.DELETE_SCAFFOLDING_OWN, cell.getScaffolding().getId())
                 && cell.getScaffolding()
                     .getOwner()
                     .getId()
                     .equals(getAuthnManager().getAgent().getId()));
   }
   return authorized;
 }