Package com.nordija.portal.entity

Source Code of com.nordija.portal.entity.LayoutBean

/**
* Copyright 1999-2001 by Nordija <www.nordija.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
**/


package com.nordija.portal.entity;

import com.nordija.midtier.ejb.BaseEntityBean;
import com.nordija.midtier.ejb.EntityVersionException;

// TODO move into separate class
import com.nordija.midtier.utilitybeans.sequence.sessionbean.SequenceServiceHome;
import com.nordija.midtier.utilitybeans.sequence.sessionbean.SequenceService;
import com.nordija.midtier.utilitybeans.sequence.entitybean.Range;
import javax.naming.*;
import javax.ejb.*;

/**
* Core bean code for the Layout bean.
*
* Entity Bean - Container Managed Persistence 
*
* Generated by Nordija BeanBuilder - www.nordija.com
*
* @author Nordija ApS
*/

public class LayoutBean extends BaseEntityBean implements LayoutBusiness
{

  /** Unique id of the layout - Persisted by container */
  public long id;

  /** Name of layout - Persisted by container */
  public String name;

  /** Name of jsp file with layout - Persisted by container */
  public String jspfile;


   
  /**
   * This method corresponds to a create method in the home interface
   *
   */
    
  public LayoutPK ejbCreate() throws java.rmi.RemoteException
  {
    try {
      // TODO: Reuse at central point
      Context ctx = new InitialContext();
      SequenceServiceHome home = (SequenceServiceHome)ctx.lookup("nordija.portal.sequence");
      SequenceService seq = home.create();
      Range range = seq.getSequenceRange("Layout",true,1);

      // Init values
      this.id = range.getNextUniqueNumber();
      this.name = "No name";
      this.jspfile = "none.jsp";

    } catch(javax.naming.NamingException ne) {
      throw new java.rmi.RemoteException("Error while looking up the Sequence service",ne);
    } catch(javax.ejb.CreateException ce) {
      throw new java.rmi.RemoteException("Error while trying to create new instance. Check the SequenceService is installed and running correctly",ce);
    }

    ejbCreateDone();
 
    return new LayoutPK(id);
  }

  /**
   * This method is required by the EJB Specification, but is not used here.
   *
   */
    
  public void ejbPostCreate()
  {
  }


  /**
   * Get the value of the id attribute.
   * (Unique id of the layout)
   *
   * @return Value of id attribute
   */

  public long getId()
  {
    return id;
  }

  /**
   * Get the value of the name attribute.
   * (Name of layout)
   *
   * @return Value of name attribute
   */

  public String getName()
  {
    return name;
  }

  /**
   * Get the value of the jspfile attribute.
   * (jspfile address of layout)
   *
   * @return Value of jspfile attribute
   */

  public String getJspfile()
  {
    return jspfile;
  }

  /**
   * Set id (Unique id of the layout)
   *
   * @param id New value for id
   */

  private void setId(long id)
  {
    this.id = id;
    setModified(true);
  }

  /**
   * Set name (Name of layout)
   *
   * @param name New value for name
   */

  public void setName(String name)
  {
    this.name = name;
    setModified(true);
  }

  /**
   * Set jspfile (jspfile of layout)
   *
   * @param jspfile New value for jspfile
   */

  public void setJspfile(String jspfile)
  {
    this.jspfile = jspfile;
    setModified(true);
  }



  /**
   * Get all attributes of the bean in a single data structure
   *
   * @return An instance of LayoutData
   */
    
  public LayoutData getAll()
  {
    return new LayoutData(id, name, jspfile);
  }

  // This might be a good place to add methods that are more specific to
  // your application. Don't forget to add methods to the LayoutBusiness
  // class if you want them to be remotely accessible.

  // Please also consider additional get/set method that operate on several
  // attributes in a single method - in particular if you plan to use this
  // bean across a network connection.

}
TOP

Related Classes of com.nordija.portal.entity.LayoutBean

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.