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

it.tidalwave.bluebill.stats.domain.PingV1 Maven / Gradle / Ivy

The newest version!
/***********************************************************************************************************************
 *
 * blueBill Stats
 * Copyright (C) 2011-2011 by Tidalwave s.a.s. (http://www.tidalwave.it)
 *
 ***********************************************************************************************************************
 *
 * 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.
 *
 ***********************************************************************************************************************
 *
 * WWW: http://bluebill.tidalwave.it/mobile/
 * SCM: http://java.net/hg/bluebill-server~stats-src
 *
 **********************************************************************************************************************/
package it.tidalwave.bluebill.stats.domain;

import lombok.Setter;
import javax.annotation.Nonnull;
import javax.xml.bind.annotation.XmlAccessorOrder;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.joda.time.DateTime;
import static javax.xml.bind.annotation.XmlAccessType.*;
import static javax.xml.bind.annotation.XmlAccessOrder.*;

/***********************************************************************************************************************
 *
 * A bean to expose {@link Ping} to REST.
 * 
 * @stereotype Adapter
 * 
 * @author  Fabrizio Giudici
 * @version $Id$
 *
 **********************************************************************************************************************/
@XmlRootElement(name="ping") @XmlAccessorType(FIELD) @XmlAccessorOrder(ALPHABETICAL)
@AllArgsConstructor @NoArgsConstructor @ToString 
public class PingV1 
  {
    private Date timestamp;
    
    @Setter
    private String ipAddress;
    
    @Setter
    private String installId;
    
    private String appVersion;

    private String osVersion;
    
    private String javaVersion;
    
    private String userLanguage;
    
    private String userRegion;
    
    private String board;
    
    private String brand;
    
    private String device;
    
    private String model;
    
    private String product;
    
    private String versionIncremental;
    
    private String versionRelease;
    
    private String versionSDK;
    
    /*******************************************************************************************************************
     *
     * 
     ******************************************************************************************************************/
    public PingV1 (final @Nonnull Ping ping)
      {
        this.timestamp = ping.getTimestamp().toDate();
        this.ipAddress = ping.getIpAddress(); 
        this.installId = ping.getInstallId(); 
        this.appVersion = ping.getAppVersion();
        this.osVersion = ping.getOsVersion();
        this.javaVersion = ping.getJavaVersion();
        this.userLanguage = ping.getUserLanguage(); 
        this.userRegion = ping.getUserRegion(); 
        this.board = ping.getBoard(); 
        this.brand = ping.getBrand(); 
        this.device = ping.getDevice(); 
        this.model = ping.getModel(); 
        this.product = ping.getProduct(); 
        this.versionIncremental = ping.getVersionIncremental(); 
        this.versionRelease = ping.getVersionRelease(); 
        this.versionSDK = ping.getVersionSDK();
      }
    
    /*******************************************************************************************************************
     *
     * 
     ******************************************************************************************************************/
    @Nonnull
    public Ping toPing()
      {
        return new Ping(new DateTime(timestamp.getTime()), 
                        ipAddress, 
                        installId, 
                        appVersion, 
                        osVersion, 
                        javaVersion, 
                        userLanguage, 
                        userRegion, 
                        board, 
                        brand, 
                        device, 
                        model, 
                        product,
                        versionIncremental, 
                        versionRelease, 
                        versionSDK);
      }
  }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy