/**
 * Copyright (c) 2015 Bosch Software Innovations GmbH and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.eclipse.hawkbit.rest.resource.model;

import java.util.List;

import javax.validation.constraints.NotNull;

import org.springframework.hateoas.ResourceSupport;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

/**
 * A list representation with meta data for pagination, e.g. containing the
 * total elements and size of content. The content of the actual list is stored
 * in the {@link #content} field.
 *
 * @param <T>
 *            the type of elements in this list
 *
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(Include.NON_NULL)
public class PagedList<T> extends ResourceSupport {

    private final List<T> content;
    private final long totalElements;
    private final int size;

    /**
     * creates a new paged list with the given {@code content} and {@code total}
     * .
     *
     * @param content
     *            the actual content of the list
     * @param total
     *            the total amount of elements
     * @throws NullPointerException
     *             in case {@code content} is {@code null}.
     */
    public PagedList(@NotNull final List<T> content, final long total) {
        this.size = content.size();
        this.totalElements = total;
        this.content = content;
    }

    /**
     * @return the size of the content list
     */
    public int getSize() {
        return size;
    }

    /**
     * @return the total amount of elements
     */
    public long getTotal() {
        return totalElements;
    }

    public List<T> getContent() {
        return content;
    }

}

@@ -485,24 +485,77 @@
 ceSupport;%0A%0A
+import com.fasterxml.jackson.annotation.JsonCreator;%0A
 import com.f
@@ -717,16 +717,70 @@
 Include;
+%0Aimport com.fasterxml.jackson.annotation.JsonProperty;
 %0A%0A/**%0A *
@@ -1167,16 +1167,34 @@
 port %7B%0A%0A
+    @JsonProperty%0A
     priv
@@ -1216,24 +1216,42 @@
 T%3E content;%0A
+    @JsonProperty%0A
     private 
@@ -1500,16 +1500,24 @@
 am total
+Elements
 %0A     * 
@@ -1652,32 +1652,49 @@
  null%7D.%0A     */%0A
+    @JsonCreator%0A
     public Paged
@@ -1698,16 +1698,41 @@
 gedList(
+@JsonProperty(%22content%22) 
 @NotNull
@@ -1754,16 +1754,59 @@
 content,
+%0A            @JsonProperty(%22totalElements%22)
  final l
@@ -1814,16 +1814,24 @@
 ng total
+Elements
 ) %7B%0A    
@@ -1896,16 +1896,24 @@
  = total
+Elements
 ;%0A      

fix json creator for PagedList for creating clients