001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.api.dsmlv2.request; 021 022 023import org.apache.directory.api.ldap.codec.api.LdapApiService; 024import org.apache.directory.api.ldap.model.message.Control; 025import org.apache.directory.api.ldap.model.message.DeleteRequest; 026import org.apache.directory.api.ldap.model.message.DeleteRequestImpl; 027import org.apache.directory.api.ldap.model.message.DeleteResponse; 028import org.apache.directory.api.ldap.model.message.MessageTypeEnum; 029import org.apache.directory.api.ldap.model.name.Dn; 030import org.dom4j.Element; 031 032 033/** 034 * DSML Decorator for DeleteRequest 035 * 036 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 037 */ 038public class DelRequestDsml 039 extends AbstractResultResponseRequestDsml<DeleteRequest, DeleteResponse> 040 implements DeleteRequest 041{ 042 /** 043 * Creates a new getDecoratedMessage() of DelRequestDsml. 044 */ 045 public DelRequestDsml( LdapApiService codec ) 046 { 047 super( codec, new DeleteRequestImpl() ); 048 } 049 050 051 /** 052 * Creates a new getDecoratedMessage() of DelRequestDsml. 053 * 054 * @param ldapMessage 055 * the message to decorate 056 */ 057 public DelRequestDsml( LdapApiService codec, DeleteRequest ldapMessage ) 058 { 059 super( codec, ldapMessage ); 060 } 061 062 063 /** 064 * {@inheritDoc} 065 */ 066 public MessageTypeEnum getType() 067 { 068 return getDecorated().getType(); 069 } 070 071 072 /** 073 * {@inheritDoc} 074 */ 075 public Element toDsml( Element root ) 076 { 077 Element element = super.toDsml( root ); 078 079 // Dn 080 if ( getDecorated().getName() != null ) 081 { 082 element.addAttribute( "dn", getDecorated().getName().getName() ); 083 } 084 085 return element; 086 } 087 088 089 /** 090 * Get the entry to be deleted 091 * 092 * @return Returns the entry. 093 */ 094 public Dn getEntry() 095 { 096 return getDecorated().getName(); 097 } 098 099 100 /** 101 * Set the entry to be deleted 102 * 103 * @param entry The entry to set. 104 */ 105 public void setEntry( Dn entry ) 106 { 107 getDecorated().setName( entry ); 108 } 109 110 111 /** 112 * {@inheritDoc} 113 */ 114 public MessageTypeEnum getResponseType() 115 { 116 return getDecorated().getResponseType(); 117 } 118 119 120 /** 121 * {@inheritDoc} 122 */ 123 public Dn getName() 124 { 125 return getDecorated().getName(); 126 } 127 128 129 /** 130 * {@inheritDoc} 131 */ 132 public DeleteRequest setName( Dn name ) 133 { 134 getDecorated().setName( name ); 135 136 return this; 137 } 138 139 140 /** 141 * {@inheritDoc} 142 */ 143 public DeleteRequest setMessageId( int messageId ) 144 { 145 super.setMessageId( messageId ); 146 147 return this; 148 } 149 150 151 /** 152 * {@inheritDoc} 153 */ 154 public DeleteRequest addControl( Control control ) 155 { 156 return ( DeleteRequest ) super.addControl( control ); 157 } 158 159 160 /** 161 * {@inheritDoc} 162 */ 163 public DeleteRequest addAllControls( Control[] controls ) 164 { 165 return ( DeleteRequest ) super.addAllControls( controls ); 166 } 167 168 169 /** 170 * {@inheritDoc} 171 */ 172 public DeleteRequest removeControl( Control control ) 173 { 174 return ( DeleteRequest ) super.removeControl( control ); 175 } 176}