Package fr.norsys.mapper.console.model

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


      fr.norsys.mapper.console.mapping.Attribute a = (fr.norsys.mapper.console.mapping.Attribute) it
          .next();
      if(LOG.isDebugEnabled()) {
        LOG.debug("Out attribute mapped: " + a.getKey());
      }
      Attribute symetric = hasSymetric(r, a.getKey(), a.getVal());
      if (symetric == null){
        Attribute attribute = new Attribute(a.getVal());
        attribute.setAttributeLDAP(a.getKey());
        attribute.setInputOutput(ConsoleCst.OUTPUT_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);
      } else {
        symetric.setInputOutput(ConsoleCst.INPUT_OUTPUT_ATTRIBUTE_TYPE)
View Full Code Here


          Set s = ldapTreeBuilder.getMandatoryAttributes(currentRes
              .getBaseDn());
          if (s == null) {
            for (Iterator it2 = currentRes.getAttributes()
                .iterator(); it2.hasNext();) {
              Attribute a = (Attribute) it2.next();
              a.setMandatory(ConsoleCst.UNKNOWN_STATUS);
            }
          } else {
            if(ConsoleCst.ADD_MAPPER_TYPE.equals(currentRes.getType())) {
              for (Iterator it2 = currentRes.getAttributes()
                  .iterator(); it2.hasNext();) {
                Attribute a = (Attribute) it2.next();
                a
                    .setMandatory(s.contains(a
                        .getAttributeLDAP()) ? ConsoleCst.MANDATORY_STATUS
                        : ConsoleCst.NOT_MANDATORY_STATUS);
              }
            } else {
              for (Iterator it2 = currentRes.getAttributes()
                  .iterator(); it2.hasNext();) {
                Attribute a = (Attribute) it2.next();
                a
                    .setMandatory(ConsoleCst.NOT_MANDATORY_STATUS);
              }
            }
          }
        } else {
          for (Iterator it2 = currentRes.getAttributes().iterator(); it2
              .hasNext();) {
            Attribute a = (Attribute) it2.next();
            a.setMandatory(ConsoleCst.UNKNOWN_STATUS);
          }
        }
      }
    } catch (Exception e) {
      throw new JspException(e.getMessage());
View Full Code Here

   * @param currentResource : resource bean
   */
  public void deleteAttr(String currentAttrId, Resource currentResource) {
    Collection tempAttributes = new TreeSet(new AttributeNameComparator());
    for(Iterator attributes=currentResource.getAttributes().iterator(); attributes.hasNext();){
      Attribute attr =(Attribute)attributes.next();
      if(!attr.getId().equals(currentAttrId)){
        tempAttributes.add(attr);
      }
    }
    currentResource.setAttributes(tempAttributes)
  }
View Full Code Here

        .getAttribute(ConsoleCst.CURRENT_RESOURCE);
    String currentAttrId = (String) request
        .getParameter(ConsoleCst.CURRENT_ATTRIBUTE_ID);

    DynaActionForm attributeForm = (DynaActionForm) form;
    Attribute currentAttribute = new Attribute();
    if (currentAttrId != null && !"".equals(currentAttrId)) {

      currentAttribute = attributeService.get(currentAttrId,
          currentResource);
      if (log.isDebugEnabled()) {
View Full Code Here

        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()));
        }
        String type = a.getInputOutput();
        if (ConsoleCst.INPUT_ATTRIBUTE_TYPE.equals(type)) {
          inputMap.getAttributes().add(
              new fr.norsys.mapper.console.mapping.Attribute(a
                  .getName(), a.getDefaultValue()));
        } else if (ConsoleCst.OUTPUT_ATTRIBUTE_TYPE.equals(type)) {
          outputMap.getAttributes().add(
              new fr.norsys.mapper.console.mapping.Attribute(a
                  .getAttributeLDAP(), a.getName()));
        } else if (ConsoleCst.INPUT_OUTPUT_ATTRIBUTE_TYPE.equals(type)) {
          inputMap.getAttributes().add(
              new fr.norsys.mapper.console.mapping.Attribute(a
                  .getName(), a.getDefaultValue()));
          outputMap.getAttributes().add(
              new fr.norsys.mapper.console.mapping.Attribute(a
                  .getAttributeLDAP(), a.getName()));
        }
      }
      mapperConfig.getJndiMapper().getMaps().add(inputMap);
      mapperConfig.getJndiMapper().getMaps().add(outputMap);
    }
View Full Code Here

    resources.add(resource);
   
    Resource resource2 = new Resource("test2");
    String currentResource2 = resource2.getId();
    Collection attributes =new  TreeSet(new AttributeNameComparator());
    Attribute attribute = new Attribute("test");
    attributes.add(attribute);
    resource2.setAttributes(attributes);
    resources.add(resource2);
    Application application = new Application("test");
    application.setResources(resources);
View Full Code Here

  public void test01deleteAttr() throws Exception {
    if(log.isDebugEnabled()) log.debug("*** test01deleteAttr ***");
    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);
View Full Code Here

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

   * @param currentAttribute
   * @param resource
   * @return
   */
  public Attribute get(String currentAttrId, Resource resource){
    Attribute attribute=null;
    Collection attributes = resource.getAttributes();
    for(Iterator it=attributes.iterator();it.hasNext();){
     
      Attribute a = (Attribute)it.next();
      if(a.getId().equals(currentAttrId)){
        attribute=a;
      }
    }
   
    return attribute;
View Full Code Here

   * @param resource :
   *            bean of the resource
   * @throws Exception
   */
  private void add(Attribute attribute, Resource resource) throws AttributeException {
    Attribute a = null;
    try {
      a = (Attribute) BeanUtils.cloneBean(attribute);
    } catch (Exception e) {
      throw new AttributeException (e.toString());
    }
    a.setId(UIDGenerator.generateId());
    resource.getAttributes().add(a);
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.CURRENT_ATTRIBUTE,a);
  }
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.