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.AbandonRequest; 025import org.apache.directory.api.ldap.model.message.AbandonRequestImpl; 026import org.apache.directory.api.ldap.model.message.Control; 027import org.apache.directory.api.ldap.model.message.MessageTypeEnum; 028import org.dom4j.Element; 029 030 031/** 032 * DSML Decorator for AbandonRequest 033 * 034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 035 */ 036public class AbandonRequestDsml extends AbstractRequestDsml<AbandonRequest> 037 implements AbandonRequest 038{ 039 /** 040 * Creates a new instance of AbandonRequestDsml. 041 */ 042 public AbandonRequestDsml( LdapApiService codec ) 043 { 044 super( codec, new AbandonRequestImpl() ); 045 } 046 047 048 /** 049 * Creates a new instance of AbandonRequestDsml. 050 * 051 * @param ldapMessage the message to decorate 052 */ 053 public AbandonRequestDsml( LdapApiService codec, AbandonRequest ldapMessage ) 054 { 055 super( codec, ldapMessage ); 056 } 057 058 059 /** 060 * {@inheritDoc} 061 */ 062 public MessageTypeEnum getType() 063 { 064 return getDecorated().getType(); 065 } 066 067 068 /** 069 * {@inheritDoc} 070 */ 071 public Element toDsml( Element root ) 072 { 073 Element element = super.toDsml( root ); 074 075 // AbandonID 076 if ( getDecorated().getAbandoned() != 0 ) 077 { 078 element.addAttribute( "abandonID", "" + getDecorated().getAbandoned() ); 079 } 080 081 return element; 082 } 083 084 085 /** 086 * Get the abandoned message ID 087 * 088 * @return Returns the abandoned MessageId. 089 */ 090 public int getAbandonedMessageId() 091 { 092 return getDecorated().getAbandoned(); 093 } 094 095 096 /** 097 * Set the abandoned message ID 098 * 099 * @param abandonedMessageId The abandoned messageID to set. 100 */ 101 public AbandonRequest setAbandonedMessageId( int abandonedMessageId ) 102 { 103 getDecorated().setAbandoned( abandonedMessageId ); 104 105 return this; 106 } 107 108 109 /** 110 * {@inheritDoc} 111 */ 112 public int getAbandoned() 113 { 114 return getDecorated().getAbandoned(); 115 } 116 117 118 /** 119 * {@inheritDoc} 120 */ 121 public AbandonRequest setAbandoned( int requestId ) 122 { 123 getDecorated().setAbandoned( requestId ); 124 125 return this; 126 } 127 128 129 /** 130 * {@inheritDoc} 131 */ 132 public AbandonRequest setMessageId( int messageId ) 133 { 134 super.setMessageId( messageId ); 135 136 return this; 137 } 138 139 140 /** 141 * {@inheritDoc} 142 */ 143 public AbandonRequest addControl( Control control ) 144 { 145 return ( AbandonRequest ) super.addControl( control ); 146 } 147 148 149 /** 150 * {@inheritDoc} 151 */ 152 public AbandonRequest addAllControls( Control[] controls ) 153 { 154 return ( AbandonRequest ) super.addAllControls( controls ); 155 } 156 157 158 /** 159 * {@inheritDoc} 160 */ 161 public AbandonRequest removeControl( Control control ) 162 { 163 return ( AbandonRequest ) super.removeControl( control ); 164 } 165}