AnsweredAssumed Answered

A dude for Alfresco_Developer_Guide=?

Question asked by orfhen on Apr 13, 2011
Latest reply on Apr 18, 2011 by orfhen
I am experience with the examples of alfresco, in especial , project someco , in the class websettings bean i see a class that i don't find his package to export with maven , this class is setwebflag … anyone know the package of this class..

I write the example of my class

package com.someco.web.bean;

import java.text.MessageFormat;
import java.util.Map;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction;
import org.alfresco.repo.action.ActionImpl;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.bean.BrowseBean;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;

public class WebSettingsBean
   private static final String PARAM_ID = "id";
   private static final String PARAM_ACTIVE = "active";
   private static final String MSG_SUCCESS_WEB_SET_ACTIVE =
   private static final String PANEL_ID_SPACE_PROPS =
   /** The BrowseBean to be used by the bean */
   protected BrowseBean browseBean;
   public WebSettingsBean()
   * Action handler called when the enable or disable action is
   * @param event
   public void setActive(ActionEvent event)
      UIActionLink link = (UIActionLink)event.getComponent();
      Map params = link.getParameterMap();
      String id = params.get(PARAM_ID).toString();
      String active = params.get(PARAM_ACTIVE).toString();
      boolean activeFlag = Boolean.parseBoolean(active);
      FacesContext fc = FacesContext.getCurrentInstance();
      if (id != null && id.length() != 0)
            NodeRef ref =new NodeRef(Repository.getStoreRef(),id);
            // start the transaction
            UserTransaction tx = null;
               tx = Repository.getUserTransaction(fc);
               ActionImpl action = new ActionImpl(ref, SetWebFlag.NAME, null);
               action.setParameterValue(SetWebFlag.PARAM_ACTIVE, activeFlag);
               SetWebFlag actionExecuter =(SetWebFlag)FacesContextUtils.getWebApplicationContext(fc).getBean(SetWebFlag.NAME);
               actionExecuter.execute(action, ref);
               String msg = Application.getMessage(fc,MSG_SUCCESS_WEB_SET_ACTIVE);
               FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
               String formId = Utils.getParentForm(fc, event.getComponent()).getClientId(fc);
               fc.addMessage(formId + ':' + PANEL_ID_SPACE_PROPS,
               // commit the transaction
            catch (Throwable err)
                     (Application.getMessage(fc, Repository.ERROR_GENERIC)err.getMessage()), err);
                  if (tx != null)
               } catch (Exception tex) {
         catch (InvalidNodeRefException refErr)
            (Application.getMessage(fc, Repository.ERROR_NODEREF)
               ,new Object[] {id}) );
   public void setBrowseBean(BrowseBean browseBean)
      this.browseBean = browseBean;