package com.cloudera.server.web.cmf.include;

import com.cloudera.cmf.model.DbProcess;
import com.cloudera.cmf.model.DbRole;
import com.cloudera.cmf.service.RoleHandler;
import java.io.IOException;
import java.io.Writer;
import java.lang.reflect.Constructor;
import org.jamon.AbstractRenderer;
import org.jamon.AbstractTemplateImpl;
import org.jamon.AbstractTemplateProxy;
import org.jamon.AbstractTemplateProxy.ImplData;
import org.jamon.AbstractTemplateProxy.Intf;
import org.jamon.Renderer;
import org.jamon.TemplateManager;
import org.jamon.annotations.Template;

@Template(signature="2D2B94F86557FECFB94B3C8EBBC54266", requiredArguments={@org.jamon.annotations.Argument(name="role", type="DbRole"), @org.jamon.annotations.Argument(name="process", type="DbProcess"), @org.jamon.annotations.Argument(name="roleHandler", type="RoleHandler")}, optionalArguments={@org.jamon.annotations.Argument(name="roleLogForTimeInMillis", type="Long")})
public class ProcessLogDisplay extends AbstractTemplateProxy
{
  protected Long roleLogForTimeInMillis;

  public ProcessLogDisplay(TemplateManager p_manager)
  {
    super(p_manager);
  }

  protected ProcessLogDisplay(String p_path)
  {
    super(p_path);
  }

  public ProcessLogDisplay()
  {
    super("/com/cloudera/server/web/cmf/include/ProcessLogDisplay");
  }

  protected AbstractTemplateProxy.ImplData makeImplData()
  {
    return new ImplData();
  }

  public ImplData getImplData() {
    return (ImplData)super.getImplData();
  }

  public final ProcessLogDisplay setRoleLogForTimeInMillis(Long p_roleLogForTimeInMillis)
  {
    getImplData().setRoleLogForTimeInMillis(p_roleLogForTimeInMillis);
    return this;
  }

  public AbstractTemplateImpl constructImpl(Class<? extends AbstractTemplateImpl> p_class)
  {
    try
    {
      return (AbstractTemplateImpl)p_class.getConstructor(new Class[] { TemplateManager.class, ImplData.class }).newInstance(new Object[] { getTemplateManager(), getImplData() });
    }
    catch (RuntimeException e)
    {
      throw e;
    }
    catch (Exception e) {
    }
    throw new RuntimeException(e);
  }

  protected AbstractTemplateImpl constructImpl()
  {
    return new ProcessLogDisplayImpl(getTemplateManager(), getImplData());
  }

  public Renderer makeRenderer(DbRole role, DbProcess process, RoleHandler roleHandler) {
    return new AbstractRenderer(role, process, roleHandler)
    {
      public void renderTo(Writer jamonWriter)
        throws IOException
      {
        ProcessLogDisplay.this.render(jamonWriter, this.val$role, this.val$process, this.val$roleHandler);
      }
    };
  }

  public void render(Writer jamonWriter, DbRole role, DbProcess process, RoleHandler roleHandler) throws IOException
  {
    renderNoFlush(jamonWriter, role, process, roleHandler);
    jamonWriter.flush();
  }

  public void renderNoFlush(Writer jamonWriter, DbRole role, DbProcess process, RoleHandler roleHandler) throws IOException
  {
    ImplData implData = getImplData();
    implData.setRole(role);
    implData.setProcess(process);
    implData.setRoleHandler(roleHandler);
    Intf instance = (Intf)getTemplateManager().constructImpl(this);
    instance.renderNoFlush(jamonWriter);
    reset();
  }

  public static class ImplData extends AbstractTemplateProxy.ImplData
  {
    private DbRole m_role;
    private DbProcess m_process;
    private RoleHandler m_roleHandler;
    private Long m_roleLogForTimeInMillis;
    private boolean m_roleLogForTimeInMillis__IsNotDefault;

    public void setRole(DbRole role)
    {
      this.m_role = role;
    }

    public DbRole getRole() {
      return this.m_role;
    }

    public void setProcess(DbProcess process)
    {
      this.m_process = process;
    }

    public DbProcess getProcess() {
      return this.m_process;
    }

    public void setRoleHandler(RoleHandler roleHandler)
    {
      this.m_roleHandler = roleHandler;
    }

    public RoleHandler getRoleHandler() {
      return this.m_roleHandler;
    }

    public void setRoleLogForTimeInMillis(Long roleLogForTimeInMillis)
    {
      this.m_roleLogForTimeInMillis = roleLogForTimeInMillis;
      this.m_roleLogForTimeInMillis__IsNotDefault = true;
    }

    public Long getRoleLogForTimeInMillis() {
      return this.m_roleLogForTimeInMillis;
    }

    public boolean getRoleLogForTimeInMillis__IsNotDefault()
    {
      return this.m_roleLogForTimeInMillis__IsNotDefault;
    }
  }

  public static abstract interface Intf extends AbstractTemplateProxy.Intf
  {
    public abstract void renderNoFlush(Writer paramWriter)
      throws IOException;
  }
}