KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.apache.directory.ldapstudio.browser.core.utils.LdifUtils;
26
27
28 public class LdifNewsuperiorLine extends LdifValueLineBase
29 {
30
31     private static final long serialVersionUID = -8614298286815271694L;
32
33
34     protected LdifNewsuperiorLine()
35     {
36     }
37
38
39     public LdifNewsuperiorLine( int offset, String JavaDoc rawNewSuperiorSpec, String JavaDoc rawValueType, String JavaDoc rawNewSuperiorDn,
40         String JavaDoc rawNewLine )
41     {
42         super( offset, rawNewSuperiorSpec, rawValueType, rawNewSuperiorDn, rawNewLine );
43     }
44
45
46     public String JavaDoc getRawNewSuperiorSpec()
47     {
48         return super.getRawLineStart();
49     }
50
51
52     public String JavaDoc getUnfoldedNewSuperiorSpec()
53     {
54         return super.getUnfoldedLineStart();
55     }
56
57
58     public String JavaDoc getRawNewSuperiorDn()
59     {
60         return super.getRawValue();
61     }
62
63
64     public String JavaDoc getUnfoldedNewSuperiorDn()
65     {
66         return super.getUnfoldedValue();
67     }
68
69
70     public String JavaDoc toRawString()
71     {
72         return super.toRawString();
73     }
74
75
76     public boolean isValid()
77     {
78         return super.isValid();
79     }
80
81
82     public String JavaDoc getInvalidString()
83     {
84         if ( this.getUnfoldedNewSuperiorSpec().length() == 0 )
85         {
86             return "Missing new superior spec 'newsuperior'";
87         }
88         else if ( this.getUnfoldedNewSuperiorDn().length() == 0 )
89         {
90             return "Missing new superior DN";
91         }
92         else
93         {
94             return super.getInvalidString();
95         }
96     }
97
98
99     public static LdifNewsuperiorLine create( String JavaDoc newsuperior )
100     {
101         if ( LdifUtils.mustEncode( newsuperior ) )
102         {
103             return new LdifNewsuperiorLine( 0, "newsuperior", "::", LdifUtils.base64encode( LdifUtils
104                 .utf8encode( newsuperior ) ), BrowserCoreConstants.LINE_SEPARATOR );
105         }
106         else
107         {
108             return new LdifNewsuperiorLine( 0, "newsuperior", ":", newsuperior, BrowserCoreConstants.LINE_SEPARATOR );
109         }
110
111     }
112
113 }
114
Popular Tags