001    /**
002     * Copyright (c) 2000-present 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                    this(null, null);
033            }
034    
035            public ReceiverKey(String jobName, String groupName) {
036                    _jobName = jobName;
037                    _groupName = groupName;
038            }
039    
040            @Override
041            public boolean equals(Object obj) {
042                    if (this == obj) {
043                            return true;
044                    }
045    
046                    if (!(obj instanceof ReceiverKey)) {
047                            return false;
048                    }
049    
050                    ReceiverKey receiverKey = (ReceiverKey)obj;
051    
052                    if (Validator.equals(_jobName, receiverKey._jobName) &&
053                            Validator.equals(_groupName, receiverKey._groupName)) {
054    
055                            return true;
056                    }
057    
058                    return false;
059            }
060    
061            public String getGroupName() {
062                    return _groupName;
063            }
064    
065            public String getJobName() {
066                    return _jobName;
067            }
068    
069            @Override
070            public int hashCode() {
071                    return _jobName.hashCode() + (_groupName.hashCode() * 11);
072            }
073    
074            private final String _groupName;
075            private final String _jobName;
076    
077    }