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 */ 020 021package org.apache.directory.api.ldap.model.schema.syntaxCheckers; 022 023 024/** 025 * An OpenLDAP object identifier macro. 026 * See http://www.openldap.org/doc/admin24/schema.html#OID%20Macros 027 * <br/> 028 * <code>objectIdentifier <name> { <oid> | <name>[:<suffix>] }</code> 029 * 030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 031 */ 032public class OpenLdapObjectIdentifierMacro 033{ 034 private String name; 035 036 private String rawOidOrNameSuffix; 037 038 private String resolvedOid; 039 040 041 /** 042 * Instantiates a new OpenLDAP object identifier macro. 043 */ 044 public OpenLdapObjectIdentifierMacro() 045 { 046 name = null; 047 rawOidOrNameSuffix = null; 048 resolvedOid = null; 049 } 050 051 052 /** 053 * Gets the name. 054 * 055 * @return the name 056 */ 057 public String getName() 058 { 059 return name; 060 } 061 062 063 /** 064 * Sets the name. 065 * 066 * @param name the new name 067 */ 068 public void setName( String name ) 069 { 070 this.name = name; 071 } 072 073 074 /** 075 * Gets the raw OID or name plus suffix. 076 * 077 * @return the raw OID or name plus suffix 078 */ 079 public String getRawOidOrNameSuffix() 080 { 081 return rawOidOrNameSuffix; 082 } 083 084 085 /** 086 * Sets the raw OID or name plus suffix. 087 * 088 * @param rawOidOrNameSuffix the new raw OID or name plus suffix 089 */ 090 public void setRawOidOrNameSuffix( String rawOidOrNameSuffix ) 091 { 092 this.rawOidOrNameSuffix = rawOidOrNameSuffix; 093 } 094 095 096 /** 097 * Gets the resolved OID, null if not yet resolved. 098 * 099 * @return the resolved OID 100 */ 101 public String getResolvedOid() 102 { 103 return resolvedOid; 104 } 105 106 107 /** 108 * Checks if is resolved. 109 * 110 * @return true, if is resolved 111 */ 112 public boolean isResolved() 113 { 114 return getResolvedOid() != null; 115 } 116 117 118 /** 119 * Sets the resolved OID. 120 * 121 * @param resolvedOid the new resolved OID 122 */ 123 public void setResolvedOid( String resolvedOid ) 124 { 125 this.resolvedOid = resolvedOid; 126 } 127 128 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}