/*
 * ******************************************************************************
 *    Copyright 2016-2017 Spectra Logic Corporation. All Rights Reserved.
 *    Licensed under the Apache License, Version 2.0 (the "License"). You may not use
 *    this file except in compliance with the License. A copy of the License is located at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    or in the "license" file accompanying this file.
 *    This file 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.
 * ******************************************************************************
 */

package com.spectralogic.dsbrowser.gui.components.physicalplacement;

import java.util.Date;

public class PhysicalPlacementTapeEntryModel {
    private final String barcode;
    private final String serialNO;
    private final String type;
    private final String state;
    private final Date lastTapeError;
    private final boolean writeProtected;
    private final boolean available;
    private final long used;
    private final String tapePartition;
    private final String lastModified;
    private final String ejectLabel;
    private final String ejectLocation;

    public PhysicalPlacementTapeEntryModel(final String barcode, final String serialNO, final String type, final String state, final Date lastTapeError, final boolean writeProtected,
                                       final boolean available, final long used, final String tapePartition, final String lastModified, final String ejectLabel, final String ejectLocation) {
        this.barcode = barcode;
        this.serialNO = serialNO;
        this.type = type;
        this.state = state;
        this.lastTapeError = lastTapeError;
        this.writeProtected = writeProtected;
        this.available = available;
        this.used = used;
        this.tapePartition = tapePartition;
        this.lastModified = lastModified;
        this.ejectLabel = ejectLabel;
        this.ejectLocation = ejectLocation;

    }

    public boolean isAvailable() {
        return available;
    }

    public boolean isWriteProtected() {
        return writeProtected;
    }

    public String getBarcode() {
        return barcode;
    }

    public Date getLastTapeError() {
        return lastTapeError;
    }

    public String getSerialNO() {
        return serialNO;
    }

    public String getState() {
        return state;
    }

    public long getUsed() {
        return used;
    }

    public String getType() {
        return type;
    }

    public String getLastModified() {
        return lastModified;
    }

    public String getTapePartition() {
        return tapePartition;
    }

    public String getEjectLabel() {
        return ejectLabel;
    }

    public String getEjectLocation() {
        return ejectLocation;
    }
}

@@ -832,16 +832,57 @@
 ement;%0A%0A
+import org.apache.commons.io.FileUtils;%0A%0A
 import j
@@ -896,16 +896,16 @@
 l.Date;%0A
-
 %0Apublic 
@@ -1207,26 +1207,28 @@
 ivate final 
-lo
+Stri
 ng used;%0A   
@@ -1385,23 +1385,16 @@
 n;%0A%0A    
-public 
 Physical
@@ -1442,96 +1442,276 @@
 ode,
- final String serialNO, final String type, final String state, final Date lastTapeError,
+%0A                                    final String serialNO,%0A                                    final String type,%0A                                    final String state,%0A                                    final Date lastTapeError,%0A                                   
  fin
@@ -1765,35 +1765,32 @@
                 
-   
 final boolean av
@@ -1801,105 +1801,285 @@
 ble,
- final long used, final String tapePartition, final String lastModified, final String ejectLabel,
+%0A                                    final long used,%0A                                    final String tapePartition,%0A                                    final String lastModified,%0A                                    final String ejectLabel,%0A                                   
  fin
@@ -2371,20 +2371,54 @@
 .used = 
+FileUtils.byteCountToDisplaySize(
 used
+)
 ;%0A      
@@ -3008,18 +3008,20 @@
  public 
-lo
+Stri
 ng getUs

Convert PhysicalPlacement popup Used field from bytes to human readable with units