All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.windowsazure.messaging.BaiduRegistration Maven / Gradle / Ivy

//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------

package com.windowsazure.messaging;

/**
 * Class representing a native registration for devices using Baidu PNS.
 */
public class BaiduRegistration extends Registration {
    private static final String BAIDU_NATIVE_REGISTRATION1 = "";
    private static final String BAIDU_NATIVE_REGISTRATION2 = "";
    private static final String BAIDU_NATIVE_REGISTRATION3 = "";
    private static final String BAIDU_NATIVE_REGISTRATION4 = "";

    protected String baiduUserId;
    protected String baiduChannelId;

    public BaiduRegistration() {
        this(null, null);
    }

    public BaiduRegistration(String baiduUserId, String baiduChannelId) {
        this(null, baiduUserId, baiduChannelId);
    }

    public BaiduRegistration(String registrationId, String baiduUserId, String baiduChannelId) {
        super(registrationId);
        this.baiduUserId = baiduUserId;
        this.baiduChannelId = baiduChannelId;
    }

    public String getBaiduUserId() {
        return baiduUserId;
    }

    public void setBaiduUserId(String baiduUserId) {
        this.baiduUserId = baiduUserId;
    }

    public String getBaiduChannelId() {
        return baiduChannelId;
    }

    public void setBaiduChannelId(String baiduChannelId) {
        this.baiduChannelId = baiduChannelId;
    }

    @Override
    public int hashCode() {
        String channel = (baiduUserId == null ? "" : baiduUserId) + "-" + (baiduChannelId == null ? "" : baiduChannelId);
        final int prime = 31;
        int result = super.hashCode();
        result = prime
            * result
            + ((baiduUserId == null && baiduChannelId == null) ? 0 : channel.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (getClass() != obj.getClass())
            return false;

        BaiduRegistration other = (BaiduRegistration) obj;
        return baiduUserId.equals(other.baiduUserId) && baiduChannelId.equals(other.baiduChannelId);
    }

    @Override
    public String getXml() {
        return BAIDU_NATIVE_REGISTRATION1 +
            getTagsXml() +
            BAIDU_NATIVE_REGISTRATION2 +
            baiduUserId +
            BAIDU_NATIVE_REGISTRATION3 +
            baiduChannelId +
            BAIDU_NATIVE_REGISTRATION4;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy