Package org.dmd.dmr.server.ldap.generated.auxw

Source Code of org.dmd.dmr.server.ldap.generated.auxw.LDAPClassAUX

//  ---------------------------------------------------------------------------
//  dark-matter-data
//  Copyright (c) 2010 dark-matter-data committers
//  ---------------------------------------------------------------------------
//  This program is free software; you can redistribute it and/or modify it
//  under the terms of the GNU Lesser General Public License as published by the
//  Free Software Foundation; either version 3 of the License, or (at your
//  option) any later version.
//  This program is distributed in the hope that it will be useful, but WITHOUT
//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
//  more details.
//  You should have received a copy of the GNU Lesser General Public License along
//  with this program; if not, see <http://www.gnu.org/licenses/lgpl.html>.
//  ---------------------------------------------------------------------------
package org.dmd.dmr.server.ldap.generated.auxw;

import org.dmd.dms.generated.enums.ValueTypeEnum;
import org.dmd.dms.generated.enums.DataTypeEnum;
// Generated from: org.dmd.dmg.generators.BaseDMWGeneratorNew.formatImports(BaseDMWGeneratorNew.java:855)
import org.dmd.dmc.*;                                                       // If any attributes
import org.dmd.dms.*;                                                       // Always 2
import org.dmd.dms.generated.dmw.AttributeDefinitionDMW;                    // Is reference type aux
import org.dmd.dms.generated.types.AttributeDefinitionREF;                  // To support getMVCopy() for REFs
import org.dmd.dms.generated.types.DmcTypeAttributeDefinitionREFSV;         // Reference in an auxiliary class
import org.dmd.dms.generated.types.DmcTypeStringSV;                         // Type in an auxiliary class
import org.dmd.dmw.DmwWrapper;                                              // Unnamed object wrapper

/**
* The LDAPSchemaExtension class is used to extend the basic SchemaDefinition
* class with information required to map objects onto an LDAP repository.
* <P>
* Generated from the dmr.ldap schema at version 0.1
* <P>
* This code was auto-generated by the dmogenerator utility and shouldn't be alterred manually!
* Generated from: org.dmd.dmg.generators.BaseDMWGeneratorNew.dumpAUX(BaseDMWGeneratorNew.java:510)
*/
public class LDAPClassAUX {

    public final static ClassDefinition _auxClass = org.dmd.dmr.server.ldap.generated.DmrLdapSchemaAG._LDAPClassAUX;
    public final static DmcAttributeInfo __reposName = new DmcAttributeInfo("reposName",451,"String",ValueTypeEnum.SINGLE,DataTypeEnum.PERSISTENT);
    public final static DmcAttributeInfo __namingAttribute = new DmcAttributeInfo("namingAttribute",64,"AttributeDefinitionREF",ValueTypeEnum.SINGLE,DataTypeEnum.PERSISTENT);

    /**
     * This method will check to see if the object has any of our attributes.
     * If not, our aux class is automatically removed from the object.
     */
    // org.dmd.dmg.generators.BaseDMWGeneratorNew.getCommonAUXFunctions(BaseDMWGeneratorNew.java:2041)
    static private void removeAuxIfRequired(DmwWrapper corew){
        boolean anyLeft = false;

        if (corew.getDmcObject().get(__reposName) != null)
            anyLeft = true;
        if (corew.getDmcObject().get(__namingAttribute) != null)
            anyLeft = true;

        if (!anyLeft)
            corew.removeAux(_auxClass);
    }

    /**
     * This method will check to see if the object has our aux class.
     * If not, we add our aux class the object.
     */
    // org.dmd.dmg.generators.BaseDMWGeneratorNew.getCommonAUXFunctions(BaseDMWGeneratorNew.java:2059)
    static private void addAuxIfRequired(DmwWrapper corew) throws DmcValueException {
        if (!corew.hasAux(_auxClass))
            corew.addAux(_auxClass);
    }

    /**
     * This method checks if the object has this auxiliary class.
     */
    // org.dmd.dmg.generators.BaseDMWGeneratorNew.getCommonAUXFunctions(BaseDMWGeneratorNew.java:2069)
    static public boolean hasAux(DmwWrapper corew){
        if (corew == null)
            return(false);
        return(corew.hasAux(_auxClass));
    }

    /**
     * Removes the reposName attribute from the object.
     */
    // org.dmd.dmg.generators.BaseDMWGeneratorNew.formatAUXSV(BaseDMWGeneratorNew.java:2163)
    static public DmcAttribute<?> remReposName(DmwWrapper corew){
        if (corew == null)
            return(null);
        DmcAttribute<?> rc = corew.getDmcObject().rem(__reposName);
        removeAuxIfRequired(corew);
        return(rc);
    }

    // org.dmd.dmg.generators.BaseDMWGeneratorNew.formatAUXSV(BaseDMWGeneratorNew.java:2194)
    static public String getReposName(DmwWrapper corew){
        DmcTypeStringSV attr = (DmcTypeStringSV) corew.getDmcObject().get(__reposName);
        if (attr == null)
            return(null);

        return(attr.getSV());
    }

    /**
     * Sets reposName to the specified value.
     * @param value A value compatible with DmcTypeStringSV
     */
    // org.dmd.dmg.generators.BaseDMWGeneratorNew.formatAUXSV(BaseDMWGeneratorNew.java:2234)
    static public void setReposName(DmwWrapper corew, Object value) throws DmcValueException {
        DmcAttribute<?> attr = corew.getDmcObject().get(__reposName);
        if (attr == null){
            attr = new DmcTypeStringSV();
            addAuxIfRequired(corew);
        }
       
        attr.set(value);
        corew.getDmcObject().set(__reposName,attr);
    }

    /**
     * Removes the namingAttribute attribute from the object.
     */
    // org.dmd.dmg.generators.BaseDMWGeneratorNew.formatAUXSV(BaseDMWGeneratorNew.java:2163)
    static public DmcAttribute<?> remNamingAttribute(DmwWrapper corew){
        if (corew == null)
            return(null);
        DmcAttribute<?> rc = corew.getDmcObject().rem(__namingAttribute);
        removeAuxIfRequired(corew);
        return(rc);
    }

    /**
     * @return A AttributeDefinitionDMW object.
     */
    // org.dmd.dmg.generators.BaseDMWGeneratorNew.formatAUXSV(BaseDMWGeneratorNew.java:2182)
    static public AttributeDefinitionDMW getNamingAttribute(DmwWrapper corew){
        DmcAttribute<?> attr = corew.getDmcObject().get(__namingAttribute);
        if (attr == null)
            return(null);
       
        AttributeDefinitionREF ref = (AttributeDefinitionREF) attr.getSV();
       
        return((AttributeDefinitionDMW)ref.getObject().getContainer());
    }

    /**
     * Sets the namingAttribute to the specified value.
     * @param value A value compatible with AttributeDefinitionREFREF
     */
    // org.dmd.dmg.generators.BaseDMWGeneratorNew.formatAUXSV(BaseDMWGeneratorNew.java:2217)
    static public void setNamingAttribute(DmwWrapper corew, Object value) throws DmcValueException {
        DmcAttribute<?> attr = corew.getDmcObject().get(__namingAttribute);
        if (attr == null){
            attr = new DmcTypeAttributeDefinitionREFSV();
            addAuxIfRequired(corew);
        }

        attr.set(value);
        corew.getDmcObject().set(__namingAttribute, attr);
    }




}
TOP

Related Classes of org.dmd.dmr.server.ldap.generated.auxw.LDAPClassAUX

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.