1 20 21 package org.apache.directory.ldapstudio.browser.core.internal.model; 22 23 24 import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages; 25 import org.apache.directory.ldapstudio.browser.core.model.DN; 26 import org.apache.directory.ldapstudio.browser.core.model.IConnection; 27 import org.apache.directory.ldapstudio.browser.core.model.IEntry; 28 import org.apache.directory.ldapstudio.browser.core.model.ModelModificationException; 29 import org.apache.directory.ldapstudio.browser.core.model.RDN; 30 31 32 public class Entry extends AbstractEntry 33 { 34 35 private static final long serialVersionUID = -4718107307581983276L; 36 37 protected RDN rdn; 38 39 protected IEntry parent; 40 41 42 protected Entry() 43 { 44 } 45 46 47 public Entry( IEntry parent, RDN rdn ) throws ModelModificationException 48 { 49 super(); 50 51 if ( parent == null ) 52 { 53 throw new ModelModificationException( BrowserCoreMessages.model__empty_entry ); 54 } 55 if ( rdn == null ) 56 { 57 throw new ModelModificationException( BrowserCoreMessages.model__empty_rdn ); 58 } 59 if ( "".equals( rdn.toString() ) ) { throw new ModelModificationException( BrowserCoreMessages.model__empty_rdn ); 61 } 62 63 this.parent = parent; 64 this.rdn = rdn; 65 } 66 67 68 public RDN getRdn() 70 { 71 return this.rdn; 72 } 73 74 75 public DN getDn() 76 { 77 DN dn = new DN( new RDN( this.rdn ), this.parent.getDn() ); 78 return dn; 79 } 80 81 82 public IEntry getParententry() 83 { 84 return this.parent; 85 } 86 87 88 public IConnection getConnection() 89 { 90 return this.getParententry().getConnection(); 91 } 92 93 94 protected void setRdn( RDN newRdn ) 95 { 96 this.rdn = newRdn; 97 } 98 99 100 protected void setParent( IEntry newParent ) 101 { 102 this.parent = newParent; 103 } 104 105 } 106 | Popular Tags |