001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2006-2008 Sun Microsystems, Inc. 025 * Portions Copyright 2014-2015 ForgeRock AS 026 */ 027package org.opends.server.types; 028 029import java.util.ArrayList; 030import java.util.List; 031 032 033 034 035/** 036 * This class defines a data structure for storing information about 037 * an entry that matches a given set of search criteria and should be 038 * returned to the client. 039 * When the search result entry contains attribute types only, the 040 * objectclass type (if requested) will be present in the user 041 * attributes. When the search result entry contains both attribute 042 * types and values, the objectclass attribute will not be present in 043 * the user attributes. 044 */ 045@org.opends.server.types.PublicAPI( 046 stability=org.opends.server.types.StabilityLevel.UNCOMMITTED, 047 mayInstantiate=false, 048 mayExtend=false, 049 mayInvoke=true) 050public final class SearchResultEntry 051 extends Entry 052{ 053 /** The set of controls associated with this search result entry. */ 054 private List<Control> controls; 055 056 057 058 /** 059 * Creates a new search result entry based on the provided entry. 060 * The provided entry should have been a duplicate of a real entry 061 * so that any changes that may be made to this entry (e.g., by 062 * access control or plugins) will not impact the original entry. 063 * 064 * @param entry The entry to use to create this search result 065 * entry. 066 */ 067 public SearchResultEntry(Entry entry) 068 { 069 super(entry.getName(), entry.getObjectClasses(), 070 entry.getUserAttributes(), 071 entry.getOperationalAttributes()); 072 073 074 this.controls = new ArrayList<>(0); 075 } 076 077 078 079 /** 080 * Creates a new search result entry based on the provided entry. 081 * The provided entry should have been a duplicate of a real entry 082 * so that any changes that may be made to this entry (e.g., by 083 * access control or plugins) will not impact the original entry. 084 * 085 * @param entry The entry to use to create this search result 086 * entry. 087 * @param controls The set of controls to return to the client 088 * with this entry. 089 */ 090 public SearchResultEntry(Entry entry, List<Control> controls) 091 { 092 super(entry.getName(), entry.getObjectClasses(), 093 entry.getUserAttributes(), 094 entry.getOperationalAttributes()); 095 096 097 if (controls == null) 098 { 099 this.controls = new ArrayList<>(0); 100 } 101 else 102 { 103 this.controls = controls; 104 } 105 } 106 107 108 109 /** 110 * Retrieves the set of controls to include with this search result 111 * entry when it is sent to the client. This set of controls may be 112 * modified by the caller. 113 * 114 * @return The set of controls to include with this search result 115 * entry when it is sent to the client. 116 */ 117 public List<Control> getControls() 118 { 119 return controls; 120 } 121} 122