git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'subtree'
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
fanfix
/
data
/
MetaData.java
diff --git
a/src/be/nikiroo/fanfix/data/MetaData.java
b/src/be/nikiroo/fanfix/data/MetaData.java
index cbaf84e3c75def8646332cb7975a650dfe703013..586196a663fea88aa39fe45111445d76df0d5651 100644
(file)
--- a/
src/be/nikiroo/fanfix/data/MetaData.java
+++ b/
src/be/nikiroo/fanfix/data/MetaData.java
@@
-1,16
+1,20
@@
package be.nikiroo.fanfix.data;
package be.nikiroo.fanfix.data;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import be.nikiroo.utils.Image;
import java.util.ArrayList;
import java.util.List;
import be.nikiroo.utils.Image;
+import be.nikiroo.utils.StringUtils;
/**
* The meta data associated to a {@link Story} object.
*
* @author niki
*/
/**
* The meta data associated to a {@link Story} object.
*
* @author niki
*/
-public class MetaData implements Cloneable, Comparable<MetaData> {
+public class MetaData implements Cloneable, Comparable<MetaData>, Serializable {
+ private static final long serialVersionUID = 1L;
+
private String title;
private String author;
private String date;
private String title;
private String author;
private String date;
@@
-108,6
+112,8
@@
public class MetaData implements Cloneable, Comparable<MetaData> {
/**
* The story resume (a.k.a. description).
/**
* The story resume (a.k.a. description).
+ * <p>
+ * This can be NULL if we don't have a resume for this {@link Story}.
*
* @return the resume
*/
*
* @return the resume
*/
@@
-384,12
+390,14
@@
public class MetaData implements Cloneable, Comparable<MetaData> {
return 1;
}
return 1;
}
- String id = (getUuid() == null ? "" : getUuid())
+ String id = (getTitle() == null ? "" : getTitle())
+ + (getUuid() == null ? "" : getUuid())
+ (getLuid() == null ? "" : getLuid());
+ (getLuid() == null ? "" : getLuid());
- String oId = (getUuid() == null ? "" : o.getUuid())
+ String oId = (getTitle() == null ? "" : o.getTitle())
+ + (getUuid() == null ? "" : o.getUuid())
+ (o.getLuid() == null ? "" : o.getLuid());
+ (o.getLuid() == null ? "" : o.getLuid());
- return id.compareTo(oId);
+ return id.compareTo
IgnoreCase
(oId);
}
@Override
}
@Override
@@
-466,19
+474,8
@@
public class MetaData implements Cloneable, Comparable<MetaData> {
String cover = "none";
if (getCover() != null) {
String cover = "none";
if (getCover() != null) {
- cover = " bytes";
-
- int size = getCover().getData().length;
- if (size > 1000) {
- size /= 1000;
- cover = " kb";
- if (size > 1000) {
- size /= 1000;
- cover = " mb";
- }
- }
-
- cover = size + cover;
+ cover = StringUtils.formatNumber(getCover().getSize())
+ + "bytes";
}
return String.format(
}
return String.format(