Org.IdentityConnectors.Framework.Common.Objects.SchemaBuilder.DefineObjectClass C# (CSharp) Method

DefineObjectClass() public method

Adds another ObjectClassInfo to the schema.
Also, adds this to the set of supported classes for every operation defined by the Connector.
If already defined
public DefineObjectClass ( ObjectClassInfo info ) : void
info ObjectClassInfo
return void
        public void DefineObjectClass(ObjectClassInfo info)
        {
            Assertions.NullCheck(info, "info");
            if (_declaredObjectClasses.Contains(info))
            {
                throw new InvalidOperationException("ObjectClass already defined: " +
                        info.ObjectType);
            }
            _declaredObjectClasses.Add(info);
            foreach (SafeType<APIOperation> op in _defaultSupportedOperations)
            {
                if (ObjectClassOperation(op))
                {
                    ICollection<ObjectClassInfo> oclasses =
                        CollectionUtil.GetValue(_supportedObjectClassesByOperation, op, null);
                    if (oclasses == null)
                    {
                        oclasses = new HashSet<ObjectClassInfo>();
                        _supportedObjectClassesByOperation[op] = oclasses;
                    }
                    oclasses.Add(info);
                }
            }
        }

Same methods

SchemaBuilder::DefineObjectClass ( String type, ICollection attrInfo ) : void

Usage Example

Exemplo n.º 1
0
        public static Schema BuildSchema(Connector connector,
            GetSupportedObjectClassesDelegate getSupportedObjectClassesDelegate,
            GetObjectClassInfoDelegate getObjectClassInfoDelegate,
            GetSupportedOperationsDelegate getSupportedOperationsDelegate,
            GetUnSupportedOperationsDelegate getUnSupportedOperationsDelegate)
        {
            SchemaBuilder schemaBuilder = new SchemaBuilder(SafeType<Connector>.Get(connector));

            //iterate through supported object classes
            foreach (ObjectClass oc in getSupportedObjectClassesDelegate()) {
                ObjectClassInfo ocInfo = getObjectClassInfoDelegate(oc);
                Assertions.NullCheck(ocInfo, "ocInfo");

                //add object class to schema
                schemaBuilder.DefineObjectClass(ocInfo);

                //add supported operations
                IList<SafeType<SPIOperation>> supportedOps = getSupportedOperationsDelegate(oc);
                if (supportedOps != null) {
                    foreach (SafeType<SPIOperation> op in supportedOps) {
                        schemaBuilder.AddSupportedObjectClass(op, ocInfo);
                    }
                }

                //remove unsupported operatons
                IList<SafeType<SPIOperation>> unSupportedOps = getUnSupportedOperationsDelegate(oc);
                if (unSupportedOps != null) {
                    foreach (SafeType<SPIOperation> op in unSupportedOps) {
                        schemaBuilder.RemoveSupportedObjectClass(op, ocInfo);
                    }
                }
            }
            LOGGER.TraceEvent(TraceEventType.Verbose, CAT_DEFAULT, "Finished retrieving schema");
            return schemaBuilder.Build();
        }