001    package com.mockrunner.mock.connector.cci;
002    
003    import javax.resource.cci.Record;
004    
005    /**
006     * Mock implementation of <code>Record</code>.
007     */
008    public class MockRecord implements Record
009    {
010        private String recordName;
011        private String recordDescription;
012     
013        public MockRecord()
014        {
015            this("MockrunnerGenericRecord");
016        }
017    
018        public MockRecord(String name)
019        {
020            this(name, name);
021        }
022    
023        public MockRecord(String name, String description)
024        {
025            recordName = name;
026            recordDescription = description;
027        }
028    
029        public String getRecordName()
030        {
031            return recordName;
032        }
033    
034        public String getRecordShortDescription()
035        {
036            return recordDescription;
037        }
038    
039        public void setRecordName(String recordName)
040        {
041            this.recordName = recordName;
042        }
043    
044        public void setRecordShortDescription(String recordDescription)
045        {
046            this.recordDescription = recordDescription;
047        }
048    
049        public boolean equals(Object object)
050        {
051            if(null == object) return false;
052            if(!object.getClass().equals(this.getClass())) return false;
053            MockRecord other = (MockRecord)object;
054            if(null != recordName && !recordName.equals(other.recordName)) return false;
055            if(null != recordDescription && !recordDescription.equals(other.recordDescription)) return false;
056            if(null == recordName && null != other.recordName) return false;
057            if(null == recordDescription && null != other.recordDescription) return false;
058            return true;
059        }
060    
061        public int hashCode()
062        {
063            int hashCode = 17;
064            if(null != recordName) hashCode = (31 * hashCode) + recordName.hashCode();
065            if(null != recordDescription) hashCode = (31 * hashCode) + recordDescription.hashCode();
066            return hashCode;
067        }
068    
069        public String toString()
070        {
071            StringBuffer buffer = new StringBuffer();
072            buffer.append(this.getClass().getName() + ", ");
073            buffer.append("name: " + recordName + ", ");
074            buffer.append("description: " + recordDescription);
075            return buffer.toString();
076        }
077    
078        public Object clone() throws CloneNotSupportedException
079        {
080            return super.clone();
081        }
082    }