Package fr.norsys.mapper.console.model

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


        .getAppliDirPath()
        + currentAppli.getName() + ".xml");
    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);
View Full Code Here


      log.debug("deleteAttr method called");
    }
    Application currentAppli = (Application) request.getSession()
        .getAttribute(ConsoleCst.CURRENT_APPLICATION);

    Resource currentResource = (Resource) request.getSession()
        .getAttribute(ConsoleCst.CURRENT_RESOURCE);
    String currentAttId = request
        .getParameter(ConsoleCst.CURRENT_ATTRIBUTE_ID);
    DynaActionForm applicationForm = (DynaActionForm) form;
View Full Code Here

    }
    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) {
      currentResource = (Resource) request.getSession().getAttribute(
          ConsoleCst.CURRENT_RESOURCE);
    } else {
      currentResource = resourceService.get(currentResourceId,
View Full Code Here

   *
   * @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,
        ConsoleCst.APPLICATION_MODIFIED);
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());
      }
    }
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

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

  }
 
  public void test01Add() throws Exception {
    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

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

public int doStartTag() throws JspException {
    try {
      Application currentAppli = (Application) pageContext.getSession()
          .getAttribute(ConsoleCst.CURRENT_APPLICATION);
      Resource currentRes = (Resource) pageContext.getSession()
          .getAttribute(ConsoleCst.CURRENT_RESOURCE);
      if (currentAppli != null && currentRes != null) {
        if (currentRes.getBaseDn() != null) {
          ApplicationContext ctx = WebApplicationContextUtils
              .getWebApplicationContext(pageContext
                  .getServletContext());
          LdapTreeBuilder ldapTreeBuilder = (LdapTreeBuilder) ctx
              .getBean("ldapTreeBuilder");
          ldapTreeBuilder.setConnection(currentAppli.getConnection());
          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);
          }
        }
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.