001package ch.gbrain.gwtstorage.model;
002
003/*
004 * #%L
005 * GwtStorage
006 * %%
007 * Copyright (C) 2016 gbrain.ch
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import java.util.Date;
024
025import ch.gbrain.gwtstorage.manager.StorageManager;
026
027/**
028 * Holds some informations about a cached StorageObject
029 *
030 */
031public class StorageInfo
032{
033
034  private String storageKey;
035  private String version;
036  private String fileName;
037  private String filePath;
038  private String fileUrl;
039  private Long fileSize;
040  private Date lastModificationDate;
041
042  public String getStorageKey()
043  {
044    return storageKey;
045  }
046
047  public void setStorageKey(String storageKey)
048  {
049    this.storageKey = storageKey;
050  }
051
052  public String getVersion()
053  {
054    return version;
055  }
056
057  public void setVersion(String version)
058  {
059    this.version = version;
060  }
061
062  public String getFileName()
063  {
064    return fileName;
065  }
066  
067  /**
068   * Cleans the filename from the cache path 
069   * @return The clean file name without any transformed cache path
070   */
071  public String getCleanFileName()
072  {
073    return StorageManager.extractFileNameFromCacheFile(fileName);
074  }
075  
076
077  public void setFileName(String fileName)
078  {
079    this.fileName = fileName;
080  }
081
082  public String getFilePath()
083  {
084    return filePath;
085  }
086
087  public void setFilePath(String filePath)
088  {
089    this.filePath = filePath;
090  }
091
092  public String getFileUrl()
093  {
094    return fileUrl;
095  }
096
097  public void setFileUrl(String fileUrl)
098  {
099    this.fileUrl = fileUrl;
100  }
101
102  public Date getLastModificationDate()
103  {
104    return lastModificationDate;
105  }
106
107  public void setLastModificationDate(Date lastModificationDate)
108  {
109    this.lastModificationDate = lastModificationDate;
110  }
111
112  public Long getFileSize()
113  {
114    return fileSize;
115  }
116
117  public void setFileSize(Long fileSize)
118  {
119    this.fileSize = fileSize;
120  }
121
122}