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 ForgeRock AS. 016 */ 017package org.opends.server.tools.makeldif; 018 019 020 021/** 022 * This class defines a data structure that provides information about the 023 * result of tag processing. 024 */ 025public class TagResult 026{ 027 /** 028 * A tag result in which all components have a value of <CODE>true</CODE>. 029 */ 030 public static final TagResult SUCCESS_RESULT = 031 new TagResult(true, true, true, true); 032 033 034 035 /** 036 * A tag result that indicates the value should not be included in the entry, 037 * but all other processing should continue. 038 */ 039 public static final TagResult OMIT_FROM_ENTRY = 040 new TagResult(false, true, true, true); 041 042 043 044 /** 045 * A tag result in whihc all components have a value of <CODE>false</CODE>. 046 */ 047 public static final TagResult STOP_PROCESSING = 048 new TagResult(false, false, false, false); 049 050 051 052 /** Indicates whether to keep processing the associated line. */ 053 private boolean keepProcessingLine; 054 055 /** Indicates whether to keep processing the associated entry. */ 056 private boolean keepProcessingEntry; 057 058 /** Indicates whether to keep processing entries below the associated parent. */ 059 private boolean keepProcessingParent; 060 061 /** Indicates whether to keep processing entries for the template file. */ 062 private boolean keepProcessingTemplateFile; 063 064 065 066 /** 067 * Creates a new tag result object with the provided information. 068 * 069 * @param keepProcessingLine Indicates whether to continue 070 * processing for the current line. If 071 * not, then the line will not be included 072 * in the entry. 073 * @param keepProcessingEntry Indicates whether to continue 074 * processing for the current entry. If 075 * not, then the entry will not be 076 * included in the data. 077 * @param keepProcessingParent Indicates whether to continue 078 * processing entries below the current 079 * parent in the template file. 080 * @param keepProcessingTemplateFile Indicates whether to continue 081 * processing entries for the template 082 * file. 083 */ 084 public TagResult(boolean keepProcessingLine, boolean keepProcessingEntry, 085 boolean keepProcessingParent, 086 boolean keepProcessingTemplateFile) 087 { 088 this.keepProcessingLine = keepProcessingLine; 089 this.keepProcessingEntry = keepProcessingEntry; 090 this.keepProcessingParent = keepProcessingParent; 091 this.keepProcessingTemplateFile = keepProcessingTemplateFile; 092 } 093 094 095 096 /** 097 * Indicates whether to continue processing for the current line. If this is 098 * <CODE>false</CODE>, then the current line will not be included in the 099 * entry. It will have no impact on whehter the entry itself is included in 100 * the generated LDIF. 101 * 102 * @return <CODE>true</CODE> if the line should be included in the entry, or 103 * <CODE>false</CODE> if not. 104 */ 105 public boolean keepProcessingLine() 106 { 107 return keepProcessingLine; 108 } 109 110 111 112 /** 113 * Indicates whether to continue processing for the current entry. If this is 114 * <CODE>false</CODE>, then the current entry will not be included in the 115 * generated LDIF, and processing will resume with the next entry below the 116 * current parent. 117 * 118 * @return <CODE>true</CODE> if the entry should be included in the 119 * generated LDIF, or <CODE>false</CODE> if not. 120 */ 121 public boolean keepProcessingEntry() 122 { 123 return keepProcessingEntry; 124 } 125 126 127 128 /** 129 * Indicates whether to continue processing entries below the current parent. 130 * If this is <CODE>false</CODE>, then the current entry will not be included, 131 * and processing will resume below the next parent in the template file. 132 * 133 * @return <CODE>true</CODE> if processing for the current parent should 134 * continue, or <CODE>false</CODE> if not. 135 */ 136 public boolean keepProcessingParent() 137 { 138 return keepProcessingParent; 139 } 140 141 142 143 /** 144 * Indicates whether to keep processing entries for the template file. If 145 * this is <CODE>false</CODE>, then LDIF processing will end immediately (and 146 * the current entry will not be included). 147 * 148 * @return <CODE>true</CODE> if processing for the template file should 149 * continue, or <CODE>false</CODE> if not. 150 */ 151 public boolean keepProcessingTemplateFile() 152 { 153 return keepProcessingTemplateFile; 154 } 155} 156