Package fr.norsys.mapper.console.model

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


    mc.setName("Exemple");
    mc.setTitle("Exemple");
    mc.setLocation("#");
    oldRepository.addMenu(mc);
    applications = new ArrayList();
    Application application = new Application("Appli1");
    applications.add(application);
    connections = new ArrayList();
    Connection connection = new Connection("Conx1");
    connections.add(connection);
  }
View Full Code Here


      throws Exception {
    UploadForm uploadForm = (UploadForm) form;
    FormFile file = uploadForm.getFile();
    InputStream stream = file.getInputStream();
    String applicationId = (String) request.getSession().getAttribute(ConsoleCst.APPLICATION_ID);
    Application application = applicationService.get(applicationId,(Collection)request.getSession().getAttribute(ConsoleCst.APPLICATIONS_SESSION_BEAN));
    mappingService.importApplicationConfig(application,stream);
    stream.close();
    file.destroy();
    request.setAttribute("retUpload","true");
    request.getSession().setAttribute(ConsoleCst.IS_APPLICATION_MODIFIED,ConsoleCst.APPLICATION_MODIFIED);
View Full Code Here

      throws Exception {
    if (log.isDebugEnabled()) {
      log.debug("list method called");
    }
    DynaActionForm variableForm = (DynaActionForm) form;
    Application currentAppl = (Application) request.getSession()
        .getAttribute(ConsoleCst.CURRENT_APPLICATION);
    variableForm.set(ConsoleCst.APPLICATION_REQUEST_BEAN, currentAppl);
    refreshMenu(request);
    return mapping.findForward("index");
  }
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    if (log.isDebugEnabled()) {
      log.debug("delete method called");
    }
    Application currentAppl = (Application) request.getSession()
        .getAttribute(ConsoleCst.CURRENT_APPLICATION);
    String id = request.getParameter("varId");
    variableService.delete(id, currentAppl.getVariables());
    request.getSession().setAttribute(ConsoleCst.IS_APPLICATION_MODIFIED,
        ConsoleCst.APPLICATION_MODIFIED);
    return list(mapping, form, request, response);
  }
View Full Code Here

      log.debug("edit method called");
    }
    String id = request.getParameter("id");
    DynaActionForm variableForm = (DynaActionForm) form;
    if (id != null && !"".equals(id)) {
      Application currentAppl = (Application) request.getSession()
          .getAttribute(ConsoleCst.CURRENT_APPLICATION);
      Variable variable = variableService.get(id, currentAppl
          .getVariables());
      variableForm.set(ConsoleCst.VARIABLE_REQUEST_BEAN, variable);
    }
    request.getSession().setAttribute(ConsoleCst.IS_APPLICATION_MODIFIED,
        ConsoleCst.APPLICATION_MODIFIED);
View Full Code Here

public class MandatoryAttributesTag extends BodyTagSupport {
  private static final long serialVersionUID = 1550050540337404252L;

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

  }
  public void setMappingService(MappingService mappingService) {
    this.mappingService = mappingService;
  }
  public boolean saveApplicationConfig(String idthrows Exception {
    Application application = null;
      application = applicationService.get(id,(Collection)ExecutionContext.get().getSession().getAttribute(ConsoleCst.APPLICATIONS_SESSION_BEAN));
    try {
      mappingService.saveMapping(application,applicationService.getAppliDirPath()+application.getName()+".xml");
    } catch(MappingException e) {
      log.error("error occured when saving application into a file:"+e);
      return false;
    }
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.IS_APPLICATION_MODIFIED,ConsoleCst.APPLICATION_NOT_MODIFIED);
View Full Code Here

    return true;
  }

 
  public String saveApplicationConfigAndLoad(String id, String hrefthrows Exception {
    Application application = null;
      application = applicationService.get(id,(Collection)ExecutionContext.get().getSession().getAttribute(ConsoleCst.APPLICATIONS_SESSION_BEAN));
    try {
      mappingService.saveMapping(application,applicationService.getAppliDirPath()+application.getName()+".xml");
    } catch(MappingException e) {
      log.error("error occured when saving application into a file:"+e);
      return null;
    }
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.IS_APPLICATION_MODIFIED,ConsoleCst.APPLICATION_NOT_MODIFIED);
View Full Code Here

    assertTrue(l.size() > 0);
  }
 
  public void test01AddModifyGetAndDelete() throws Exception {
    List applications = new ArrayList();
    Application application = new Application();
    application.setName("test5");
    applicationService.save(application,applications);
    assertTrue("size must be superior to 0",applications.size() > 0);
    File f = new File(XML_PATH+"test5.xml");
    assertTrue(f.exists());
   
    String id = "";
    for(Iterator it=applications.iterator();it.hasNext();) {
      Application a = (Application) it.next();
      if("test5".equals(a.getName()))
        id=a.getId();
    }
   
    Application application2 = new Application("test6");
    application2.setId(id);
    applicationService.save(application2,applications);
    for(Iterator it=applications.iterator();it.hasNext();) {
      Application a = (Application) it.next();
      if(id.equals(a.getId())) {
        assertEquals("name must be equals to test6","test6",a.getName());
        break;
      }
    }
   
    assertNotNull(applicationService.get(id,applications));
   
    Application application3 = new Application("test6");
    application3.setId(id);
    applicationService.delete(id,applications);

    for(Iterator it=applications.iterator();it.hasNext();) {
      Application a = (Application) it.next();
      if(id.equals(a.getId())) {
        fail();
      }
    }
    f = new File(XML_PATH+"test6.xml");
    assertFalse(f.exists());
View Full Code Here

    assertFalse(f.exists());
  }
 
  public void testModifyCon() throws Exception {
    String connectionName = "connection";
    Application application = new Application("appli");
    applicationService.modifyConnection(application,connectionName);
    assertNotNull(application.getConnection());
    assertNotNull(application.getConnection().getUrl());
    if(log.isDebugEnabled())
      log.debug(application.getConnection());
  }
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.