Enhancement on file versioning #7006
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@144198 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
663655d2b1
commit
62bfa20b60
|
@ -19,6 +19,7 @@ public class FileVersionModel extends FileModel {
|
|||
public static final String PATH = "path";
|
||||
public static final String USER_VERSIONING = "user_versioning";
|
||||
public static final String CREATED = "created";
|
||||
public static final String IS_CURRENT_VERSION = "is_current_version";
|
||||
|
||||
/**
|
||||
* Instantiates a new file model.
|
||||
|
@ -34,17 +35,30 @@ public class FileVersionModel extends FileModel {
|
|||
* @param path the path
|
||||
* @param userFullName the user full name
|
||||
* @param created the created
|
||||
* @param isCurrentVersion the is current version
|
||||
*/
|
||||
public FileVersionModel(String identifier, String name, String path, String userFullName, Date created) {
|
||||
public FileVersionModel(String identifier, String name, String path, String userFullName, Date created, Boolean isCurrentVersion) {
|
||||
setIdentifier(identifier);
|
||||
setName(name);
|
||||
setPath(path);
|
||||
setUser(userFullName);
|
||||
setCreated(created);
|
||||
setIsCurrentVersion(isCurrentVersion);
|
||||
super.initDefaultProperties();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the checks if is current version.
|
||||
*
|
||||
* @param isCurrentVersion the new checks if is current version
|
||||
*/
|
||||
private void setIsCurrentVersion(Boolean isCurrentVersion) {
|
||||
|
||||
set(IS_CURRENT_VERSION, isCurrentVersion);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the created.
|
||||
*
|
||||
|
@ -101,4 +115,18 @@ public class FileVersionModel extends FileModel {
|
|||
public String getUser(){
|
||||
return get(USER_VERSIONING);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is current version.
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
public Boolean isCurrentVersion(){
|
||||
Object obj = get(IS_CURRENT_VERSION);
|
||||
if(obj==null)
|
||||
return false;
|
||||
|
||||
return (Boolean) get(IS_CURRENT_VERSION);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2246,7 +2246,7 @@ public class GWTWorkspaceBuilder {
|
|||
List<FileVersionModel> listVersions = new ArrayList<FileVersionModel>(versions.size());
|
||||
for (WorkspaceVersion wsVersion : versions) {
|
||||
String user = UserUtil.getUserFullName(wsVersion.getUser());
|
||||
FileVersionModel file = new FileVersionModel(wsVersion.getName(), wsVersion.getName(), wsVersion.getRemotePath(), user, toDate(wsVersion.getCreated()));
|
||||
FileVersionModel file = new FileVersionModel(wsVersion.getName(), wsVersion.getName(), wsVersion.getRemotePath(), user, toDate(wsVersion.getCreated()), wsVersion.isCurrentVersion());
|
||||
listVersions.add(file);
|
||||
}
|
||||
return listVersions;
|
||||
|
|
Loading…
Reference in New Issue