001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2006-2008 Sun Microsystems, Inc. 015 * Portions Copyright 2015-2016 ForgeRock AS. 016 */ 017package org.opends.server.tools.makeldif; 018 019/** 020 * This class defines a data structure that provides information about the 021 * result of tag processing. 022 */ 023public class TagResult 024{ 025 /** A tag result in which all components have a value of <CODE>true</CODE>. */ 026 public static final TagResult SUCCESS_RESULT = new TagResult(true, true, true, true); 027 /** 028 * A tag result that indicates the value should not be included in the entry, 029 * but all other processing should continue. 030 */ 031 public static final TagResult OMIT_FROM_ENTRY = new TagResult(false, true, true, true); 032 /** A tag result in which all components have a value of <CODE>false</CODE>. */ 033 public static final TagResult STOP_PROCESSING = new TagResult(false, false, false, false); 034 035 /** Indicates whether to keep processing the associated line. */ 036 private final boolean keepProcessingLine; 037 /** Indicates whether to keep processing the associated entry. */ 038 private final boolean keepProcessingEntry; 039 /** Indicates whether to keep processing entries below the associated parent. */ 040 private final boolean keepProcessingParent; 041 /** Indicates whether to keep processing entries for the template file. */ 042 private final boolean keepProcessingTemplateFile; 043 044 /** 045 * Creates a new tag result object with the provided information. 046 * 047 * @param keepProcessingLine Indicates whether to continue 048 * processing for the current line. If 049 * not, then the line will not be included 050 * in the entry. 051 * @param keepProcessingEntry Indicates whether to continue 052 * processing for the current entry. If 053 * not, then the entry will not be 054 * included in the data. 055 * @param keepProcessingParent Indicates whether to continue 056 * processing entries below the current 057 * parent in the template file. 058 * @param keepProcessingTemplateFile Indicates whether to continue 059 * processing entries for the template 060 * file. 061 */ 062 private TagResult(boolean keepProcessingLine, boolean keepProcessingEntry, 063 boolean keepProcessingParent, 064 boolean keepProcessingTemplateFile) 065 { 066 this.keepProcessingLine = keepProcessingLine; 067 this.keepProcessingEntry = keepProcessingEntry; 068 this.keepProcessingParent = keepProcessingParent; 069 this.keepProcessingTemplateFile = keepProcessingTemplateFile; 070 } 071 072 /** 073 * Indicates whether to continue processing for the current line. If this is 074 * <CODE>false</CODE>, then the current line will not be included in the 075 * entry. It will have no impact on whether the entry itself is included in 076 * the generated LDIF. 077 * 078 * @return <CODE>true</CODE> if the line should be included in the entry, or 079 * <CODE>false</CODE> if not. 080 */ 081 public boolean keepProcessingLine() 082 { 083 return keepProcessingLine; 084 } 085 086 /** 087 * Indicates whether to continue processing for the current entry. If this is 088 * <CODE>false</CODE>, then the current entry will not be included in the 089 * generated LDIF, and processing will resume with the next entry below the 090 * current parent. 091 * 092 * @return <CODE>true</CODE> if the entry should be included in the 093 * generated LDIF, or <CODE>false</CODE> if not. 094 */ 095 public boolean keepProcessingEntry() 096 { 097 return keepProcessingEntry; 098 } 099 100 /** 101 * Indicates whether to continue processing entries below the current parent. 102 * If this is <CODE>false</CODE>, then the current entry will not be included, 103 * and processing will resume below the next parent in the template file. 104 * 105 * @return <CODE>true</CODE> if processing for the current parent should 106 * continue, or <CODE>false</CODE> if not. 107 */ 108 public boolean keepProcessingParent() 109 { 110 return keepProcessingParent; 111 } 112 113 /** 114 * Indicates whether to keep processing entries for the template file. If 115 * this is <CODE>false</CODE>, then LDIF processing will end immediately (and 116 * the current entry will not be included). 117 * 118 * @return <CODE>true</CODE> if processing for the template file should 119 * continue, or <CODE>false</CODE> if not. 120 */ 121 public boolean keepProcessingTemplateFile() 122 { 123 return keepProcessingTemplateFile; 124 } 125}