/** * MailArchiver is an application that provides services for storing and managing e-mail messages through a Web Services SOAP interface. * Copyright (C) 2012 Marcio Andre Scholl Levien and Fernando Alberto Reuter Wendt and Jose Ronaldo Nogueira Fonseca Junior * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ /******************************************************************************\ * * This product was developed by * * SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), * * a government company established under Brazilian law (5.615/70), * at Department of Development of Porto Alegre. * \******************************************************************************/ package serpro.mailarchiver.domain.metaarchive; import javax.jdo.annotations.NotPersistent; import javax.jdo.annotations.PersistenceCapable; import com.google.common.base.Strings; import serpro.mailarchiver.util.Logger; @PersistenceCapable public abstract class FieldAddress extends Address { @NotPersistent private static final Logger log = Logger.getLocalLogger(); //**** P E R S I S T E N T **** protected Field field; protected Integer fieldIdx; //***************************** public abstract Field getField(); @Override public Message getRootMessage() { if(getField() != null) { return getField().getRootMessage(); } return null; } //-------------------------------------------------------------------------- @Override final int dumpPath(StringBuilder sb, boolean quit) { int depth = (field == null) ? 0 : field.dumpPath(sb, false); String pad = Strings.repeat(" ", depth); if(quit) { sb.append(toString(pad + " ")); } else { sb.append(toString(pad + "| ")).append("\n") .append(pad).append("|\n") .append(pad).append("+---"); } return ++depth; } }