Examples of FlexiBean


Examples of org.joda.beans.impl.flexi.FlexiBean

    Multimap<Class<?>, ComponentInfo> byType = TreeMultimap.create(ORDER_CLASS, ORDER_CLASSIFIER);
    for (ComponentInfo info : server.getComponentInfos()) {
      byType.put(info.getType(), info);
    }
    FreemarkerOutputter freemarker = new FreemarkerOutputter(servletContext);
    FlexiBean data = freemarker.createRootData();
    data.put("componentServer", server);
    data.put("infosByType", byType);
    return freemarker.build("data/componentserver.ftl", data);
  }
View Full Code Here

Examples of org.joda.beans.impl.flexi.FlexiBean

    if (_verbose) {
      s_logger.info("Matched " + allConfigs.size() + " configurations");
    }
    FudgeXMLStreamWriter xmlStreamWriter = new FudgeXMLStreamWriter(OpenGammaFudgeContext.getInstance(), new OutputStreamWriter(outputStream));
    FudgeSerializer serializer = new FudgeSerializer(OpenGammaFudgeContext.getInstance());
    FlexiBean wrapper = new FlexiBean();
    wrapper.set("configs", allConfigs);
    if (_portPortfolioRefs) {
      Map<UniqueId, String> idToPortfolioMap = getPortfolioNameMap(allConfigs);
      wrapper.set("idToPortfolioMap", idToPortfolioMap);
    }
    MutableFudgeMsg msg = serializer.objectToFudgeMsg(wrapper);
    FudgeMsgWriter fudgeMsgWriter = new FudgeMsgWriter(xmlStreamWriter);
    fudgeMsgWriter.writeMessage(msg);
    fudgeMsgWriter.close();
View Full Code Here

Examples of org.joda.beans.impl.flexi.FlexiBean

    Object object = deserializer.fudgeMsgToObject(FlexiBean.class, configsMessage);
    if (!(object instanceof FlexiBean)) {
      s_logger.error("XML Stream deserialised to object of type " + object.getClass() + ": " + object.toString());
      return;
    }
    FlexiBean wrapper = (FlexiBean) object;
    if (!wrapper.contains("configs")) {
      s_logger.error("File stream does not contain configs element");
      return;
    }
    @SuppressWarnings("unchecked")
    List<ConfigEntry> configs = (List<ConfigEntry>) wrapper.get("configs");
    if (wrapper.contains("idToPortfolioMap")) {
      @SuppressWarnings("unchecked")
      Map<UniqueId, String> idToPortfolioMap = (Map<UniqueId, String>) wrapper.get("idToPortfolioMap");
      if (idToPortfolioMap == null) {
        s_logger.warn("Apparently corrupt portfolio id -> name map, won't attempt to port portfolio ids");
        loadConfigs(configs, Collections.<UniqueId, String>emptyMap());
      } else {
        loadConfigs(configs, idToPortfolioMap);
View Full Code Here

Examples of org.joda.beans.impl.flexi.FlexiBean

    // same despite different IDs
    assertTrue(beanCompare.compare(bean1, bean2).isEmpty());
  }

  private static Bean createBean(UniqueId uniqueId, ExternalIdBundle idBundle, String name) {
    FlexiBean bean = new FlexiBean();
    bean.propertyDefine(UNIQUE_ID, UniqueId.class);
    bean.propertyDefine(EXTERNAL_ID_BUNDLE, ExternalIdBundle.class);
    bean.propertyDefine(NAME, String.class);
    bean.propertySet(UNIQUE_ID, uniqueId);
    bean.propertySet(EXTERNAL_ID_BUNDLE, idBundle);
    bean.propertySet(NAME, name);
    return bean;
  }
View Full Code Here

Examples of org.joda.beans.impl.flexi.FlexiBean

  //-------------------------------------------------------------------------
  @GET
  @Produces(MediaType.TEXT_HTML)
  public String get(@Context ServletContext servletContext, @Context UriInfo uriInfo) {
    FreemarkerOutputter freemarker = new FreemarkerOutputter(servletContext);
    FlexiBean out = freemarker.createRootData();
    out = createRootData(out, uriInfo);
    return freemarker.build("home.ftl", out);
  }
View Full Code Here

Examples of org.joda.beans.impl.flexi.FlexiBean

  //-------------------------------------------------------------------------
  @GET
  @Produces(MediaType.TEXT_HTML)
  public String get(@Context ServletContext servletContext, @Context UriInfo uriInfo) {
    FreemarkerOutputter freemarker = new FreemarkerOutputter(servletContext);
    FlexiBean out = freemarker.createRootData();
    out = createRootData(out, uriInfo, servletContext);
    return freemarker.build("about.ftl", out);
  }
View Full Code Here

Examples of org.joda.beans.impl.flexi.FlexiBean

   * </ul>
   *
   * @return the root data map, not null
   */
  public FlexiBean createRootData() {
    FlexiBean data = new FlexiBean();
    data.put("now", ZonedDateTime.now(OpenGammaClock.getInstance()));
    data.put("timeFormatter", DateTimeFormatter.ofPattern("HH:mm:ss"));
    data.put("offsetFormatter", DateTimeFormatter.ofPattern("Z"));
    return data;
  }
View Full Code Here

Examples of org.joda.beans.impl.flexi.FlexiBean

  //-------------------------------------------------------------------------
  @GET
  @Produces(MediaType.TEXT_HTML)
  public String getHTML() {
    FlexiBean out = createRootData();
    return getFreemarker().build(HTML_DIR + "organizationversion.ftl", out);
  }
View Full Code Here

Examples of org.joda.beans.impl.flexi.FlexiBean

    EntityTag etag = new EntityTag(data().getVersioned().getUniqueId().toString());
    ResponseBuilder builder = request.evaluatePreconditions(etag);
    if (builder != null) {
      return builder.build();
    }
    FlexiBean out = createRootData();
    String json = getFreemarker().build(JSON_DIR + "organization.ftl", out);
    return Response.ok(json).tag(etag).build();
  }
View Full Code Here

Examples of org.joda.beans.impl.flexi.FlexiBean

  /**
   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    OrganizationDocument latestOrgDoc = data().getOrganization();
    OrganizationDocument versionedOrganization = data().getVersioned();
    out.put("latestOrganizationDoc", latestOrgDoc);
    out.put("latestOrganization", latestOrgDoc.getOrganization());
    out.put("organizationDoc", versionedOrganization);
    out.put("organization", versionedOrganization.getOrganization());
    out.put("deleted", !latestOrgDoc.isLatest());
    return out;
  }
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.