Package fr.norsys.mapper.console.model

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


    request.getSession().setAttribute(ConsoleCst.CURRENT_APPLICATION,
        currentAppli);
    request.getSession().setAttribute(ConsoleCst.CURRENT_RESOURCE,
        new Resource());
    request.getSession().setAttribute(ConsoleCst.CURRENT_ATTRIBUTE,
        new Attribute());

    refreshMenu(request);
    applicationForm.set(ConsoleCst.APPLICATION_REQUEST_BEAN, currentAppli);
    return mapping.findForward(ConsoleCst.GENERAL_PAGE_FORWARD);
  }
View Full Code Here


   * Action to save an attribute in session
   *
   * @param attribute
   */
  public void save(Attribute attr) throws Exception {
    Attribute attribute = attr;
    Resource currentResource = (Resource) ExecutionContext.get()
        .getSession().getAttribute(ConsoleCst.CURRENT_RESOURCE);
    attributeService.save(attribute, currentResource);
    ExecutionContext.get().getSession().setAttribute(
        ConsoleCst.IS_APPLICATION_MODIFIED,
View Full Code Here

    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
View Full Code Here

    if(r.getBaseDn() != null && !"".equals(r.getBaseDn().trim())) {
      Set s = ldapTreeBuilder.getMandatoryAttributes(r.getBaseDn());
      if(s!=null) {
        for(Iterator it=s.iterator();it.hasNext();) {
          String name = (String)it.next();
          Attribute attr = getAttribute(name,r.getAttributes());
          if(attr != null) {
            if("objectClass".equals(name))
              attr.setDefaultValue(objectClass);
          } else {
            Attribute a = new Attribute(name,name,ConsoleCst.INPUT_OUTPUT_ATTRIBUTE_TYPE);
            r.addAttribute(a);
            if("objectClass".equals(name))
              a.setDefaultValue(objectClass);
          }
        }
      }
    }
  }
View Full Code Here

        }
      }
    }
  }
  private Attribute getAttribute(String name,Collection attributesthrows Exception {
    Attribute ret = null;
    for(Iterator it2=attributes.iterator();it2.hasNext();) {
      Attribute a = (Attribute) it2.next();
      if(name.equals(a.getAttributeLDAP())) {
        ret = a;
      }
    }
    return ret;
  }
View Full Code Here

  public void test01Get(){
    if(log.isDebugEnabled()) log.debug("*** test01Get ***");
    List applications = new ArrayList();
    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

    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);
View Full Code Here

  public void test01Modify() throws Exception {
    if(log.isDebugEnabled()) log.debug("*** test01Modify ***");
    List applications = new ArrayList();
    Collection resources =new  TreeSet(new ResourceNameComparator());
    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));
    assertEquals("name must be equals to attribute","attribute",attr.getName());
    assertEquals("InpuOutput must be equals to 1","1",attr.getInputOutput());
    assertEquals("attribute must be equals to attribute","attribute",attributeService.get(currentAttribute, resource).getName());
    assertEquals("InpuOutput must be equals to 1","1",attributeService.get(currentAttribute, resource).getInputOutput());
  }
View Full Code Here

      fr.norsys.mapper.console.mapping.Attribute a = (fr.norsys.mapper.console.mapping.Attribute) it
          .next();
      if(LOG.isDebugEnabled()) {
        LOG.debug("Entry attribute mapped: " + a.getKey());
      }
      Attribute attribute = new Attribute(a.getKey());
      attribute.setAttributeLDAP(a.getVal());
      attribute.setDefaultValue(a.getVal());
      attribute.setInputOutput(ConsoleCst.INPUT_ATTRIBUTE_TYPE);
      for (Iterator it2 = regexps.iterator(); it2.hasNext();) {
        RegExp re = (RegExp) it2.next();
        if (a.getKey().equals(re.getKey())) {
          attribute.setRule(re.getValue());
          attribute.setIgnoreNull(re.getIgnoreNull());
        }
      }
      r.addAttribute(attribute);
    }
  }
View Full Code Here

      r.addAttribute(attribute);
    }
  }

  private Attribute hasSymetric(Resource r, String key, String val) {
    Attribute result = null;
    for (Iterator it = r.getAttributes().iterator(); it
        .hasNext();) {
      Attribute attr = (Attribute) it.next();
      if ( val.equals(attr.getName())
          && ConsoleCst.INPUT_ATTRIBUTE_TYPE.equals(attr
              .getInputOutput())){
        {result = attr;}
        result.setAttributeLDAP(key);       
      }
    }
View Full Code Here

TOP

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

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.