Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/crudaction/business
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/crudaction/business
Added Files:
BusinessObj.java
Log Message:
--- NEW FILE: BusinessObj.java ---
/*
* Copyright 2004-2005 Michael Jouravlev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.jspcontrols.dialogs.samples.crudaction.business;
/**
* A simple bean, represinting a Business Object. For simplicity,
* no business rules are defined. This is just a struct.
*
* @author Michael Jouravlev
*/
public class BusinessObj {
/*
* Business Object ID, a primary key
*/
private String itemId;
public String getItemId() {return itemId;}
public void setItemId(String itemId) {this.itemId = itemId;}
/*
* Business object value, must be short integer
*/
private String stringValue;
public String getStringValue() {return stringValue;}
public void setStringValue(String value) {this.stringValue = value;}
/*
* Business object status, can be "New" or "Stored".
*/
private int intValue;
public int getIntValue() {return intValue;}
public void setIntValue(int intValue) {this.intValue = intValue;}
/**
* Creates new Business Object with random 4-digit ID
*/
public BusinessObj() {
itemId = (new Integer((new Double((Math.random() *
100000))).intValue())).toString();
this.stringValue = "Item #" + itemId;
this.intValue = (new Double((Math.random() * 100000))).intValue();
}
/**
* Creates new Business Object with a certain ID but
* with random value. Used to create default items.
*
* @param id Business Object ID
*/
public BusinessObj(String id) {
this.itemId = id;
this.stringValue = "-default-";
this.intValue = (new Double((Math.random() * 100000))).intValue();
}
/**
* Creates new Business Object with particular ID, value and status
*
* @param id Business Object ID
* @param strValue Business Object value
* @param intValue Business Object status
*/
public BusinessObj(String id, String strValue, int intValue) {
this.itemId = id;
this.stringValue = strValue;
this.intValue = intValue;
}
/**
* Creates a full copy of another Business Object
*
* @param item Source Business Object
*/
public BusinessObj(BusinessObj item) {
this.itemId = item.itemId;
this.stringValue = item.stringValue;
this.intValue = item.intValue;
}
}
|