Package fr.norsys.mapper.console.model

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


      Modify m1 = (Modify) it.next();
      if(LOG.isDebugEnabled()) {
        LOG.debug("Modify mapper mapped: " + m1.getName());
      }
      regexps.addAll(m1.getRegexps());
      Resource r = new Resource(m1.getName(), getBaseDn(m1.getRoot()), getIdentifiant(m1.getRoot()),
          ConsoleCst.MODIFY_MAPPER_TYPE, null, null);
      Vector inputAttr = new Vector();
      Vector outputAttr = new Vector();
      for (Iterator it2 = maps.iterator(); it2.hasNext();) {
        Map m = (Map) it2.next();
View Full Code Here


        "fr.norsys.mapper.jndi.JNDIXMLConfigurator");

    Mapper mapper = null;
    for (Iterator it = application.getResources().iterator(); it
        .hasNext();) {
      Resource r = (Resource) (it.next());
      String name = r.getName();
      StringBuffer root = new StringBuffer();
      Map inputMap = new Map("input-" + name);
      Map outputMap = new Map("output-" + name);
      if(r.getIdentifiant()!=null && r.getIdentifiant().length()>0){
        root.append(r.getIdentifiant()).append(",");
      }
      root.append(r.getBaseDn());
      if (ConsoleCst.SEARCH_MAPPER_TYPE.equals(r.getType())) {
        mapper = new Search(name, "input-" + name, "output-" + name, r
            .getFilter(), root.toString(), r.getScope(),
            "true", "true", r.getCountLimit());
        mapperConfig.getJndiMapper().getSource().getSearchList().add(mapper);
      } else if (ConsoleCst.ADD_MAPPER_TYPE.equals(r.getType())) {
        mapper = new Add(name, "input-" + name, "output-" + name, root.toString());
        mapperConfig.getJndiMapper().getSource().getAddList().add(mapper);
      } else if (ConsoleCst.DELETE_MAPPER_TYPE.equals(r.getType())) {
        mapper = new Delete(name, "input-" + name, "output-" + name, root.toString());
        mapperConfig.getJndiMapper().getSource().getDeleteList().add(mapper);
      } else if (ConsoleCst.MODIFY_MAPPER_TYPE.equals(r.getType())) {
        mapper = new Modify(name, "input-" + name, "output-" + name, root.toString());
        mapperConfig.getJndiMapper().getSource().getModifyList().add(mapper);
      }
      for (Iterator it2 = r.getAttributes().iterator(); it2
          .hasNext();) {
        Attribute a = (Attribute)it2.next();
        if(a.getRule() != null && !"".equals(a.getRule())) {
          mapper.getRegexps().add(new RegExp(a.getName(),a.getRule(),a.getIgnoreNull()));
        }
View Full Code Here

    connection = new Connection("test");
    connection.setUrl("ldap://130.81.9.192:389");
    connection.setUser("cn=admin,ou=users,o=services");
    connection.setPass("12345678");
   
    resource = new Resource("toto");
    resource.setBaseDn("ou=Personnes,o=canam");
    resource.setFilter("(objectclass=canamobjperson)");
  }
View Full Code Here

  public void testDeleteRes() throws Exception {
    ResourceServiceImpl resourceService = new ResourceServiceImpl();
    List applications = new ArrayList();
    Collection resources = new TreeSet(new ResourceNameComparator());
    Collection resources2 = new TreeSet(new ResourceNameComparator());
    Resource resource = new Resource("test");
    String currentResource = resource.getId();
    resources.add(resource);
    Resource resource2 = new Resource("test2");
    String currentResource2 = resource2.getId();
    resources.add(resource2);
    Application application = new Application("test");
    application.setResources(resources);
    Resource resource3 = new Resource("test3");
    String currentResource3 = resource.getId();
    resources2.add(resource3);
    Resource resource4 = new Resource("test4");
    String currentResource4 = resource2.getId();
    resources2.add( resource4);
    Application application2 = new Application("test2");
    application2.setResources(resources2);
    applications.add(application);
View Full Code Here

    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");
    String currentResource = resource.getId();
    Application application = new Application("test");
    attributes.add(attribute);
    resource.setAttributes(attributes);
    resources.add(resource);
    application.setResources(resources);
    applications.add(application);
    if(log.isDebugEnabled()) log.debug("applications :"+applications);
    if(log.isDebugEnabled()) log.debug("application :"+application);
   
    Application appli = applicationService.get(application.getId(),applications);
    Resource res = resourceService.get(currentResource, appli);
    resourceService.deleteAttr(currentAttribute,res);
    if(log.isDebugEnabled()) log.debug("application :"+application);
   
    assertNull("must be null object",attributeService.get(currentAttribute,resource));
    assertNull("must be null object",attributeService.get(currentAttribute,resourceService.get(currentResource,application)));

    Resource r= resourceService.get(currentResource,applicationService.get(application.getId(),applications));
    assertNull("must be null object",attributeService.get(currentAttribute,r));
    if(log.isDebugEnabled()) log.debug("applications :"+applications);
    if(log.isDebugEnabled()) log.debug("application :"+applicationService.get(application.getId(),applications));

  }
View Full Code Here

    Application appl = application;
    Application a = appl;
    String currentResourceId = cur;
    Collection tempResources = new TreeSet(new ResourceNameComparator());
    for(Iterator resources = a.getResources().iterator(); resources.hasNext();){
      Resource r =(Resource)resources.next();
      if(!r.getId().equals(currentResourceId)){
        tempResources.add(r);
      }
    }
    a.setResources(tempResources);
    fr.norsys.mapper.console.utils.BeanUtils.copyFilledProperties(
View Full Code Here

      a++;
    }
    Arrays.sort(sortedNames);
    for(int i=0;i<sortedNames.length;i++){
      for(Iterator it=values.iterator();it.hasNext();){
        Resource r=(Resource)it.next();
        if(r.getName().equals(sortedNames[i])){
          sortedList.add(r);
        }
      }
    }
   
View Full Code Here

 
  public void test01ListAttr() {
    if(log.isDebugEnabled()) log.debug("*** test01ListAttr ***");
    List applications = new ArrayList();
    Collection resources =new  TreeSet(new ResourceNameComparator());
    Resource resource = new Resource("test");
    String currentResource = resource.getId();
    resources.add(resource);
    Application application = new Application("test");
    application.setResources(resources);
    applications.add(application);
    Resource r=resourceService.get(currentResource,application);
    String name = r.getName();
    assertTrue("must be same object",name.equals(resource.getName()));
  }
View Full Code Here

 
  public void test02ListAttr() {
    if(log.isDebugEnabled()) log.debug("*** test02ListAttr ***");
    List applications = new ArrayList();
    Collection resources =new  TreeSet(new ResourceNameComparator());
    Resource resource = new Resource("test");
    String currentResource = resource.getId();
    resources.add(resource);
    Resource resource2 = new Resource("test2");
    String currentResource2 = resource2.getId();
    resources.add(resource2);
    Application application = new Application("test");
    application.setResources(resources);
    applications.add(application);
    Resource r=resourceService.get(currentResource,application);
    String name = r.getName();
    assertTrue("must be same object",name.equals(resource.getName()));
    assertEquals("name must be equals to test","test",r.getName());
    r=resourceService.get(currentResource2,application);
    name = r.getName();
    assertTrue("must be same object",name.equals(resource2.getName()));
    assertEquals("name must be equals to test2","test2",r.getName());

   
  }
View Full Code Here

  public void test01Get(){
    if(log.isDebugEnabled()) log.debug("*** test01Get ***");
    List applications = new ArrayList();
    Collection resources =new  TreeSet(new ResourceNameComparator());
    Collection resources2 =new  TreeSet(new ResourceNameComparator());
    Resource resource = new Resource("test");
    String currentResource = resource.getId();
    resources.add(resource);
    Resource resource2 = new Resource("test2");
    String currentResource2 = resource2.getId();
    resources.add(resource2);
    Application application = new Application("test");
    application.setResources(resources);
    Resource resource3 = new Resource("test3");
    String currentResource3 = resource.getId();
    resources2.add(resource3);
    Resource resource4 = new Resource("test4");
    String currentResource4 = resource2.getId();
    resources2.add(resource4);
    Application application2 = new Application("test2");
    application2.setResources(resources2);
    applications.add(application);
    applications.add(application2);
    Resource r=resourceService.get(currentResource2,application);
    assertTrue("must be same object",r.equals(resource2));
    assertEquals("name must be equals to test2","test2",r.getName());

  }
View Full Code Here

TOP

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

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.