<commit_before>/*
 *  Copyright (C) 2016  Datamatica (<EMAIL>)
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published
 *  by the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 * 
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package pl.datamatica.traccar.api.dtos;

import pl.datamatica.traccar.model.Device;
import pl.datamatica.traccar.model.Position;

public class DeviceDto {
    private final long id;
    private String iconKey;
    private String name;
    private PositionDto latestPosition;
    
    public DeviceDto(Device device) {
        this.id = device.getId();
        this.iconKey = device.getIconType().toString();
        this.name = device.getName();
        Position latestPosition = device.getLatestPosition();
        if(latestPosition != null) {
            this.latestPosition = new PositionDto(latestPosition);
        }
    }
    
    public long getId() {
        return id;
    }

    public String getIconKey() {
        return iconKey;
    }

    public String getName() {
        return name;
    }

    public PositionDto getLatestPosition() {
        return latestPosition;
    }
}<commit_msg>DeviceDto extended<commit_after>/*
 *  Copyright (C) 2016  Datamatica (<EMAIL>)
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published
 *  by the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 * 
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package pl.datamatica.traccar.api.dtos;

import pl.datamatica.traccar.model.Device;
import pl.datamatica.traccar.model.Position;

public class DeviceDto {
    private final long id;
    private String iconKey;
    private String deviceName;
    private String phoneNumber;
    private String plateNumber;
    private String description;
    private String status;
    private String uniqueId;
    private PositionDto lastEvent;
    private long accountId;
    private Long groupId;
    
    public DeviceDto(Device device) {
        this.id = device.getId();
        this.iconKey = device.getIconType().toString();
        this.deviceName = device.getName();
        this.phoneNumber = device.getPhoneNumber();
        this.plateNumber = device.getPlateNumber();
        this.description = device.getDescription();
        this.status = device.getStatus();
        this.uniqueId = device.getUniqueId();
        this.accountId = device.getOwner().getId();
        if(device.getGroup() != null)
            this.groupId = device.getGroup().getId();
        Position latestPosition = device.getLatestPosition();
        if(latestPosition != null) {
            this.lastEvent = new PositionDto(latestPosition);
        }
    }
    
    public long getId() {
        return id;
    }

    public String getIconKey() {
        return iconKey;
    }

    public String getName() {
        return deviceName;
    }

    public PositionDto getLatestPosition() {
        return lastEvent;
    }

    public String getDeviceName() {
        return deviceName;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public String getPlateNumber() {
        return plateNumber;
    }

    public String getDescription() {
        return description;
    }

    public String getStatus() {
        return status;
    }

    public String getUniqueId() {
        return uniqueId;
    }

    public PositionDto getLastEvent() {
        return lastEvent;
    }

    public long getAccountId() {
        return accountId;
    }

    public Long getGroupId() {
        return groupId;
    }
    
    
}
{'fraction_non_alphanumeric': 0.08191653786707882, 'fraction_numerical': 0.00220799293442261, 'mean_word_length': 2.635634028892456, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7318951', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1226, 'n_words': 417}