This commit is contained in:
Lucio Lelii 2018-02-15 17:14:30 +00:00
parent 18ca8db83d
commit 2820a7f77a
46 changed files with 1901 additions and 0 deletions

36
.classpath Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

23
.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>storagehub-model</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -0,0 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

75
pom.xml Normal file
View File

@ -0,0 +1,75 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
<relativePath />
</parent>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-model</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>storagehub-model</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>LATEST</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.14.8</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<target>1.8</target>
<source>1.8</source>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,19 @@
package org.gcube.common.storagehub.model;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.MapAttribute;
@Getter
@Setter
@NoArgsConstructor
public class Metadata {
@MapAttribute(excludeStartWith="jcr:")
Map<String, Object> value = new HashMap<String, Object>();
}

View File

@ -0,0 +1,46 @@
package org.gcube.common.storagehub.model;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
public class Path {
protected List<String> paths = null;
private Path(){}
protected Path(String path){
if (!(path==null || path.isEmpty()))
paths = Arrays.asList(path.split("/")).stream().filter(s -> !s.isEmpty()).collect(Collectors.toList());
}
public String toPath(){
if (paths ==null || paths.isEmpty()) return "/";
else return "/"+paths.stream().collect(Collectors.joining("/"))+"/";
}
public String getLastDirName(){
return paths.get(paths.size()-1);
}
protected Path append(Path anotherPath){
Path path = new Path();
path.paths = new LinkedList<String>(this.paths);
if (anotherPath.paths!=null)
path.paths.addAll(anotherPath.paths);
return path;
}
protected Path append(String anotherPath){
return this.append(new Path(anotherPath));
}
protected Path remove(Path anotherPath){
Path path = new Path();
path.paths = new LinkedList<String>(this.paths);
path.paths.removeAll(anotherPath.paths);
return path;
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.common.storagehub.model;
public class Paths {
public static Path getPath(String path){
return new Path(path);
}
public static Path append(Path path, Path anotherPath){
return path.append(anotherPath);
}
public static Path append(Path path, String anotherPath){
return path.append(anotherPath);
}
public static Path remove(Path path, Path anotherPath){
return path.remove(anotherPath);
}
}

View File

@ -0,0 +1,13 @@
package org.gcube.common.storagehub.model.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Attribute {
String value();
}

View File

@ -0,0 +1,14 @@
package org.gcube.common.storagehub.model.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface AttributeRootNode {
String value();
boolean isContentNode() default false;
}

View File

@ -0,0 +1,13 @@
package org.gcube.common.storagehub.model.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ItemElement {
String type();
}

View File

@ -0,0 +1,15 @@
package org.gcube.common.storagehub.model.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ListNodes {
String includeTypeStartWith() default "";
String excludeTypeStartWith() default "";
Class<?> listClass();
}

View File

@ -0,0 +1,13 @@
package org.gcube.common.storagehub.model.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface MapAttribute {
String excludeStartWith() default "";
}

View File

@ -0,0 +1,15 @@
package org.gcube.common.storagehub.model.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface NodeAttribute {
String value();
boolean isReadOnly() default false;
}

View File

@ -0,0 +1,13 @@
package org.gcube.common.storagehub.model.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface RootNode {
String[] value();
}

View File

@ -0,0 +1,9 @@
package org.gcube.common.storagehub.model.items;
import org.gcube.common.storagehub.model.items.nodes.Content;
public abstract class AbstractFileItem extends Item{
public abstract Content getContent();
}

View File

@ -0,0 +1,17 @@
package org.gcube.common.storagehub.model.items;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.RootNode;
@NoArgsConstructor
@Getter
@Setter
@RootNode("nthl:workspaceItem")
public class FolderItem extends Item {
}

View File

@ -0,0 +1,36 @@
package org.gcube.common.storagehub.model.items;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.Metadata;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
import org.gcube.common.storagehub.model.annotations.RootNode;
@NoArgsConstructor
@Getter
@Setter
@RootNode("nthl:gCubeItem")
public class GCubeItem extends Item{
@Attribute("hl:scopes")
String[] scopes;
@Attribute("hl:creator")
String creator;
@Attribute("hl:itemType")
String itemType;
@Attribute("hl:properties")
String properties;
@Attribute("hl:isShared")
Boolean shared;
@NodeAttribute("hl:property")
Metadata property;
}

View File

@ -0,0 +1,22 @@
package org.gcube.common.storagehub.model.items;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
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;
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@RootNode("nthl:externalFile")
public class GenericFileItem extends AbstractFileItem{
@NodeAttribute(value ="jcr:content")
Content content;
}

View File

@ -0,0 +1,22 @@
package org.gcube.common.storagehub.model.items;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
import org.gcube.common.storagehub.model.annotations.RootNode;
import org.gcube.common.storagehub.model.items.nodes.ImageContent;
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@RootNode("nthl:externalImage")
public class ImageFile extends AbstractFileItem{
@NodeAttribute(value="jcr:content")
ImageContent content;
}

View File

@ -0,0 +1,73 @@
package org.gcube.common.storagehub.model.items;
import java.util.Calendar;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
import org.gcube.common.storagehub.model.items.nodes.Accounting;
import org.gcube.common.storagehub.model.types.ItemAction;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class Item {
String id;
String name;
String path;
String parentId;
String parentPath;
String primaryType;
boolean locked;
@Attribute("jcr:title")
String title;
@Attribute("jcr:description")
String description;
@Attribute("jcr:lastModifiedBy")
String lastModifiedBy;
@Attribute("jcr:lastModified")
Calendar lastModificationTime;
@Attribute("jcr:created")
Calendar creationTime;
@Attribute("hl:portalLogin")
String owner;
@Attribute("hl:lastAction")
ItemAction lastAction;
/*
@XmlElement
boolean trashed;
@XmlElement
boolean shared;
*/
@Attribute("hl:hidden")
boolean hidden;
@NodeAttribute(value="hl:accounting", isReadOnly=true)
Accounting accounting;
//List <AccountingDelegate> accounting;
}

View File

@ -0,0 +1,21 @@
package org.gcube.common.storagehub.model.items;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
import org.gcube.common.storagehub.model.annotations.RootNode;
import org.gcube.common.storagehub.model.items.nodes.PDFContent;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@RootNode({"nthl:externalPdf"})
public class PDFFileItem extends AbstractFileItem {
@NodeAttribute(value="jcr:content")
PDFContent content;
}

View File

@ -0,0 +1,30 @@
package org.gcube.common.storagehub.model.items;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.Metadata;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
import org.gcube.common.storagehub.model.annotations.RootNode;
@NoArgsConstructor
@Getter
@Setter
@RootNode("nthl:workspaceSharedItem")
public class SharedFolder extends FolderItem {
@Attribute("hl:privilege")
String privilege;
@Attribute("hl:isVreFolder")
Boolean vreFolder;
@Attribute("hl:displayName")
String displayName;
@NodeAttribute("hl:users")
Metadata users;
}

View File

@ -0,0 +1,19 @@
package org.gcube.common.storagehub.model.items;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
import org.gcube.common.storagehub.model.annotations.RootNode;
import org.gcube.common.storagehub.model.items.nodes.SmartFolderContent;
@NoArgsConstructor
@Getter
@Setter
@RootNode("nthl:workspaceSmartItem")
public class SmartFolder {
@NodeAttribute("jcr:content")
SmartFolderContent content;
}

View File

@ -0,0 +1,42 @@
package org.gcube.common.storagehub.model.items;
import java.util.Calendar;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.RootNode;
@NoArgsConstructor
@Getter
@Setter
@RootNode("nthl:trashItem")
public class TrashItem extends Item {
@Attribute("hl:name")
String name;
@Attribute("hl:deletedBy")
String deletedBy;
@Attribute("hl:originalParentId")
String originalPArentId;
@Attribute("hl:deletedFrom")
String deletedFrom;
@Attribute("hl:deletedTime")
Calendar deletedTime;
@Attribute("hl:mimeType")
String mimeType;
@Attribute("hl:length")
String lenght;
@Attribute("hl:isFolder")
Boolean folder;
}

View File

@ -0,0 +1,23 @@
package org.gcube.common.storagehub.model.items;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.RootNode;
@NoArgsConstructor
@Getter
@Setter
@RootNode("nthl:workspaceVreItem")
public class VreFolder extends SharedFolder {
@Attribute("hl:groupId")
String groupId;
@Attribute("hl:scope")
String context;
}

View File

@ -0,0 +1,24 @@
package org.gcube.common.storagehub.model.items.nodes;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
import org.gcube.common.storagehub.model.annotations.MapAttribute;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@AttributeRootNode("nthl:accountingEntry")
public class AccountEntry {
@MapAttribute
Map<String, Object> account = new HashMap<String, Object>();;
}

View File

@ -0,0 +1,19 @@
package org.gcube.common.storagehub.model.items.nodes;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
import org.gcube.common.storagehub.model.annotations.ListNodes;
@NoArgsConstructor
@Data
@AttributeRootNode("nthl:accountingSet")
public class Accounting {
@ListNodes(includeTypeStartWith="nthl:accounting", listClass=AccountEntry.class)
List<AccountEntry> entries = new ArrayList<AccountEntry>();
}

View File

@ -0,0 +1,31 @@
package org.gcube.common.storagehub.model.items.nodes;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@AttributeRootNode(value="nthl:file")
public class Content {
@Attribute("hl:size")
Long size;
@Attribute("jcr:data")
String data;
@Attribute("hl:remotePath")
String remotePath;
@Attribute("jcr:mimeType")
String mimeType;
@Attribute("hl:storageId")
String storageId;
}

View File

@ -0,0 +1,33 @@
package org.gcube.common.storagehub.model.items.nodes;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@AttributeRootNode(value="nthl:image", isContentNode=true)
public class ImageContent extends Content{
@Attribute("hl:width")
Long width;
@Attribute("hl:height")
Long height;
@Attribute("hl:thumbnailWidth")
Long thumbnailWidth;
@Attribute("hl:thumbnailHeight")
Long thumbnailHeight;
@Attribute("hl:thumbnailData")
Byte[] thumbnailData;
}

View File

@ -0,0 +1,33 @@
package org.gcube.common.storagehub.model.items.nodes;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@AttributeRootNode(value="nthl:pdf", isContentNode=true)
public class PDFContent extends Content{
@Attribute("hl:numberOfPages")
Long numberOfPages;
@Attribute("hl:version")
String version;
@Attribute("hl:author")
String author;
@Attribute("hl:title")
String title;
@Attribute("hl:producer")
String producer;
}

View File

@ -0,0 +1,25 @@
package org.gcube.common.storagehub.model.items.nodes;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@AttributeRootNode("nthl:smartFolderContent")
public class SmartFolderContent {
@Attribute("hl:query")
String query;
@Attribute("hl:folderId")
String folderId;
}

View File

@ -0,0 +1,7 @@
package org.gcube.common.storagehub.model.query;
import org.gcube.common.storagehub.model.items.Item;
public interface ItemFilter<I extends Item> {
}

View File

@ -0,0 +1,5 @@
package org.gcube.common.storagehub.model.query;
public interface OrderBy {
}

View File

@ -0,0 +1,20 @@
package org.gcube.common.storagehub.model.service;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.gcube.common.storagehub.model.items.Item;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ItemList {
@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
private List<? extends Item> itemlist;
}

View File

@ -0,0 +1,18 @@
package org.gcube.common.storagehub.model.service;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.gcube.common.storagehub.model.items.Item;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ItemWrapper<T extends Item> {
@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
private T item;
}

View File

@ -0,0 +1,65 @@
package org.gcube.common.storagehub.model.types;
public enum ContentType {
GENERAL {
@Override
public String toString() {
return "nthl:file";
}
},
IMAGE {
@Override
public String toString() {
return "nthl:image";
}
},
PDF {
@Override
public String toString() {
return "nthl:pdf";
}
},
TS {
@Override
public String toString() {
return "nthl:timeSeriesItemContent";
}
},
QUERY {
@Override
public String toString() {
return "nthl:queryItemContent";
}
},
REPORT {
@Override
public String toString() {
return "nthl:reportItemContent";
}
},
REPORT_TEMPLATE {
@Override
public String toString() {
return "nthl:reportTemplateContent";
}
},
METADATA{
@Override
public String toString() {
return "nthl:metadataItemContent";
}
},
DOCUMENT{
@Override
public String toString() {
return "nthl:documentItemContent";
}
},
SMART{
@Override
public String toString() {
return "nthl:smartFolderContent";
}
}
}

View File

@ -0,0 +1,92 @@
/**
*
*/
package org.gcube.common.storagehub.model.types;
/**
* @author Federico De Faveri defaveri@isti.cnr.it
*
*/
public enum FileItemType implements GenericItemType{
/**
* External image.
*/
EXTERNAL_IMAGE,
/**
* External file.
*/
EXTERNAL_FILE,
/**
* External PDF file.
*/
EXTERNAL_PDF_FILE,
/**
* External url.
*/
EXTERNAL_URL,
/**
* Query.
*/
QUERY,
/**
* Report template.
*/
REPORT_TEMPLATE,
/**
* Report.
*/
REPORT,
/**
* A time series.
*/
TIME_SERIES,
/**
* Document.
*/
DOCUMENT,
/**
* Image document.
*/
IMAGE_DOCUMENT,
/**
* PDF document.
*/
PDF_DOCUMENT,
/**
* Url document.
*/
URL_DOCUMENT,
/**
* Metadata.
*/
METADATA,
/**
* Trash item
*/
TRASH_ITEM,
/**
* A gCube item.
*/
GCUBE_ITEM,
/**
* Workflow report.
*/
WORKFLOW_REPORT;
}

View File

@ -0,0 +1,5 @@
package org.gcube.common.storagehub.model.types;
public interface GenericItemType {
}

View File

@ -0,0 +1,36 @@
/**
*
*/
package org.gcube.common.storagehub.model.types;
/**
* @author Federico De Faveri defaveri@isti.cnr.it
*
*/
public enum ItemAction {
/**
* The item has been created.
*/
CREATED,
/**
* The item has been renamed.
*/
RENAMED,
/**
* The item has been moved.
*/
MOVED,
/**
* The item has been cloned.
*/
CLONED,
/**
* The item has been updates.
*/
UPDATED;
}

View File

@ -0,0 +1,44 @@
/**
*
*/
package org.gcube.common.storagehub.model.types;
/**
* @author gioia
*
*/
public enum ItemType implements GenericItemType{
/**
* A folder.
*/
FOLDER,
/**
* A shared folder
*/
SHARED_FOLDER,
/**
* A smart folder
*/
SMART_FOLDER,
/**
* A folder item.
*/
FOLDER_ITEM,
/**
* A trash folder.
*/
TRASH_FOLDER,
/**
* A trash item.
*/
TRASH_ITEM;
}

View File

@ -0,0 +1,10 @@
package org.gcube.common.storagehub.model.types;
public class Namespace {
public static final String HL_NAMESPACE = "hl:";
public static final String JCR_NAMESPACE = "jcr:";
public static final String REP_NAMESPACE = "rep:";
public static final String NT_NAMESPACE = "nt:";
}

View File

@ -0,0 +1,683 @@
package org.gcube.common.storagehub.model.types;
public enum NodeProperty {
//nthl:workspaceItem
TITLE {
@Override
public String toString() {
return "jcr:title";
}
},
CREATED {
@Override
public String toString() {
return "jcr:created";
}
},
LAST_MODIFIED {
@Override
public String toString() {
return "jcr:lastModified";
}
},
LAST_ACTION {
@Override
public String toString() {
return "hl:lastAction";
}
},
OWNER {
@Override
public String toString() {
return "hl:owner";
}
},
PORTAL_LOGIN {
@Override
public String toString() {
return "hl:portalLogin";
}
},
LAST_MODIFIED_BY {
@Override
public String toString() {
return "jcr:lastModifiedBy";
}
},
DESCRIPTION {
@Override
public String toString() {
return "jcr:description";
}
},
USER_ID {
@Override
public String toString() {
return "hl:uuid";
}
},
IS_PUBLIC {
@Override
public String toString() {
return "hl:isPublic";
}
},
// //nthl:workspaceSharedItem
IS_VRE_FOLDER {
@Override
public String toString() {
return "hl:isVreFolder";
}
},
DISPLAY_NAME {
@Override
public String toString() {
return "hl:displayName";
}
},
USER {
@Override
public String toString() {
return "hl:user";
}
},
USERS {
@Override
public String toString() {
return "hl:users";
}
},
MEMBERS {
@Override
public String toString() {
return "hl:members";
}
},
// file
CONTENT {
@Override
public String toString() {
return "jcr:content";
}
},
FOLDER_ITEM_TYPE {
@Override
public String toString() {
return "hl:workspaceItemType";
}
},
MIME_TYPE {
@Override
public String toString() {
return "jcr:mimeType";
}
},
DATA {
@Override
public String toString() {
return "jcr:data";
}
},
SIZE {
@Override
public String toString() {
return "hl:size";
}
},
REMOTE_STORAGE_PATH {
@Override
public String toString() {
return "hl:remotePath";
}
},
STORAGE_ID {
@Override
public String toString() {
return "hl:storageId";
}
},
STORAGE_PATH {
@Override
public String toString() {
return "hl:storagePath";
}
},
// image
IMAGE_WIDTH {
@Override
public String toString() {
return "hl:width";
}
},
IMAGE_HEIGHT {
@Override
public String toString() {
return "hl:height";
}
},
THUMBNAIL_DATA {
@Override
public String toString() {
return "hl:thumbnailData";
}
},
THUMBNAIL_WIDTH {
@Override
public String toString() {
return "hl:thumbnailWidth";
}
},
THUMBNAIL_HEIGHT {
@Override
public String toString() {
return "hl:thumbnailHeight";
}
},
//pdf
AUTHOR {
@Override
public String toString() {
return "hl:author";
}
},
NUMBER_OF_PAGES {
@Override
public String toString() {
return "hl:numberOfPages";
}
},
VERSION {
@Override
public String toString() {
return "hl:version";
}
},
PDF_TITLE {
@Override
public String toString() {
return "hl:title";
}
},
PRODUCER {
@Override
public String toString() {
return "hl:producer";
}
},
// gcubeItem
SCOPES {
@Override
public String toString() {
return "hl:scopes";
}
},
CREATOR {
@Override
public String toString() {
return "hl:creator";
}
},
ITEM_TYPE {
@Override
public String toString() {
return "hl:itemType";
}
},
PROPERTIES {
@Override
public String toString() {
return "hl:properties";
}
},
PROPERTY {
@Override
public String toString() {
return "hl:property";
}
},
IS_SHARED {
@Override
public String toString() {
return "hl:isShared";
}
},
SHARED_ROOT_ID {
@Override
public String toString() {
return "hl:sharedRootId";
}
},
// trashItem
DELETE_DATE {
@Override
public String toString() {
return "hl:deletedTime";
}
},
DELETE_BY {
@Override
public String toString() {
return "hl:deletedBy";
}
},
ORIGINAL_PARENT_ID {
@Override
public String toString() {
return "hl:originalParentId";
}
},
DELETED_FROM {
@Override
public String toString() {
return "hl:deletedFrom";
}
},
TRASH_ITEM_NAME {
@Override
public String toString() {
return "hl:name";
}
},
TRASH_ITEM_MIME_TYPE {
@Override
public String toString() {
return "hl:mimeType";
}
},
LENGTH {
@Override
public String toString() {
return "hl:length";
}
},
IS_FOLDER {
@Override
public String toString() {
return "hl:isFolder";
}
},
// messages
SUBJECT {
@Override
public String toString() {
return "hl:subject";
}
},
BODY {
@Override
public String toString() {
return "hl:body";
}
},
ATTACHMENTS {
@Override
public String toString() {
return "hl:attachments";
}
},
ATTACHMENTS_ID {
@Override
public String toString() {
return "hl:attachId";
}
},
ADDRESSES {
@Override
public String toString() {
return "hl:addresses";
}
},
SCOPE {
@Override
public String toString() {
return "hl:scope";
}
},
READ {
@Override
public String toString() {
return "hl:read";
}
},
OPEN {
@Override
public String toString() {
return "hl:open";
}
},
NT_USER {
@Override
public String toString() {
return "nthl:user";
}
},
// timeseries
TIMESERIES_ID {
@Override
public String toString() {
return "hl:id";
}
},
TIMESERIES_TITLE {
@Override
public String toString() {
return "hl:title";
}
},
TIMESERIES_DESCRIPTION {
@Override
public String toString() {
return "hl:description";
}
},
TIMESERIES_CREATOR {
@Override
public String toString() {
return "hl:creator";
}
},
TIMESERIES_CREATED {
@Override
public String toString() {
return "hl:created";
}
},
TIMESERIES_PUBLISHER {
@Override
public String toString() {
return "hl:publisher";
}
},
TIMESERIES_SOURCE_ID {
@Override
public String toString() {
return "hl:sourceId";
}
},
TIMESERIES_SOURCE_NAME {
@Override
public String toString() {
return "hl:sourceName";
}
},
TIMESERIES_RIGHTS {
@Override
public String toString() {
return "hl:rights";
}
},
TIMESERIES_DIMENSION {
@Override
public String toString() {
return "hl:dimension";
}
},
HEADER_LABELS {
@Override
public String toString() {
return "hl:headerLabels";
}
},
// query
QUERY {
@Override
public String toString() {
return "hl:query";
}
},
FOLDER_ID {
@Override
public String toString() {
return "hl:folderId";
}
},
QUERY_TYPE {
@Override
public String toString() {
return "hl:queryType";
}
},
//report template
RT_CREATED {
@Override
public String toString() {
return "hl:created";
}
},
LAST_EDIT {
@Override
public String toString() {
return "hl:lastEdit";
}
},
LAST_EDIT_BY {
@Override
public String toString() {
return "hl:lastEditBy";
}
},
NUMBER_OF_SECTION {
@Override
public String toString() {
return "hl:numberOfSection";
}
},
STATUS {
@Override
public String toString() {
return "hl:status";
}
},
FAILURES {
@Override
public String toString() {
return "hl:failures";
}
},
TEMPLATE_NAME {
@Override
public String toString() {
return "hl:templateName";
}
},
//metadata
SCHEMA{
@Override
public String toString() {
return "hl:schema";
}
},
LANGUAGE{
@Override
public String toString() {
return "hl:language";
}
},
COLLECTION_NAME{
@Override
public String toString() {
return "hl:collectionName";
}
},
OID{
@Override
public String toString() {
return "hl:oid";
}
},
NT_CONTENT{
@Override
public String toString() {
return "nthl:metadataItemContent";
}
},
//document
METADATA{
@Override
public String toString() {
return "hl:metadata";
}
},
ANNOTATIONS{
@Override
public String toString() {
return "hl:annotations";
}
},
ALTERNATIVES {
@Override
public String toString() {
return "hl:alternatives";
}
},
PARENT_URI{
@Override
public String toString() {
return "hl:parentUri";
}
},
URI{
@Override
public String toString() {
return "hl:uri";
}
},
NAME{
@Override
public String toString() {
return "hl:name";
}
},
HL_MIME_TYPE{
@Override
public String toString() {
return "hl:mimeType";
}
},
NT_ALTERNATIVE{
@Override
public String toString() {
return "nthl:documentAlternativeLink";
}
},
NT_PART {
@Override
public String toString() {
return "nthl:documentPartLink";
}
},
PARTS{
@Override
public String toString() {
return "hl:parts";
}
},
URL{
@Override
public String toString() {
return "hl:url";
}
},
//accounting
ACCOUNTING{
@Override
public String toString() {
return "hl:accounting";
}
},
NT_ACCOUNTING{
@Override
public String toString() {
return "nthl:accountingSet";
}
},
//workflow
WORKFLOW_ID{
@Override
public String toString() {
return "hl:workflowId";
}
},
WORKFLOW_DATA{
@Override
public String toString() {
return "hl:workflowData";
}
},
WORKFLOW_STATUS{
@Override
public String toString() {
return "hl:workflowStatus";
}
},
REFERENCE{
@Override
public String toString() {
return "hl:reference";
}
},
HIDDEN{
@Override
public String toString() {
return "hl:hidden";
}
},
GROUP_ID{
@Override
public String toString() {
return "hl:groupId";
}
},
IS_SYSTEM_FOLDER{
@Override
public String toString() {
return "hl:IsSystemFolder";
}
};
public static NodeProperty fromValue(String value) {
for(NodeProperty v : values())
if(v.toString().equalsIgnoreCase(value)) return v;
throw new IllegalArgumentException();
}
}

View File

@ -0,0 +1,55 @@
package org.gcube.common.storagehub.model.types;
public class PrimaryNodeType {
public static final String NT_ROOT_ITEM_SENT = "nthl:rootItemSentRequest";
public static final String NT_ITEM_SENT = "nthl:itemSentRequest";
// public static final String NT_MESSAGE = "nthl:itemSentRequest";
public static final String NT_WORKSPACE_ROOT = "rep:root";
public static final String NT_WORKSPACE_FOLDER = "nthl:workspaceItem";
public static final String NT_WORKSPACE_SHARED_FOLDER = "nthl:workspaceSharedItem";
public static final String NT_WORKSPACE_VRE_FOLDER = "nthl:workspaceVreItem";
public static final String NT_WORKSPACE_FOLDER_ITEM = "nthl:workspaceLeafItem";
public static final String NT_WORKSPACE_FILE = "nthl:externalFile";
public static final String NT_WORKSPACE_IMAGE = "nthl:externalImage";
public static final String NT_WORKSPACE_PDF_FILE = "nthl:externalPdf";
public static final String NT_WORKSPACE_URL = "nthl:externalUrl";
public static final String NT_WORKSPACE_SMART_FOLDER = "nthl:workspaceSmartItem";
public static final String NT_ROOT_FOLDER_BULK_CREATOR = "nthl:rootFolderBulkCreator";
public static final String NT_WORKSPACE_REPORT = "nthl:report";
public static final String NT_WORKSPACE_REPORT_TEMPLATE = "nthl:reportTemplate";
public static final String NT_WORKSPACE_WORKFLOW_REPORT = "nthl:workflowReport";
public static final String NT_WORKSPACE_WORKFLOW_TEMPLATE = "nthl:workflowTemplate";
public static final String NT_WORKSPACE_REFERENCE = "nthl:workspaceReference";
public static final String NT_ANNOTATION_ITEM = "nthl:gCubeAnnotation";
public static final String NT_ANNOTATION_LINK_ITEM = "nthl:gCubeAnnotationLink";
public static final String NT_DOCUMENT_ITEM = "nthl:gCubeDocument";
public static final String NT_DOCUMENT_LINK_ITEM = "nthl:gCubeDocumentLink";
public static final String NT_IMAGE_DOCUMENT_ITEM = "nthl:gCubeImageDocument";
public static final String NT_IMAGE_DOCUMENT_LINK_ITEM = "nthl:gCubeImageDocumentLink";
public static final String NT_PDF_DOCUMENT_ITEM = "nthl:gCubePDFDocument";
public static final String NT_PDF_DOCUMENT_LINK_ITEM = "nthl:gCubePDFDocumentLink";
public static final String NT_URL_DOCUMENT_ITEM = "nthl:gCubeURLDocument";
public static final String NT_METADATA_ITEM = "nthl:gCubeMetadata";
public static final String NT_METADATA_LINK_ITEM = "nthl:gCubeMetadataLink";
public static final String NT_AQUAMAPS_ITEM = "nthl:aquamapsItem";
public static final String NT_GCUBE_ITEM = "nthl:gCubeItem";
public static final String NT_TIMESERIES_ITEM = "nthl:timeSeriesItem";
public static final String NT_QUERY = "nthl:query";
public static final String NT_EXTERNAL_RESOURCE_LINK_ITEM = "nthl:externalResourceLink";
public static final String NT_TABULAR_DATA_LINK = "nthl:tabularDataLink";
public static final String NT_TRASH_ITEM = "nthl:trashItem";
public static final String NT_ROOT_MESSAGES = "nthl:rootItemSentRequest";
public static final String NT_FOLDER = "nt:folder";
public static final String NT_HOME = "nthl:home";
protected static final String ACCOUNTING = "hl:accounting";
protected static final String NT_ACCOUNTING = "nthl:accountingSet";
}

View File

@ -0,0 +1,44 @@
/**
*
*/
package org.gcube.common.storagehub.model.types;
/**
* @author gioia
*
*/
public enum WorkspaceItemType implements GenericItemType{
/**
* A folder.
*/
FOLDER,
/**
* A shared folder
*/
SHARED_FOLDER,
/**
* A smart folder
*/
SMART_FOLDER,
/**
* A folder item.
*/
FOLDER_ITEM,
/**
* A trash folder.
*/
TRASH_FOLDER,
/**
* A trash item.
*/
TRASH_ITEM;
}