in progess on #21388
This commit is contained in:
parent
cc17be1761
commit
996c982b39
|
@ -3,7 +3,6 @@ package org.gcube.portlets.user.workspace.client.model;
|
|||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategorySmartFolder;
|
||||
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
|
||||
|
@ -16,13 +15,12 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
|||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class FileModel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||
* Sep 15, 2016
|
||||
* Sep 15, 2016
|
||||
*/
|
||||
public class FileModel extends BaseModelData implements Serializable, IsSerializable {
|
||||
|
||||
|
@ -31,8 +29,8 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected GXTFolderItemTypeEnum folderItemType; //It's here to serialization don't remove
|
||||
protected GXTCategorySmartFolder smartFolders; //It's here to serialization don't remove
|
||||
protected GXTFolderItemTypeEnum folderItemType; // It's here to serialization don't remove
|
||||
protected GXTCategorySmartFolder smartFolders; // It's here to serialization don't remove
|
||||
protected InfoContactModel infoContacts;
|
||||
protected boolean isRoot = false;
|
||||
protected boolean isVreFolder;
|
||||
|
@ -55,23 +53,23 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
public static final String OWNERFULLNAME = "Owner Name";
|
||||
public static final String HUMAN_REDABLE_CATEGORY = "HR Category";
|
||||
|
||||
//Thredds Synch status
|
||||
private Sync_Status synchedThreddsStatus;
|
||||
// Synched with thredds
|
||||
private Boolean synchedWithWsThredds = null;
|
||||
|
||||
/**
|
||||
* Instantiates a new file model.
|
||||
*/
|
||||
protected FileModel(){
|
||||
protected FileModel() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new file model.
|
||||
*
|
||||
* @param identifier the identifier
|
||||
* @param name the name
|
||||
* @param parent the parent
|
||||
* @param identifier the identifier
|
||||
* @param name the name
|
||||
* @param parent the parent
|
||||
* @param isDirectory the is directory
|
||||
* @param isShared the is shared
|
||||
* @param isShared the is shared
|
||||
*/
|
||||
public FileModel(String identifier, String name, FileModel parent, boolean isDirectory, boolean isShared) {
|
||||
setIdentifier(identifier);
|
||||
|
@ -85,8 +83,8 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
/**
|
||||
* USED FOR ATTACHMENTS AND FolderBulkCreator.
|
||||
*
|
||||
* @param identifier the identifier
|
||||
* @param name the name
|
||||
* @param identifier the identifier
|
||||
* @param name the name
|
||||
* @param isDirectory the is directory
|
||||
*/
|
||||
public FileModel(String identifier, String name, boolean isDirectory) {
|
||||
|
@ -99,7 +97,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
/**
|
||||
* Inits the default properties.
|
||||
*/
|
||||
protected void initDefaultProperties(){
|
||||
protected void initDefaultProperties() {
|
||||
setShortcutCategory(GXTCategorySmartFolder.SMF_UNKNOWN);
|
||||
setShareable(true);
|
||||
}
|
||||
|
@ -110,7 +108,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
* @param bool the new shareable
|
||||
*/
|
||||
public void setShareable(boolean bool) {
|
||||
set(ConstantsExplorer.ISSHAREABLE,bool);
|
||||
set(ConstantsExplorer.ISSHAREABLE, bool);
|
||||
|
||||
}
|
||||
|
||||
|
@ -119,7 +117,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @param description the new description
|
||||
*/
|
||||
public void setDescription(String description){
|
||||
public void setDescription(String description) {
|
||||
set(ConstantsExplorer.DIRECTORYDESCRIPTION, description);
|
||||
}
|
||||
|
||||
|
@ -128,7 +126,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription(){
|
||||
public String getDescription() {
|
||||
return get(ConstantsExplorer.DIRECTORYDESCRIPTION);
|
||||
}
|
||||
|
||||
|
@ -139,7 +137,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*/
|
||||
public boolean isShareable() {
|
||||
Object sharable = get(ConstantsExplorer.ISSHAREABLE);
|
||||
if(sharable!=null)
|
||||
if (sharable != null)
|
||||
return (Boolean) sharable;
|
||||
return false;
|
||||
}
|
||||
|
@ -147,14 +145,15 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
/**
|
||||
* Instantiates a new file model.
|
||||
*
|
||||
* @param identifier the identifier
|
||||
* @param name the name
|
||||
* @param type the type
|
||||
* @param identifier the identifier
|
||||
* @param name the name
|
||||
* @param type the type
|
||||
* @param folderItemTypeEnum the folder item type enum
|
||||
* @param isDirectory the is directory
|
||||
* @param isShared the is shared
|
||||
* @param isDirectory the is directory
|
||||
* @param isShared the is shared
|
||||
*/
|
||||
public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum, boolean isDirectory, boolean isShared) {
|
||||
public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum,
|
||||
boolean isDirectory, boolean isShared) {
|
||||
setIdentifier(identifier);
|
||||
setName(name);
|
||||
setType(type);
|
||||
|
@ -170,14 +169,12 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
* @param parent the new parent file model
|
||||
*/
|
||||
public void setParentFileModel(FileModel parent) {
|
||||
set(PARENT,parent);
|
||||
set(PARENT, parent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Status values
|
||||
* ConstantsExplorer.FOLDERNOTLOAD = "notload";
|
||||
* ConstantsExplorer.FOLDERLOADED = "loaded";
|
||||
* Status values ConstantsExplorer.FOLDERNOTLOAD = "notload";
|
||||
* ConstantsExplorer.FOLDERLOADED = "loaded";
|
||||
*
|
||||
* @param status the new status
|
||||
*/
|
||||
|
@ -192,9 +189,9 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
|
||||
Image icon = (Image) get(ICON);
|
||||
AbstractImagePrototype iconAbs;
|
||||
if(icon==null){
|
||||
if (icon == null) {
|
||||
iconAbs = getAbstractPrototypeIcon();
|
||||
}else
|
||||
} else
|
||||
return;
|
||||
|
||||
set(ICON, iconAbs.createImage());
|
||||
|
@ -206,7 +203,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @param fullName the new owner full name
|
||||
*/
|
||||
public void setOwnerFullName(String fullName){
|
||||
public void setOwnerFullName(String fullName) {
|
||||
set(FileModel.OWNERFULLNAME, fullName);
|
||||
}
|
||||
|
||||
|
@ -215,17 +212,17 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @return the owner full name
|
||||
*/
|
||||
public String getOwnerFullName(){
|
||||
public String getOwnerFullName() {
|
||||
return get(FileModel.OWNERFULLNAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sharing value.
|
||||
*
|
||||
* @param isShared the is shared
|
||||
* @param isShared the is shared
|
||||
* @param listShareUsers the list share users
|
||||
*/
|
||||
public void setSharingValue(boolean isShared, List<InfoContactModel> listShareUsers){
|
||||
public void setSharingValue(boolean isShared, List<InfoContactModel> listShareUsers) {
|
||||
set(ISSHARED, isShared);
|
||||
set(SHAREUSERS, listShareUsers);
|
||||
}
|
||||
|
@ -236,7 +233,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
* @return the list user sharing
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<InfoContactModel> getListUserSharing(){
|
||||
public List<InfoContactModel> getListUserSharing() {
|
||||
return (List<InfoContactModel>) get(SHAREUSERS);
|
||||
}
|
||||
|
||||
|
@ -245,7 +242,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @param listShareUsers the new list share user
|
||||
*/
|
||||
public void setListShareUser(List<InfoContactModel> listShareUsers){
|
||||
public void setListShareUser(List<InfoContactModel> listShareUsers) {
|
||||
set(SHAREUSERS, listShareUsers);
|
||||
}
|
||||
|
||||
|
@ -254,9 +251,9 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @return true, if is shared
|
||||
*/
|
||||
public boolean isShared(){
|
||||
public boolean isShared() {
|
||||
Object shared = get(ISSHARED);
|
||||
if(shared!=null)
|
||||
if (shared != null)
|
||||
return (Boolean) shared;
|
||||
return false;
|
||||
}
|
||||
|
@ -266,7 +263,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @return true, if is root
|
||||
*/
|
||||
public boolean isRoot(){
|
||||
public boolean isRoot() {
|
||||
return isRoot;
|
||||
}
|
||||
|
||||
|
@ -275,11 +272,10 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @param isRoot the new checks if is root
|
||||
*/
|
||||
public void setIsRoot(boolean isRoot){
|
||||
public void setIsRoot(boolean isRoot) {
|
||||
this.isRoot = isRoot;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the icon.
|
||||
*
|
||||
|
@ -296,61 +292,56 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*/
|
||||
public AbstractImagePrototype getAbstractPrototypeIcon() {
|
||||
|
||||
GWT.log("My prop: "+this.toString());
|
||||
GWT.log("My prop: " + this.toString());
|
||||
|
||||
AbstractImagePrototype absImgPr = Resources.getIconTable();
|
||||
|
||||
if (!this.isDirectory()) { //IS FILE
|
||||
if(this.getType()!=null)
|
||||
if (!this.isDirectory()) { // IS FILE
|
||||
if (this.getType() != null)
|
||||
absImgPr = Resources.getIconByType(this.getName(), this.getType());
|
||||
else
|
||||
absImgPr = Resources.getIconByFolderItemType(this.getGXTFolderItemType());
|
||||
|
||||
}else if(this.isShared()){ //IS A SHARED FOLDER?
|
||||
} else if (this.isShared()) { // IS A SHARED FOLDER?
|
||||
|
||||
//GWT.log("setting icon "+this.getName()+" is shared: "+this.isShared() + ", this.isVreFolder() "+this.isVreFolder() +", this.isShareable() "+this.isShareable());
|
||||
// GWT.log("setting icon "+this.getName()+" is shared: "+this.isShared() + ",
|
||||
// this.isVreFolder() "+this.isVreFolder() +", this.isShareable()
|
||||
// "+this.isShareable());
|
||||
|
||||
if(this.isVreFolder())
|
||||
absImgPr = Resources.getIconVREFolder();
|
||||
else{
|
||||
if(this.isShareable()){ //IS ROOT SHARED FOLDER
|
||||
if(this.isPublic()) //IS PLUBIC
|
||||
absImgPr = Resources.getIconFolderSharedPublic();
|
||||
if (this.isVreFolder())
|
||||
absImgPr = Resources.getIconVREFolder();
|
||||
else {
|
||||
if (this.isShareable()) { // IS ROOT SHARED FOLDER
|
||||
if (this.isPublic()) // IS PLUBIC
|
||||
absImgPr = Resources.getIconFolderSharedPublic();
|
||||
else
|
||||
absImgPr = Resources.getIconSharedFolder();
|
||||
}else{ //IS A DESCENDANT
|
||||
if(this.isPublic()) //IS PLUBIC
|
||||
absImgPr = Resources.getIconSharedFolder();
|
||||
} else { // IS A DESCENDANT
|
||||
if (this.isPublic()) // IS PLUBIC
|
||||
absImgPr = Resources.getIconFolderPublic();
|
||||
else
|
||||
absImgPr = Resources.getIconSharedFolder(); //IS A SHARED FOLDER DESCENDANT OF ROOT SHARED FOLDER
|
||||
absImgPr = Resources.getIconSharedFolder(); // IS A SHARED FOLDER DESCENDANT OF ROOT SHARED
|
||||
// FOLDER
|
||||
}
|
||||
}
|
||||
|
||||
}else if(this.getStatus() == ConstantsExplorer.FOLDERNOTLOAD){ //IS A FOLDER IN LOADING
|
||||
} else if (this.getStatus() == ConstantsExplorer.FOLDERNOTLOAD) { // IS A FOLDER IN LOADING
|
||||
absImgPr = Resources.getIconLoading2();
|
||||
|
||||
}else{
|
||||
//SPECIAL FOLDER?
|
||||
if(this.isSpecialFolder())
|
||||
} else {
|
||||
// SPECIAL FOLDER?
|
||||
if (this.isSpecialFolder())
|
||||
absImgPr = Resources.getIconSpecialFolder();
|
||||
else{ //SIMPLE FOLDER
|
||||
if(this.isPublic()) //IS PLUBIC
|
||||
absImgPr = Resources.getIconFolderPublic();
|
||||
else { // SIMPLE FOLDER
|
||||
if (this.isPublic()) // IS PLUBIC
|
||||
absImgPr = Resources.getIconFolderPublic();
|
||||
else {
|
||||
if(this.getSynchedThreddsStatus()!=null) {
|
||||
switch(this.getSynchedThreddsStatus()) {
|
||||
case OUTDATED_REMOTE:
|
||||
absImgPr = Resources.getIconSyncTo();
|
||||
break;
|
||||
case OUTDATED_WS:
|
||||
absImgPr = Resources.getIconSyncFrom();
|
||||
break;
|
||||
case UP_TO_DATE:
|
||||
absImgPr = Resources.getIconSynched();
|
||||
break;
|
||||
if (this.getSynchedWithWsThredds() != null) {
|
||||
if(this.getSynchedWithWsThredds()) {
|
||||
absImgPr = Resources.getIconSyncTo();
|
||||
}
|
||||
}else
|
||||
absImgPr = Resources.getIconFolder();
|
||||
} else
|
||||
absImgPr = Resources.getIconFolder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -358,7 +349,6 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
return absImgPr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the status.
|
||||
*
|
||||
|
@ -368,13 +358,12 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
return get("status");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the checks if is directory.
|
||||
*
|
||||
* @param flag the new checks if is directory
|
||||
*/
|
||||
public void setIsDirectory(boolean flag){
|
||||
public void setIsDirectory(boolean flag) {
|
||||
set(ISDIRECTORY, flag);
|
||||
}
|
||||
|
||||
|
@ -392,7 +381,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @return the identifier
|
||||
*/
|
||||
public String getIdentifier(){
|
||||
public String getIdentifier() {
|
||||
return get(IDENTIFIER);
|
||||
}
|
||||
|
||||
|
@ -403,21 +392,19 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*/
|
||||
public void setShortcutCategory(GXTCategorySmartFolder smfDocuments) {
|
||||
set(SHORTCUTCATEGORY, smfDocuments);
|
||||
if(smfDocuments!=null)
|
||||
if (smfDocuments != null)
|
||||
set(HUMAN_REDABLE_CATEGORY, smfDocuments.getValue());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the shortcut category.
|
||||
*
|
||||
* @return the shortcut category
|
||||
*/
|
||||
public GXTCategorySmartFolder getShortcutCategory(){
|
||||
public GXTCategorySmartFolder getShortcutCategory() {
|
||||
return (GXTCategorySmartFolder) get(SHORTCUTCATEGORY);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
|
@ -441,7 +428,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @return the parent file model
|
||||
*/
|
||||
public FileModel getParentFileModel(){
|
||||
public FileModel getParentFileModel() {
|
||||
return (FileModel) get(PARENT);
|
||||
}
|
||||
|
||||
|
@ -450,14 +437,16 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @return true, if is directory
|
||||
*/
|
||||
public boolean isDirectory(){
|
||||
public boolean isDirectory() {
|
||||
Object directory = get(ISDIRECTORY);
|
||||
if(directory!=null)
|
||||
if (directory != null)
|
||||
return (Boolean) directory;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
/**
|
||||
|
@ -489,7 +478,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @param type the new type
|
||||
*/
|
||||
public void setType(String type){
|
||||
public void setType(String type) {
|
||||
set(TYPE, type);
|
||||
}
|
||||
|
||||
|
@ -498,7 +487,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @return the type
|
||||
*/
|
||||
public String getType(){
|
||||
public String getType() {
|
||||
return get(TYPE);
|
||||
}
|
||||
|
||||
|
@ -507,7 +496,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @param folderItemTypeEnum the new folder item type
|
||||
*/
|
||||
public void setFolderItemType(GXTFolderItemTypeEnum folderItemTypeEnum){
|
||||
public void setFolderItemType(GXTFolderItemTypeEnum folderItemTypeEnum) {
|
||||
set(FOLDERITEMTYPE, folderItemTypeEnum);
|
||||
}
|
||||
|
||||
|
@ -516,7 +505,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @return the GXT folder item type
|
||||
*/
|
||||
public GXTFolderItemTypeEnum getGXTFolderItemType(){
|
||||
public GXTFolderItemTypeEnum getGXTFolderItemType() {
|
||||
return (GXTFolderItemTypeEnum) get(FOLDERITEMTYPE);
|
||||
}
|
||||
|
||||
|
@ -571,21 +560,31 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
*
|
||||
* @return true, if is public
|
||||
*/
|
||||
public boolean isPublic(){
|
||||
public boolean isPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setSyncThreddsStatus(Sync_Status status) {
|
||||
this.synchedThreddsStatus = status;
|
||||
/**
|
||||
* Sets the synched with ws thredds.
|
||||
*
|
||||
* @param bool the new synched with ws thredds
|
||||
*/
|
||||
public void setSynchedWithWsThredds(Boolean bool) {
|
||||
this.synchedWithWsThredds = bool;
|
||||
}
|
||||
|
||||
public Sync_Status getSynchedThreddsStatus() {
|
||||
return synchedThreddsStatus;
|
||||
/**
|
||||
* Gets the synched with ws thredds.
|
||||
*
|
||||
* @return the synched with ws thredds
|
||||
*/
|
||||
public Boolean getSynchedWithWsThredds() {
|
||||
return synchedWithWsThredds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
/**
|
||||
|
@ -620,5 +619,4 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
|||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -412,11 +412,11 @@ public interface Icons extends ClientBundle {
|
|||
@Source("icons/sync-icon-to.png")
|
||||
ImageResource syncIconTo();
|
||||
|
||||
@Source("icons/sync-icon-from.png")
|
||||
ImageResource syncIconFrom();
|
||||
|
||||
@Source("icons/sync-icon-synched.png")
|
||||
ImageResource syncIconSynched();
|
||||
// @Source("icons/sync-icon-from.png")
|
||||
// ImageResource syncIconFrom();
|
||||
//
|
||||
// @Source("icons/sync-icon-synched.png")
|
||||
// ImageResource syncIconSynched();
|
||||
|
||||
@Source("icons/no-preview-available.png")
|
||||
ImageResource previewNotAvailable();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
File diff suppressed because it is too large
Load Diff
|
@ -114,11 +114,11 @@ public class DialogGetInfo extends Dialog {
|
|||
txtIsPublic.setValue(fileModel.isPublic() + "");
|
||||
add(txtIsPublic);
|
||||
|
||||
if (fileModel.getSynchedThreddsStatus() != null) {
|
||||
if (fileModel.getSynchedWithWsThredds() != null) {
|
||||
txtThreddsSynched = new TextField<String>();
|
||||
txtThreddsSynched.setFieldLabel("Thredds Sync");
|
||||
txtThreddsSynched.setFieldLabel("Synched with Thredds");
|
||||
txtThreddsSynched.setReadOnly(true);
|
||||
txtThreddsSynched.setValue(fileModel.getSynchedThreddsStatus() + "");
|
||||
txtThreddsSynched.setValue(fileModel.getSynchedWithWsThredds() + "");
|
||||
add(txtThreddsSynched);
|
||||
|
||||
}
|
||||
|
|
|
@ -295,10 +295,12 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
cgTxtIsPublic.setVisible(true);
|
||||
htmlSetValue(txtIsPublic, fileModel.isPublic() + "");
|
||||
|
||||
if (fileModel.getSynchedThreddsStatus() != null) {
|
||||
txtThreddsSynched.setVisible(true);
|
||||
htmlSetValue(txtThreddsSynched, fileModel.getSynchedThreddsStatus() + "");
|
||||
txtThreddsSynched.setHTML(fileModel.getSynchedThreddsStatus() + "");
|
||||
if (fileModel.getSynchedWithWsThredds() != null) {
|
||||
if (fileModel.getSynchedWithWsThredds()) {
|
||||
txtThreddsSynched.setVisible(true);
|
||||
htmlSetValue(txtThreddsSynched, fileModel.getSynchedWithWsThredds() + "");
|
||||
txtThreddsSynched.setHTML(fileModel.getSynchedWithWsThredds() + "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<b:ControlGroup
|
||||
addStyleNames="my-control-group-get-info"
|
||||
ui:field="cgThreddsSynched" visible="false">
|
||||
<b:ControlLabel>Thredds Sync</b:ControlLabel>
|
||||
<b:ControlLabel>Synched with Thredds</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<g:HTML ui:field="txtThreddsSynched">
|
||||
</g:HTML>
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.gcube.common.storagehubwrapper.shared.tohl.items.URLFileItem;
|
|||
import org.gcube.common.storagehubwrapper.shared.tohl.items.URLItem;
|
||||
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||
import org.gcube.portal.wssynclibrary.shared.WorkspaceFolderLocked;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
|
||||
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
||||
|
|
|
@ -29,27 +29,34 @@ import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
|||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.impl.URLFile;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFileVersion;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.GCubeItem;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.PropertyMap;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategorySmartFolder;
|
||||
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileVersionModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FolderGridModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FolderModel;
|
||||
import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
|
||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||
import org.gcube.usecases.ws.thredds.faults.WorkspaceNotSynchedException;
|
||||
import org.gcube.usecases.ws.thredds.model.ContainerType;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
|
||||
/**
|
||||
* The Class StorageHubToWorkpaceConverter.
|
||||
*
|
||||
|
@ -136,9 +143,8 @@ public class StorageHubToWorkpaceConverter implements Serializable {
|
|||
public FileModel toTreeFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
|
||||
FileModel parentFolderModel, Boolean isParentShared) throws InternalErrorException {
|
||||
|
||||
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel,
|
||||
isParentShared);
|
||||
return setSynchedThreddsStateFor(fileModel, wrappedItem);
|
||||
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared);
|
||||
return setSynchedWithWsThredds(fileModel, wrappedItem);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -152,35 +158,64 @@ public class StorageHubToWorkpaceConverter implements Serializable {
|
|||
public FileGridModel toGridFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
|
||||
FileModel parentFolderModel) throws InternalErrorException {
|
||||
|
||||
FileGridModel fileGridModel = ObjectStorageHubToWorkpaceMapper.toGridFileModelItem(wrappedItem,
|
||||
parentFolderModel, loggedUser);
|
||||
return (FileGridModel) setSynchedThreddsStateFor(fileGridModel, wrappedItem);
|
||||
FileGridModel fileGridModel = ObjectStorageHubToWorkpaceMapper.toGridFileModelItem(wrappedItem, parentFolderModel, loggedUser);
|
||||
return (FileGridModel) setSynchedWithWsThredds(fileGridModel, wrappedItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the synched thredds state for.
|
||||
*
|
||||
* @param fileModel the file model
|
||||
* @param wrappedItem item
|
||||
* @return the file model
|
||||
*/
|
||||
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, WorkspaceItem wrappedItem) {
|
||||
|
||||
|
||||
protected FileModel setSynchedWithWsThredds(FileModel fileModel, WorkspaceItem wrappedItem) {
|
||||
logger.debug("called setSynchedThreddsStateFor item id: " + wrappedItem.getId());
|
||||
Sync_Status status = null;
|
||||
|
||||
boolean isItemSynched = false;
|
||||
try {
|
||||
status = WorkspaceThreddsSynchronize.getInstance().getInfo(wrappedItem.getId());
|
||||
logger.debug("item id: " + wrappedItem.getId() + " has ws-thredds sync status: " + status);
|
||||
} catch (WorkspaceNotSynchedException e) {
|
||||
|
||||
logger.debug("WorkspaceNotSynchedException catched, the item with id: " + wrappedItem.getId()
|
||||
+ " is not synched");
|
||||
Map<String, Object> mapProperties = wrappedItem.getPropertyMap().getValues();
|
||||
ContainerType containerItemType = null;
|
||||
|
||||
// is it a directory?
|
||||
if (fileModel.isDirectory()) {
|
||||
containerItemType = ContainerType.FOLDER;
|
||||
}
|
||||
|
||||
// checking other cases
|
||||
if (containerItemType == null) {
|
||||
switch (wrappedItem.getType()) {
|
||||
case FOLDER:
|
||||
case VRE_FOLDER:
|
||||
case SHARED_FOLDER:
|
||||
case SMART_FOLDER:
|
||||
containerItemType = ContainerType.FOLDER;
|
||||
break;
|
||||
|
||||
case FILE_ITEM:
|
||||
containerItemType = ContainerType.FILE;
|
||||
break;
|
||||
|
||||
case URL_ITEM:
|
||||
containerItemType = ContainerType.URL;
|
||||
break;
|
||||
|
||||
default:
|
||||
containerItemType = ContainerType.GENERIC_ITEM;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
logger.debug(
|
||||
"calling isItemSynched for id: " + wrappedItem.getId() + ", with name: " + wrappedItem.getName()
|
||||
+ ", with map: " + mapProperties + ", containerItemType: " + containerItemType);
|
||||
isItemSynched = WorkspaceThreddsSynchronize.getInstance().isItemSynched(wrappedItem.getId(), mapProperties,
|
||||
containerItemType);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.info(
|
||||
"Error on getting configuration for the item id: " + wrappedItem.getId() + ", (means not synched)");
|
||||
logger.info("Error on calling isItemSynched for the item id: " + wrappedItem.getId()
|
||||
+ ", (means not synched)");
|
||||
}
|
||||
|
||||
fileModel.setSyncThreddsStatus(status);
|
||||
logger.debug("the item id: " + wrappedItem.getId() + " with name: " + wrappedItem.getName() + " is synched: "
|
||||
+ isItemSynched);
|
||||
fileModel.setSynchedWithWsThredds(isItemSynched);
|
||||
|
||||
return fileModel;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue