blob: f7bb7bc3163b733eebddd4c3da4363e032772769 [file] [log] [blame]
// Copyright 2004, 2005 The Apache Software Foundation
//
// 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 org.apache.tapestry.timetracker.model;
import java.io.Serializable;
/**
* Represents a project for which time will be tracked.
*/
public class Project implements Serializable, Persistent
{
/** generated serial id. */
private static final long serialVersionUID = 9198547617843380606L;
protected long _id;
protected String _name;
/** Default constructor. */
public Project() { }
/**
* Creates a new project with default values.
* @param id
* @param name
*/
public Project(long id, String name)
{
_id = id;
_name = name;
}
/**
* @return Returns the id.
*/
public long getId()
{
return _id;
}
/**
* @param id The id to set.
*/
public void setId(long id)
{
_id = id;
}
/**
* @return Returns the name.
*/
public String getName()
{
return _name;
}
/**
* @param name The name to set.
*/
public void setName(String name)
{
_name = name;
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + (int) (_id ^ (_id >>> 32));
result = prime * result + ((_name == null) ? 0 : _name.hashCode());
return result;
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj)
{
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
final Project other = (Project) obj;
if (_id != other._id) return false;
if (_name == null) {
if (other._name != null) return false;
} else if (!_name.equals(other._name)) return false;
return true;
}
}