001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.scheduler.messaging;
016    
017    import com.liferay.portal.kernel.util.Validator;
018    
019    import java.io.Serializable;
020    
021    /**
022     * @author L??szl?? Csontos
023     */
024    public class ReceiverKey implements Serializable {
025    
026            /**
027             * The empty constructor is required by
028             * {@link com.liferay.portal.json.jabsorb.serializer.LiferaySerializer}. Do
029             * not use this for any other purpose.
030             */
031            public ReceiverKey() {
032            }
033    
034            public ReceiverKey(String jobName, String groupName) {
035                    _jobName = jobName;
036                    _groupName = groupName;
037            }
038    
039            @Override
040            public boolean equals(Object obj) {
041                    if (this == obj) {
042                            return true;
043                    }
044    
045                    if (!(obj instanceof ReceiverKey)) {
046                            return false;
047                    }
048    
049                    ReceiverKey receiverKey = (ReceiverKey)obj;
050    
051                    if (Validator.equals(_jobName, receiverKey._jobName) &&
052                            Validator.equals(_groupName, receiverKey._groupName)) {
053    
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            public String getGroupName() {
061                    return _groupName;
062            }
063    
064            public String getJobName() {
065                    return _jobName;
066            }
067    
068            @Override
069            public int hashCode() {
070                    return _jobName.hashCode() + (_groupName.hashCode() * 11);
071            }
072    
073            private String _groupName;
074            private String _jobName;
075    
076    }