private ComponentInst getComponent(SpaceInst space, String componentId) {
   List<ComponentInst> components = space.getAllComponentsInst();
   for (ComponentInst component : components) {
     if ((component.getName() + component.getId()).equalsIgnoreCase(componentId)) {
       return component;
     }
   }
   return null;
 }
  public String addComponent(String userId, String componentName, String componentLabel)
      throws AdminException {
    ComponentInst component = new ComponentInst();
    component.setCreatorUserId(userId);
    component.setInheritanceBlocked(false);
    component.setLabel(componentLabel);
    component.setName(componentName);

    WAComponent baseComponent = Instanciateur.getWAComponent(componentName);
    List<Parameter> parameters = baseComponent.getParameters();

    // set specific parameter values for personal space context
    for (Parameter parameter : parameters) {
      if (StringUtil.isDefined(parameter.getPersonalSpaceValue())) {
        parameter.setValue(parameter.getPersonalSpaceValue());
      }
    }
    component.setParameters(parameters);

    SpaceInst space = getPersonalSpace(userId);

    if (space == null) {
      // if user has no personal space, creates one
      space = new SpaceInst();
      space.setCreatorUserId(userId);
      // space.setDomainFatherId("0");
      space.setInheritanceBlocked(true);
      space.setLevel(0);
      space.setName("Personal space of user #" + userId);
      space.setPersonalSpace(true);

      // user is admin on space to be admin on each components
      SpaceProfileInst profile = new SpaceProfileInst();
      profile.setName("admin");
      profile.addUser(userId);
      profile.setInherited(false);
      space.getAllSpaceProfilesInst().add(profile);

      // add component to space
      space.addComponentInst(component);
      getAdminService().addSpaceInst(userId, space);

    } else {
      // if user has his personal space, just add component in it
      component.setDomainFatherId(space.getId());
      getAdminService().addComponentInst(userId, component);
    }
    return componentName + component.getId();
  }