--- /dev/null
+package org.simantics.export.core.manager;\r
+\r
+import java.io.File;\r
+\r
+import org.simantics.databoard.util.URIUtil;\r
+\r
+public class Content {\r
+\r
+ public String url;\r
+ public String contentTypeId;\r
+ public String formatId;\r
+ public String formatExt; \r
+ public String label;\r
+ public String modelId;\r
+\r
+ /**\r
+ * Initially suggested and the later used filename.\r
+ */\r
+ public String filename;\r
+ \r
+ /**\r
+ * This is an optional field that is filled one export action has been completed.\r
+ * This value is used by the publisher.\r
+ */\r
+ public File tmpFile;\r
+ \r
+ public Content(String url, String contentTypeId, String formatId, String label, String formatExt, String modelId) {\r
+ this.url = url;\r
+ this.contentTypeId = contentTypeId;\r
+ this.formatId = formatId;\r
+ this.formatExt = formatExt;\r
+ this.label = label;\r
+ this.modelId = modelId;\r
+ if ( label!=null && formatExt!=null ) {\r
+ String filename = label+formatExt;\r
+ filename = filename.replaceAll("/", "-");\r
+ this.filename = URIUtil.encodeFilename( filename );\r
+ }\r
+ } \r
+ \r
+ @Override\r
+ public String toString() {\r
+ return "url="+url+",formatId="+formatId;\r
+ }\r
+ \r
+ @Override\r
+ public int hashCode() {\r
+ return url.hashCode()+13*formatId.hashCode();\r
+ }\r
+ \r
+ @Override\r
+ public boolean equals(Object o) {\r
+ Content other = (Content) o;\r
+ if ( !other.formatId.equals(formatId) ) return false;\r
+ if ( !other.url.equals(url) ) return false;\r
+ return true;\r
+ }\r
+\r
+}\r