Package atg.service.idgen

Examples of atg.service.idgen.IdGenerator


        if ( r == null ) {
            return null;
        }

        // get the generator to use
        IdGenerator gen = r.getIdGenerator();
        if ( gen == null ) {
            return null;
        }

        Class<?>[] types = desc.getIdTypes();
        String[] idSpaceNames = desc.getIdSpaceNames();
        Object[] newId = new Object[types.length];

        if ( idSpaceNames.length != types.length ) {
            throw new RepositoryException("No ID SPACES ! " + desc.getItemDescriptorName());
        }

        // generate an id in our id space and return it
        try {
            for ( int i = 0; i < types.length; i++ ) {
                if ( types[i] == String.class ) {
                    if ( i > 0 ) {
                        newId[i] = "dummyIdPart";
                    } else {
                        newId[i] = gen.generateStringId(idSpaceNames[i]);
                    }
                } else {
                    long val = gen.generateLongId(idSpaceNames[i]);
                    if ( types[i] == Long.class ) {
                        newId[i] = val;
                    } else if ( types[i] == Float.class ) {
                        newId[i] = (float) val;
                    } else if ( types[i] == Double.class ) {
View Full Code Here

TOP

Related Classes of atg.service.idgen.IdGenerator

Copyright © 2018 www.massapicom. 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.