OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 25 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25 Rev 57
Line 13... Line 13...
13
 
13
 
14
 package org.openconcerto.openoffice;
14
 package org.openconcerto.openoffice;
15
 
15
 
16
import static java.util.Arrays.asList;
16
import static java.util.Arrays.asList;
17
import org.openconcerto.openoffice.ODPackage.RootElement;
17
import org.openconcerto.openoffice.ODPackage.RootElement;
-
 
18
import org.openconcerto.utils.Tuple2;
18
 
19
 
19
import org.jdom.Document;
20
import org.jdom.Document;
20
import org.jdom.Element;
21
import org.jdom.Element;
21
import org.jdom.Namespace;
22
import org.jdom.Namespace;
22
 
23
 
Line 103... Line 104...
103
 
104
 
104
    public final String getExtension() {
105
    public final String getExtension() {
105
        return this.extension;
106
        return this.extension;
106
    }
107
    }
107
 
108
 
-
 
109
    public final String getFlatExtension() {
-
 
110
        if (this.getVersion() == XMLVersion.OOo)
-
 
111
            return null;
-
 
112
        return 'f' + this.getExtension();
-
 
113
    }
-
 
114
 
108
    public final boolean isTemplate() {
115
    public final boolean isTemplate() {
109
        return this.getMimeType().endsWith(TEMPLATE_SUFFIX);
116
        return this.getMimeType().endsWith(TEMPLATE_SUFFIX);
110
    }
117
    }
111
 
118
 
112
    public final ContentTypeVersioned getTemplate() {
119
    public final ContentTypeVersioned getTemplate() {
Line 269... Line 276...
269
        for (final ContentTypeVersioned t : ContentTypeVersioned.values())
276
        for (final ContentTypeVersioned t : ContentTypeVersioned.values())
270
            if (t.shortName.equals(name) && t.getVersion() == version)
277
            if (t.shortName.equals(name) && t.getVersion() == version)
271
                return t;
278
                return t;
272
        return null;
279
        return null;
273
    }
280
    }
-
 
281
 
-
 
282
    // Boolean : is flat
-
 
283
    static Tuple2<ContentTypeVersioned, Boolean> fromExtension(final String extension) {
-
 
284
        if (extension != null && extension.length() != 0) {
-
 
285
            for (final ContentTypeVersioned t : ContentTypeVersioned.values()) {
-
 
286
                if (extension.equals(t.getExtension()))
-
 
287
                    return Tuple2.create(t, false);
-
 
288
                if (extension.equals(t.getFlatExtension()))
-
 
289
                    return Tuple2.create(t, true);
-
 
290
            }
-
 
291
        }
-
 
292
        return Tuple2.nullInstance();
-
 
293
    }
274
}
294
}