Package fr.norsys.mapper.console.model

Examples of fr.norsys.mapper.console.model.Application


      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    if (log.isDebugEnabled()) {
      log.debug("listAttr method called");
    }
    Application currentAppli = (Application) request.getSession()
        .getAttribute(ConsoleCst.CURRENT_APPLICATION);
    String currentResourceId = (String) request
        .getParameter(ConsoleCst.CURRENT_RESOURCE_ID);
    Resource currentResource = null;
    if (currentResourceId == null || currentResourceId.length() == 0) {
View Full Code Here


    applicationForm.set(ConsoleCst.APPLICATION_REQUEST_BEAN, currentAppli);
    return mapping.findForward(ConsoleCst.RESOURCES_PAGE_FORWARD);
  }

  private void blankApplicationBean(ActionForm form) {
    ((DynaActionForm) form).set("application", new Application());
  }
View Full Code Here

    return validationHelper.isConnectionValid(connection);
  }

  public String isSearchResourceValid(Resource resourcethrows Exception {
    String result;
    Application curApplication = (Application) ExecutionContext.get()
        .getSession().getAttribute(ConsoleCst.CURRENT_APPLICATION);
    if (!validationHelper.isConnectionValid(curApplication.getConnection())) {
      result = ConsoleCst.CONNECTION_NOT_VALID;
    } else if (validationHelper.isSearchResourceValid(resource,
        curApplication.getConnection())) {
      result = ConsoleCst.RESOURCE_VALID;
    } else {
      result = ConsoleCst.RESOURCE_NOT_VALID;
    }
    return result;
View Full Code Here

   * Save a new variable
   * @param variable
   * @return boolean
   */
  public boolean save(Variable variable) throws Exception {
    Application currentAppli = (Application) ExecutionContext.get().getSession().getAttribute(
        ConsoleCst.CURRENT_APPLICATION);
    boolean res = variableService.save(variable,currentAppli.getVariables());
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.IS_APPLICATION_MODIFIED,ConsoleCst.APPLICATION_MODIFIED);
    return res;
  }
View Full Code Here

  public void setLdapTreeBuilder(LdapTreeBuilder ldapTreeBuilder) {
    this.ldapTreeBuilder = ldapTreeBuilder;
  }

  public List getChildren(String root) {
    Application currentAppli = (Application) ExecutionContext.get().getSession().getAttribute(ConsoleCst.CURRENT_APPLICATION);
    ldapTreeBuilder.setConnection(currentAppli.getConnection());
    return ldapTreeBuilder.getChildren(root);
  }
View Full Code Here

   */
  public ActionForward edit(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse responsethrows Exception {
    if (log.isDebugEnabled())
      {log.debug("edit method called");}
    Application currentApplication = (Application)request.getSession().getAttribute(ConsoleCst.CURRENT_APPLICATION);
    Resource currentResource = (Resource) request.getSession().getAttribute(ConsoleCst.CURRENT_RESOURCE);
    if(currentResource==null){
      currentResource = new Resource();
      request.getSession().setAttribute(ConsoleCst.CURRENT_RESOURCE,currentResource);
    }
    DynaActionForm resourceForm = (DynaActionForm) form;
    String currentResourceId = (String) request.getParameter(ConsoleCst.CURRENT_RESOURCE_ID);
    if (currentResourceId != null && !"".equals(currentResourceId)){
      resourceForm.set(ConsoleCst.RESOURCE_REQUEST_BEAN, currentResource);
      for(Iterator it=currentResource.getAttributes().iterator();it.hasNext();) {
        Attribute a = (Attribute) it.next();
        if("objectClass".equals(a.getAttributeLDAP()))
          request.setAttribute("objectClass",a.getDefaultValue());
      }
    }
   
    // put resources list in session to check the name of the new application to add
    // is not yet in the list
    request.getSession().setAttribute(ConsoleCst.RESOURCES_SESSION_BEAN,
        currentApplication.getResources());
    return mapping.findForward(ConsoleCst.RESOURCE_PAGE_FORWARD);
  }
View Full Code Here

   * Action to save a resource in session
   * @param resource
   */
  public void save(Resource res, String objectClassthrows Exception {
    Resource resource = res;
    Application currentAppli = (Application)ExecutionContext.get().getSession().getAttribute(ConsoleCst.CURRENT_APPLICATION);
    resourceService.save(resource, currentAppli);
    Resource currentResource = (Resource) ExecutionContext.get().getSession().getAttribute(ConsoleCst.CURRENT_RESOURCE);
    if(currentResource != null && ConsoleCst.ADD_MAPPER_TYPE.equals(currentResource.getType())) {
      addMandatoryAttributes(currentResource,currentAppli.getConnection(),objectClass);
    }
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.IS_APPLICATION_MODIFIED,ConsoleCst.APPLICATION_MODIFIED);
  }
View Full Code Here

    Collection resources =new  TreeSet(new ResourceNameComparator());
    Collection attributes = new TreeSet(new AttributeNameComparator());
    Attribute attribute = new Attribute("test");
    String currentAttribute = attribute.getId();
    Resource resource = new Resource("test");
    Application application = new Application("test");
    attributes.add(attribute);
    resource.setAttributes(attributes);
    resources.add(resource);
    application.setResources(resources);
    applications.add(application);
   
    Attribute a=attributeService.get(currentAttribute,resource);
    assertTrue("must be same object",a.equals(attribute));
    assertEquals("name must be equals to test","test",a.getName());
View Full Code Here

    if(log.isDebugEnabled()) log.debug("*** test01Add ***");
    List applications = new ArrayList();
    Resource resource = new Resource("test");
    Collection resources = new TreeSet(new ResourceNameComparator());
    resources.add(resource);
    Application application = new Application("test");
    application.setResources(resources);
    applications.add(application);

    Attribute attribute = new Attribute();
    attribute.setName("attribute");
    Application a = applicationService.get(application.getId(), applications);
    Resource r = resourceService.get(resource.getId(),a);
    attributeService.save(attribute,r);
   
    assertTrue("size must be superior to 0",r.getAttributes().size() > 0);
    assertEquals("name must be equals to attribute","attribute",((Attribute)r.getAttributes().iterator().next()).getName());
View Full Code Here

    Collection attributes = new TreeSet(new AttributeNameComparator());
    Attribute attribute = new Attribute("attribute");
    String currentAttribute = attribute.getId();
    Resource resource = new Resource("test");
    String currentResource = resource.getId();
    Application application = new Application("test");
    attributes.add(attribute);
    resource.setAttributes(attributes);
    resources.add(resource);
    application.setResources(resources);
    applications.add(application);
   
    attribute.setInputOutput("1");
    Application a = applicationService.get(application.getId(), applications);
    Resource r = resourceService.get(resource.getId(),a);
    attributeService.save(attribute,r);
     
    Attribute attr=attributeService.get(currentAttribute,r);
    assertTrue("must be same object",attr.equals(attribute));
View Full Code Here

TOP

Related Classes of fr.norsys.mapper.console.model.Application

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.