1 | /** |
---|
2 | * MailArchiver is an application that provides services for storing and managing e-mail messages through a Web Services SOAP interface. |
---|
3 | * Copyright (C) 2012 Marcio Andre Scholl Levien and Fernando Alberto Reuter Wendt and Jose Ronaldo Nogueira Fonseca Junior |
---|
4 | * |
---|
5 | * This program is free software: you can redistribute it and/or modify |
---|
6 | * it under the terms of the GNU Affero General Public License as |
---|
7 | * published by the Free Software Foundation, either version 3 of the |
---|
8 | * License, or (at your option) any later version. |
---|
9 | * |
---|
10 | * This program is distributed in the hope that it will be useful, |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | * GNU Affero General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU Affero General Public License |
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
17 | */ |
---|
18 | |
---|
19 | /******************************************************************************\ |
---|
20 | * |
---|
21 | * This product was developed by |
---|
22 | * |
---|
23 | * SERVIÃO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), |
---|
24 | * |
---|
25 | * a government company established under Brazilian law (5.615/70), |
---|
26 | * at Department of Development of Porto Alegre. |
---|
27 | * |
---|
28 | \******************************************************************************/ |
---|
29 | |
---|
30 | package serpro.mailarchiver.domain.metaarchive; |
---|
31 | |
---|
32 | import javax.jdo.JDOHelper; |
---|
33 | import javax.jdo.annotations.NotPersistent; |
---|
34 | import javax.jdo.annotations.PersistenceCapable; |
---|
35 | |
---|
36 | import org.apache.james.mime4j.io.LineNumberInputStream; |
---|
37 | |
---|
38 | import serpro.mailarchiver.util.Logger; |
---|
39 | |
---|
40 | @PersistenceCapable |
---|
41 | public class EmbeddedMessage |
---|
42 | extends BodyEntity |
---|
43 | { |
---|
44 | @NotPersistent |
---|
45 | private static final Logger log = Logger.getLocalLogger(); |
---|
46 | |
---|
47 | public EmbeddedMessage(LineNumberInputStream.Entity lnisEntity) { |
---|
48 | super(lnisEntity); |
---|
49 | } |
---|
50 | |
---|
51 | public EmbeddedMessage() {} |
---|
52 | |
---|
53 | @Override |
---|
54 | public final MessageBody getComposite() { |
---|
55 | return (MessageBody)composite; |
---|
56 | } |
---|
57 | |
---|
58 | public final void setComposite(MessageBody composite) { |
---|
59 | if(this.composite != null) { |
---|
60 | getComposite().internal_setEmbeddedMessage(null); |
---|
61 | } |
---|
62 | this.composite = composite; |
---|
63 | if(this.composite != null) { |
---|
64 | getComposite().internal_setEmbeddedMessage(this); |
---|
65 | } |
---|
66 | } |
---|
67 | |
---|
68 | final void internal_setComposite(MessageBody composite) { |
---|
69 | this.composite = composite; |
---|
70 | } |
---|
71 | |
---|
72 | //-------------------------------------------------------------------------- |
---|
73 | @Override |
---|
74 | public final String toString(String pad) { |
---|
75 | return String.format( |
---|
76 | "EmbeddedMessage%n" |
---|
77 | + "%1$sjdoState: %2$s%n" |
---|
78 | + "%1$soid: %3$s%n" |
---|
79 | + "%1$shash: %4$x%n" |
---|
80 | + "%1$sstartLine: %5$d%n" |
---|
81 | + "%1$sseparatorLine: %6$d%n" |
---|
82 | + "%1$sendLine: %7$d%n" |
---|
83 | + "%1$ssize: %8$d" |
---|
84 | , pad |
---|
85 | , JDOHelper.getObjectState(this) |
---|
86 | , getOid() |
---|
87 | , hashCode() |
---|
88 | , getStartLine() |
---|
89 | , getSeparatorLine() |
---|
90 | , getEndLine() |
---|
91 | , getSize()); |
---|
92 | } |
---|
93 | } |
---|