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 * Instantiates a new OpenLDAP object identifier macro. 042 */ 043 public OpenLdapObjectIdentifierMacro() 044 { 045 name = null; 046 rawOidOrNameSuffix = null; 047 resolvedOid = null; 048 } 049 050 051 /** 052 * Gets the name. 053 * 054 * @return the name 055 */ 056 public String getName() 057 { 058 return name; 059 } 060 061 062 /** 063 * Sets the name. 064 * 065 * @param name the new name 066 */ 067 public void setName( String name ) 068 { 069 this.name = name; 070 } 071 072 073 /** 074 * Gets the raw OID or name plus suffix. 075 * 076 * @return the raw OID or name plus suffix 077 */ 078 public String getRawOidOrNameSuffix() 079 { 080 return rawOidOrNameSuffix; 081 } 082 083 084 /** 085 * Sets the raw OID or name plus suffix. 086 * 087 * @param rawOidOrNameSuffix the new raw OID or name plus suffix 088 */ 089 public void setRawOidOrNameSuffix( String rawOidOrNameSuffix ) 090 { 091 this.rawOidOrNameSuffix = rawOidOrNameSuffix; 092 } 093 094 095 /** 096 * Gets the resolved OID, null if not yet resolved. 097 * 098 * @return the resolved OID 099 */ 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}