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 */ 020 package org.apache.directory.shared.dsmlv2.request; 021 022 023 import org.apache.directory.shared.ldap.codec.MessageTypeEnum; 024 import org.apache.directory.shared.ldap.codec.del.DelRequestCodec; 025 import org.apache.directory.shared.ldap.name.DN; 026 import org.dom4j.Element; 027 028 029 /** 030 * DSML Decorator for DelRequest 031 * 032 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 033 * @version $Rev$, $Date$ 034 */ 035 public class DelRequestDsml extends AbstractRequestDsml 036 { 037 /** 038 * Creates a new instance of DelRequestDsml. 039 */ 040 public DelRequestDsml() 041 { 042 super( new DelRequestCodec() ); 043 } 044 045 046 /** 047 * Creates a new instance of DelRequestDsml. 048 * 049 * @param ldapMessage 050 * the message to decorate 051 */ 052 public DelRequestDsml( DelRequestCodec ldapMessage ) 053 { 054 super( ldapMessage ); 055 } 056 057 058 /** 059 * {@inheritDoc} 060 */ 061 public MessageTypeEnum getMessageType() 062 { 063 return instance.getMessageType(); 064 } 065 066 067 /** 068 * {@inheritDoc} 069 */ 070 public Element toDsml( Element root ) 071 { 072 Element element = super.toDsml( root ); 073 074 DelRequestCodec request = ( DelRequestCodec ) instance; 075 076 // DN 077 if ( request.getEntry() != null ) 078 { 079 element.addAttribute( "dn", request.getEntry().getName() ); 080 } 081 082 return element; 083 } 084 085 086 /** 087 * Get the entry to be deleted 088 * 089 * @return Returns the entry. 090 */ 091 public DN getEntry() 092 { 093 return ( ( DelRequestCodec ) instance ).getEntry(); 094 } 095 096 097 /** 098 * Set the entry to be deleted 099 * 100 * @param entry The entry to set. 101 */ 102 public void setEntry( DN entry ) 103 { 104 ( ( DelRequestCodec ) instance ).setEntry( entry ); 105 } 106 }