KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > browser > core > model > ldif > lines > LdifDeloldrdnLine


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  */

20
21 package org.apache.directory.ldapstudio.browser.core.model.ldif.lines;
22
23
24 import org.apache.directory.ldapstudio.browser.core.BrowserCoreConstants;
25
26
27 public class LdifDeloldrdnLine extends LdifValueLineBase
28 {
29
30     private static final long serialVersionUID = 7427736453871426864L;
31
32
33     protected LdifDeloldrdnLine()
34     {
35     }
36
37
38     public LdifDeloldrdnLine( int offset, String JavaDoc rawDeleteOldrdnSpec, String JavaDoc rawValueType, String JavaDoc rawDeleteOldrdn,
39         String JavaDoc rawNewLine )
40     {
41         super( offset, rawDeleteOldrdnSpec, rawValueType, rawDeleteOldrdn, rawNewLine );
42     }
43
44
45     public String JavaDoc getRawDeleteOldrdnSpec()
46     {
47         return super.getRawLineStart();
48     }
49
50
51     public String JavaDoc getUnfoldedDeleteOldrdnSpec()
52     {
53         return super.getUnfoldedLineStart();
54     }
55
56
57     public String JavaDoc getRawDeleteOldrdn()
58     {
59         return super.getRawValue();
60     }
61
62
63     public String JavaDoc getUnfoldedDeleteOldrdn()
64     {
65         return super.getUnfoldedValue();
66     }
67
68
69     public boolean isDeleteOldRdn()
70     {
71         return "1".equals( this.getUnfoldedDeleteOldrdn() );
72     }
73
74
75     public String JavaDoc toRawString()
76     {
77         return super.toRawString();
78     }
79
80
81     public boolean isValid()
82     {
83         if ( !super.isValid() )
84             return false;
85
86         return ( "0".equals( getUnfoldedDeleteOldrdn() ) || "1".equals( getUnfoldedDeleteOldrdn() ) );
87     }
88
89
90     public String JavaDoc getInvalidString()
91     {
92         if ( this.getUnfoldedDeleteOldrdnSpec().length() == 0 )
93         {
94             return "Missing delete old RDN spec 'deleteoldrdn'";
95         }
96         else if ( !"0".equals( getUnfoldedDeleteOldrdn() ) && !"1".equals( getUnfoldedDeleteOldrdn() ) )
97         {
98             return "Invalid value of delete old RDN, must be '0' or '1'";
99         }
100         else
101         {
102             return super.getInvalidString();
103         }
104     }
105
106
107     public static LdifDeloldrdnLine create0()
108     {
109         return new LdifDeloldrdnLine( 0, "deleteoldrdn", ":", "0", BrowserCoreConstants.LINE_SEPARATOR );
110     }
111
112
113     public static LdifDeloldrdnLine create1()
114     {
115         return new LdifDeloldrdnLine( 0, "deleteoldrdn", ":", "1", BrowserCoreConstants.LINE_SEPARATOR );
116     }
117
118 }
119
Popular Tags