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.api.ldap.model.schema.syntaxCheckers; 22 23 24 /** 25 * An OpenLDAP object identifier macro. 26 * See http://www.openldap.org/doc/admin24/schema.html#OID%20Macros 27 * <br> 28 * <code>objectIdentifier <name> { <oid> | <name>[:<suffix>] }</code> 29 * 30 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 31 */ 32 public class OpenLdapObjectIdentifierMacro 33 { 34 private String name; 35 36 private String rawOidOrNameSuffix; 37 38 private String resolvedOid; 39 40 /** 41 * Instantiates a new OpenLDAP object identifier macro. 42 */ 43 public OpenLdapObjectIdentifierMacro() 44 { 45 name = null; 46 rawOidOrNameSuffix = null; 47 resolvedOid = null; 48 } 49 50 51 /** 52 * Gets the name. 53 * 54 * @return the name 55 */ 56 public String getName() 57 { 58 return name; 59 } 60 61 62 /** 63 * Sets the name. 64 * 65 * @param name the new name 66 */ 67 public void setName( String name ) 68 { 69 this.name = name; 70 } 71 72 73 /** 74 * Gets the raw OID or name plus suffix. 75 * 76 * @return the raw OID or name plus suffix 77 */ 78 public String getRawOidOrNameSuffix() 79 { 80 return rawOidOrNameSuffix; 81 } 82 83 84 /** 85 * Sets the raw OID or name plus suffix. 86 * 87 * @param rawOidOrNameSuffix the new raw OID or name plus suffix 88 */ 89 public void setRawOidOrNameSuffix( String rawOidOrNameSuffix ) 90 { 91 this.rawOidOrNameSuffix = rawOidOrNameSuffix; 92 } 93 94 95 /** 96 * Gets the resolved OID, null if not yet resolved. 97 * 98 * @return the resolved OID 99 */ 100 public String getResolvedOid() 101 { 102 return resolvedOid; 103 } 104 105 106 /** 107 * Checks if is resolved. 108 * 109 * @return true, if is resolved 110 */ 111 public boolean isResolved() 112 { 113 return getResolvedOid() != null; 114 } 115 116 117 /** 118 * Sets the resolved OID. 119 * 120 * @param resolvedOid the new resolved OID 121 */ 122 public void setResolvedOid( String resolvedOid ) 123 { 124 this.resolvedOid = resolvedOid; 125 } 126 127 128 @Override 129 public String toString() 130 { 131 if ( isResolved() ) 132 { 133 return "resolved: " + name + " " + resolvedOid; 134 } 135 else 136 { 137 return "unresolved: " + name + " " + rawOidOrNameSuffix; 138 } 139 } 140 141 }