2013-02-06 15:40:17 +01:00
|
|
|
package org.gcube.portlets.user.workspace.client.model;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
|
|
|
|
|
|
|
/**
|
2015-11-17 18:14:16 +01:00
|
|
|
* The Class FileGridModel.
|
2013-02-06 15:40:17 +01:00
|
|
|
*
|
2015-11-17 18:14:16 +01:00
|
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Nov 17, 2015
|
2013-02-06 15:40:17 +01:00
|
|
|
*/
|
|
|
|
public class FileGridModel extends FileModel {
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
private static final long serialVersionUID = 1L;
|
2015-11-17 18:14:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates a new file grid model.
|
|
|
|
*/
|
|
|
|
protected FileGridModel() {
|
2013-02-06 15:40:17 +01:00
|
|
|
}
|
2015-11-17 18:14:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates a new file grid model.
|
|
|
|
*
|
|
|
|
* @param identifier
|
|
|
|
* the identifier
|
|
|
|
* @param name
|
|
|
|
* the name
|
|
|
|
* @param path
|
|
|
|
* the path
|
|
|
|
* @param lastUpdate
|
|
|
|
* the last update
|
|
|
|
* @param parent
|
|
|
|
* the parent
|
|
|
|
* @param size
|
|
|
|
* the size
|
|
|
|
* @param isDirectory
|
|
|
|
* the is directory
|
|
|
|
* @param isShared
|
|
|
|
* the is shared
|
|
|
|
*/
|
|
|
|
public FileGridModel(String identifier, String name, String path,
|
|
|
|
Date lastUpdate, FileModel parent, long size, boolean isDirectory,
|
|
|
|
boolean isShared) {
|
2013-02-06 15:40:17 +01:00
|
|
|
super(identifier, name, parent, isDirectory, isShared);
|
2015-11-17 18:14:16 +01:00
|
|
|
|
2013-11-15 12:12:17 +01:00
|
|
|
setLastModification(lastUpdate);
|
2013-02-06 15:40:17 +01:00
|
|
|
setSize(size);
|
|
|
|
}
|
2015-11-17 18:14:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates a new file grid model.
|
|
|
|
*
|
|
|
|
* @param identifier
|
|
|
|
* the identifier
|
|
|
|
* @param name
|
|
|
|
* the name
|
|
|
|
* @param lastUpdate
|
|
|
|
* the last update
|
|
|
|
* @param parent
|
|
|
|
* the parent
|
|
|
|
* @param size
|
|
|
|
* the size
|
|
|
|
* @param isDirectory
|
|
|
|
* the is directory
|
|
|
|
* @param isShared
|
|
|
|
* the is shared
|
|
|
|
*/
|
|
|
|
public FileGridModel(String identifier, String name, Date lastUpdate,
|
|
|
|
FileModel parent, long size, boolean isDirectory, boolean isShared) {
|
2013-02-06 15:40:17 +01:00
|
|
|
super(identifier, name, parent, isDirectory, isShared);
|
2015-11-17 18:14:16 +01:00
|
|
|
|
2013-11-15 12:12:17 +01:00
|
|
|
setLastModification(lastUpdate);
|
2013-02-06 15:40:17 +01:00
|
|
|
setSize(size);
|
|
|
|
}
|
2015-11-17 18:14:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the size.
|
|
|
|
*
|
|
|
|
* @param size
|
|
|
|
* the new size
|
|
|
|
*/
|
2013-02-06 15:40:17 +01:00
|
|
|
private void setSize(long size) {
|
2015-11-17 18:14:16 +01:00
|
|
|
set(ConstantsExplorer.SIZE, size);
|
2013-02-06 15:40:17 +01:00
|
|
|
}
|
2015-11-17 18:14:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the size.
|
|
|
|
*
|
|
|
|
* @return the size
|
|
|
|
*/
|
2013-02-06 15:40:17 +01:00
|
|
|
public long getSize() {
|
2015-11-17 18:14:16 +01:00
|
|
|
return (Long) get(ConstantsExplorer.SIZE);
|
2013-02-06 15:40:17 +01:00
|
|
|
}
|
|
|
|
|
2015-11-17 18:14:16 +01:00
|
|
|
/**
|
|
|
|
* Sets the last modification.
|
|
|
|
*
|
|
|
|
* @param lastUpdate
|
|
|
|
* the new last modification
|
|
|
|
*/
|
2013-11-15 12:12:17 +01:00
|
|
|
private void setLastModification(Date lastUpdate) {
|
2015-11-17 18:14:16 +01:00
|
|
|
set(ConstantsExplorer.LASTMODIFIED, lastUpdate);
|
|
|
|
|
2013-02-06 15:40:17 +01:00
|
|
|
}
|
2015-11-17 18:14:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the last modification.
|
|
|
|
*
|
|
|
|
* @return the last modification
|
|
|
|
*/
|
2013-11-15 12:12:17 +01:00
|
|
|
public Date getLastModification() {
|
|
|
|
return (Date) get(ConstantsExplorer.LASTMODIFIED);
|
2015-11-17 18:14:16 +01:00
|
|
|
|
2013-02-06 15:40:17 +01:00
|
|
|
}
|
|
|
|
|
2015-11-17 18:14:16 +01:00
|
|
|
/*
|
|
|
|
* (non-Javadoc)
|
|
|
|
*
|
|
|
|
* @see
|
|
|
|
* org.gcube.portlets.user.workspace.client.model.FileModel#equals(java.
|
|
|
|
* lang.Object)
|
|
|
|
*/
|
2013-02-06 15:40:17 +01:00
|
|
|
@Override
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (obj != null && obj instanceof FileGridModel) {
|
|
|
|
FileGridModel mobj = (FileGridModel) obj;
|
|
|
|
return getIdentifier().equals(mobj.getIdentifier());
|
|
|
|
}
|
|
|
|
return super.equals(obj);
|
|
|
|
}
|
|
|
|
}
|