Examples of IThingWriter


Examples of pt.webdetails.cdf.dd.model.core.writer.IThingWriter

    assert factory != null;

    // GLOBAL PROPERTIES
    for(PropertyType prop : model.getPropertyTypes())
    {
      IThingWriter propWriter;
      try
      {
        propWriter = factory.getWriter(prop);
        assert propWriter != null;
      }
      catch(UnsupportedThingException ex)
      {
        ThingWriteException ex2 = new ThingWriteException(ex);
        if(context.getBreakOnError()) { throw ex2; }
        _logger.error(ex2);
        continue;
      }

      propWriter.write(out, context, prop);
    }

    // COMPONENTS
    // Components output their own properties
    for(ComponentType comp : model.getComponentTypes())
    {
      IThingWriter compWriter;
      try
      {
        compWriter = factory.getWriter(comp);
        assert compWriter != null;
      }
      catch(UnsupportedThingException ex)
      {
        ThingWriteException ex2 = new ThingWriteException(ex);
        if(context.getBreakOnError()) { throw ex2; }
        _logger.error(ex2);
        continue;
      }

      compWriter.write(out, context, comp);
    }
  }
View Full Code Here

Examples of pt.webdetails.cdf.dd.model.core.writer.IThingWriter

           
            custPropsElem = implElem.addElement("CustomProperties");
          }

          PropertyType prop = propUsage.getProperty();
          IThingWriter writer;
          try
          {
            writer = factory.getWriter(prop);
          }
          catch (UnsupportedThingException ex)
          {
            throw new ThingWriteException(ex);
          }

          writer.write(custPropsElem, context, prop);
        }
      }
    }
  }
View Full Code Here

Examples of pt.webdetails.cdf.dd.model.core.writer.IThingWriter

      for(PropertyTypeUsage propUsage : comp.getPropertyUsages())
      {
        if(propUsage.isOwned())
        {
          PropertyType prop = propUsage.getProperty();
          IThingWriter writer;
          try
          {
            writer = factory.getWriter(prop);
          }
          catch (UnsupportedThingException ex)
          {
            throw new ThingWriteException(ex);
          }

          writer.write(out, context, prop);
        }
      }
    }
   
    // --------------
View Full Code Here

Examples of pt.webdetails.cdf.dd.model.core.writer.IThingWriter

    // Obtain an UPDATED dashboard object
    DashboardManager dashMgr = DashboardManager.getInstance();
    Dashboard dash = dashMgr.getDashboard( wcdfFilePath, /*bypassCacheRead*/false );

    CggRunJsThingWriterFactory cggWriteFactory = new CggRunJsThingWriterFactory();
    IThingWriter cggDashWriter = cggWriteFactory.getWriter( dash );
    CggRunJsDashboardWriteContext cggDashContext = new CggRunJsDashboardWriteContext( cggWriteFactory, dash );
    cggDashWriter.write( access, cggDashContext, dash );
  }
View Full Code Here

Examples of pt.webdetails.cdf.dd.model.core.writer.IThingWriter

    // Obtain an UPDATED dashboard object
    DashboardManager dashMgr = DashboardManager.getInstance();
    Dashboard dash = dashMgr.getDashboard( wcdfFilePath, /*bypassCacheRead*/false );

    CggRunJsThingWriterFactory cggWriteFactory = new CggRunJsThingWriterFactory();
    IThingWriter cggDashWriter = cggWriteFactory.getWriter( dash );
    CggRunJsDashboardWriteContext cggDashContext = new CggRunJsDashboardWriteContext( cggWriteFactory, dash );
    cggDashWriter.write( access, cggDashContext, dash );
  }
View Full Code Here

Examples of pt.webdetails.cdf.dd.model.core.writer.IThingWriter

    }

    IThingWriterFactory factory = new XmlThingWriterFactory();
    IThingWriteContext context = new DefaultThingWriteContext( factory, true );

    IThingWriter writer;
    try {
      writer = factory.getWriter( widget );
    } catch ( UnsupportedThingException ex ) {
      logger.error( "No writer to write widget component type to XML", ex );
      return null;
    }

    Document doc = DocumentHelper.createDocument();
    try {
      writer.write( doc, context, widget );
    } catch ( ThingWriteException ex ) {
      logger.error( "Failed writing widget component type to XML", ex );
      return null;
    }
View Full Code Here

Examples of pt.webdetails.cdf.dd.model.core.writer.IThingWriter

    }
  }

  private String writeJsDefinition( MetaModel model ) {
    IThingWriterFactory factory = new CdeRunJsThingWriterFactory();
    IThingWriter writer;

    try {
      writer = factory.getWriter( model );
    } catch ( UnsupportedThingException ex ) {
      logger.error( "Error while obtaining the model writer from the factory.", ex );
      return null;
    }

    StringBuilder out = new StringBuilder();
    IThingWriteContext context = new DefaultThingWriteContext( factory, false );
    try {
      writer.write( out, context, model );
    } catch ( ThingWriteException ex ) {
      logger.error( "Error while writing the model to JS.", ex );
      return null;
    }
View Full Code Here

Examples of pt.webdetails.cdf.dd.model.core.writer.IThingWriter

      {
        GenericComponent genComp = (GenericComponent)comp;
        if(genComp.getMeta().tryGetAttributeValue("cdwSupport", "false").equalsIgnoreCase("true") &&
           genComp.tryGetAttributeValue("cdwRender", "false").equalsIgnoreCase("true"))
        {
          IThingWriter writer;
          try
          {
            writer = factory.getWriter(genComp);
          }
          catch (UnsupportedThingException ex)
          {
            throw new ThingWriteException(ex);
          }
         
          writer.write(access, context, comp);
        }
      }
    }
  }
View Full Code Here

Examples of pt.webdetails.cdf.dd.model.core.writer.IThingWriter

    // ---------------
    // TODO: HACK: Delegate writing the component definition to the corresponding CdfRunJs writer
    // Should this be done differently?
    IThingWriterFactory writerFactory = new CdfRunJsThingWriterFactory();
    IThingWriter compWriter;
    try
    {
      compWriter = writerFactory.getWriter(comp);
    }
    catch(UnsupportedThingException ex)
    {
      throw new ThingWriteException("Error while obtaining a writer for rendering the generic component.", ex);
    }

    // Options are kind of irrelevant in this context,
    // as we're only rendering one component, not a dashboard (and not a widget component).
    CdfRunJsDashboardWriteOptions options = new CdfRunJsDashboardWriteOptions(false, false, "", "");

    // Idem
    CdfRunJsDashboardWriteContext writeContext =
        CdeEngine.getInstance().getEnvironment().getCdfRunJsDashboardWriteContext(
            writerFactory,
            /*indent*/"",
            /*bypassCacheRead*/true,
            context.getDashboard(),
            options);

    compWriter.write(out, writeContext, comp);
  }
View Full Code Here

Examples of pt.webdetails.cdf.dd.model.core.writer.IThingWriter

    if(StringUtils.isNotEmpty(dataSourceName))
    {
      DataSourceComponent dsComp = dash.getDataSource(dataSourceName);

      IThingWriterFactory factory = context.getFactory();
      IThingWriter dsWriter;
      try
      {
        dsWriter = factory.getWriter(dsComp);
      }
      catch (UnsupportedThingException ex)
      {
        throw new ThingWriteException(ex);
      }

      CggRunJsComponentWriteContext compContext = new CggRunJsComponentWriteContext(factory, dash, comp);
      dsWriter.write(out, compContext, dsComp);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.