moved part of types and jcr node name to constants

This commit is contained in:
lucio.lelii 2021-10-15 13:14:45 +02:00
parent be04b3d9ad
commit 3fad462d88
11 changed files with 90 additions and 41 deletions

View File

@ -18,7 +18,7 @@
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-model</artifactId>
<version>1.1.1</version>
<version>2.0.0-SNAPSHOT</version>
<name>storagehub-model</name>
<dependencyManagement>

View File

@ -4,5 +4,8 @@ public class Constants {
public static final String enchriptedPrefix = "E_";
public static final String versionPrefix = "_v";
public static final String mongoStorageConstant = "gcube-mongo";
}

View File

@ -10,4 +10,36 @@ public class NodeConstants {
public static final String USERS_NAME ="hl:users";
public static final String EXTERNALREPOSITORY_NAME ="hl:externalRepository";
public static final String PROPERTY_NAME ="hl:property";
public static final String PUBLIC = "hl:isPublic";
public static final String TITLE ="jcr:title";
public static final String DESCRIPTION = "jcr:description";
public static final String LASTMODIFIEDBY = "jcr:lastModifiedBy";
public static final String LASTMODIFIEDTIME = "jcr:lastModified";
public static final String CREATEDTIME = "jcr:created";
public static final String PORTALLOGIN = "hl:portalLogin";
public static final String LASTACTION = "hl:lastAction";
public static final String HIDDEN = "hl:hidden";
public static final String EXTERNALFOLDERPLUGIN ="hl:pluginName";
public static final String SHAREDFOLDERPRIVILEGE = "hl:privilege";
public static final String VREFOLDERCHECK = "hl:isVreFolder";
public static final String DISPLAYNAME = "hl:displayName";
public static final String UNIQUEID = "hl:uuid";
public static final String CONTENTSIZE = "hl:size";
public static final String CONTENTDATA ="jcr:data";
public static final String CONTENTREMOTEPATH = "hl:remotePath";
public static final String CONTENTMYMETYPE = "jcr:mimeType";
public static final String CONTENTID = "hl:storageId";
public static final String STORAGENAME = "hl:storageName";
//TYPE
public static final String SHAREDFOLDERTYPE = "nthl:workspaceSharedItem";
public static final String MESSAGETYPE = "nthl:itemSentRequest";
public static final String OWNERNODETYPE = "nthl:user";
public static final String GENERICFILETYPE = "nthl:externalFile";
public static final String CONTENTFILETYPE = "nthl:file";
}

View File

@ -11,4 +11,5 @@ public @interface Attribute {
String value();
boolean isReadOnly() default false;
String defaultValue() default "";
}

View File

@ -1,6 +1,6 @@
package org.gcube.common.storagehub.model.items;
import static org.gcube.common.storagehub.model.NodeConstants.PARAMETERS_NAME;
import static org.gcube.common.storagehub.model.NodeConstants.*;
import org.gcube.common.storagehub.model.Metadata;
import org.gcube.common.storagehub.model.annotations.Attribute;
@ -19,7 +19,7 @@ import lombok.Setter;
@RootNode("nthl:externalFolder")
public class ExternalFolder extends FolderItem {
@Attribute("hl:pluginName")
@Attribute(EXTERNALFOLDERPLUGIN)
String managedBy;
@JsonIgnore

View File

@ -1,6 +1,6 @@
package org.gcube.common.storagehub.model.items;
import org.gcube.common.storagehub.model.NodeConstants;
import static org.gcube.common.storagehub.model.NodeConstants.*;
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
import org.gcube.common.storagehub.model.annotations.RootNode;
import org.gcube.common.storagehub.model.items.nodes.Content;
@ -14,12 +14,12 @@ import lombok.Setter;
@AllArgsConstructor
@Getter
@Setter
@RootNode("nthl:externalFile")
@RootNode(GENERICFILETYPE)
public class GenericFileItem extends AbstractFileItem{
@NodeAttribute(value =NodeConstants.CONTENT_NAME)
@NodeAttribute(value =CONTENT_NAME)
Content content;
}

View File

@ -1,8 +1,17 @@
package org.gcube.common.storagehub.model.items;
import static org.gcube.common.storagehub.model.NodeConstants.ACCOUNTING_NAME;
import static org.gcube.common.storagehub.model.NodeConstants.CREATEDTIME;
import static org.gcube.common.storagehub.model.NodeConstants.DESCRIPTION;
import static org.gcube.common.storagehub.model.NodeConstants.HIDDEN;
import static org.gcube.common.storagehub.model.NodeConstants.LASTACTION;
import static org.gcube.common.storagehub.model.NodeConstants.LASTMODIFIEDBY;
import static org.gcube.common.storagehub.model.NodeConstants.LASTMODIFIEDTIME;
import static org.gcube.common.storagehub.model.NodeConstants.METADATA_NAME;
import static org.gcube.common.storagehub.model.NodeConstants.OWNER_NAME;
import static org.gcube.common.storagehub.model.NodeConstants.PORTALLOGIN;
import static org.gcube.common.storagehub.model.NodeConstants.PUBLIC;
import static org.gcube.common.storagehub.model.NodeConstants.TITLE;
import java.util.Calendar;
@ -13,7 +22,6 @@ import org.gcube.common.storagehub.model.items.nodes.Accounting;
import org.gcube.common.storagehub.model.items.nodes.Owner;
import org.gcube.common.storagehub.model.types.ItemAction;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
@ -28,39 +36,37 @@ public class Item extends RootItem{
boolean trashed;
//TODO: remove on next release
@JsonIgnore
boolean externalManaged = false;
boolean shared;
boolean locked;
@Attribute("hl:isPublic")
@Attribute(PUBLIC)
boolean publicItem;
@Attribute(value ="jcr:title")
@Attribute(TITLE)
String title;
@Attribute("jcr:description")
@Attribute(DESCRIPTION)
String description;
@Attribute("jcr:lastModifiedBy")
@Attribute(LASTMODIFIEDBY)
String lastModifiedBy;
@Attribute("jcr:lastModified")
@Attribute(LASTMODIFIEDTIME)
Calendar lastModificationTime;
@Attribute(value = "jcr:created", isReadOnly=true)
@Attribute(value = CREATEDTIME, isReadOnly=true)
Calendar creationTime;
@Attribute("hl:portalLogin")
@Attribute(PORTALLOGIN)
String owner;
@Attribute("hl:lastAction")
@Attribute(LASTACTION)
ItemAction lastAction;
@Attribute("hl:hidden")
@Attribute(HIDDEN)
boolean hidden;
@NodeAttribute(value=OWNER_NAME, isReadOnly=true)

View File

@ -5,7 +5,7 @@ import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.Metadata;
import org.gcube.common.storagehub.model.NodeConstants;
import static org.gcube.common.storagehub.model.NodeConstants.*;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
import org.gcube.common.storagehub.model.annotations.RootNode;
@ -13,19 +13,19 @@ import org.gcube.common.storagehub.model.annotations.RootNode;
@NoArgsConstructor
@Getter
@Setter
@RootNode("nthl:workspaceSharedItem")
@RootNode(SHAREDFOLDERTYPE)
public class SharedFolder extends FolderItem {
@Attribute("hl:privilege")
@Attribute(SHAREDFOLDERPRIVILEGE)
String privilege;
@Attribute("hl:isVreFolder")
@Attribute(VREFOLDERCHECK)
boolean vreFolder;
@Attribute("hl:displayName")
@Attribute(DISPLAYNAME)
String displayName;
@NodeAttribute(NodeConstants.USERS_NAME)
@NodeAttribute(USERS_NAME)
Metadata users;
/* @NodeAttribute("hl:members")

View File

@ -1,37 +1,44 @@
package org.gcube.common.storagehub.model.items.nodes;
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTDATA;
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTFILETYPE;
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTID;
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTMYMETYPE;
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTREMOTEPATH;
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTSIZE;
import static org.gcube.common.storagehub.model.NodeConstants.STORAGENAME;
import org.gcube.common.storagehub.model.Constants;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@AttributeRootNode(value="nthl:file")
@AttributeRootNode(CONTENTFILETYPE)
public class Content {
@Attribute("hl:size")
@Attribute(CONTENTSIZE)
Long size;
@Attribute("jcr:data")
@Attribute(CONTENTDATA)
String data;
@Attribute("hl:remotePath")
@Attribute(CONTENTREMOTEPATH)
String remotePath;
@Attribute("jcr:mimeType")
@Attribute(CONTENTMYMETYPE)
String mimeType;
@Attribute("hl:storageId")
@Attribute(CONTENTID)
String storageId;
@JsonIgnore
@Attribute("hl:storageName")
@Attribute(value= STORAGENAME, defaultValue = Constants.mongoStorageConstant)
String managedBy;
}

View File

@ -2,7 +2,7 @@ package org.gcube.common.storagehub.model.items.nodes;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
import static org.gcube.common.storagehub.model.NodeConstants.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@ -12,12 +12,12 @@ import lombok.Setter;
@Setter
@NoArgsConstructor
@AllArgsConstructor
@AttributeRootNode(value="nthl:user")
@AttributeRootNode(OWNERNODETYPE)
public class Owner {
@Attribute("hl:portalLogin")
@Attribute(PORTALLOGIN)
String userName;
@Attribute("hl:uuid")
@Attribute(UNIQUEID)
String userId;
}

View File

@ -1,6 +1,6 @@
package org.gcube.common.storagehub.model.messages;
import static org.gcube.common.storagehub.model.NodeConstants.OWNER_NAME;
import static org.gcube.common.storagehub.model.NodeConstants.*;
import java.util.Calendar;
@ -17,7 +17,7 @@ import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@RootNode("nthl:itemSentRequest")
@RootNode(MESSAGETYPE)
public class Message extends RootItem{
boolean withAttachments;