@@ -0,0 +1,2673 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage ro.nextreports.server.etl;%0A%0Aimport com.orientechnologies.orient.core.db.document.ODatabaseDocument;%0Aimport com.orientechnologies.orient.core.metadata.schema.OClass;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.List;%0A%0A/**%0A * @author Decebal Suiu%0A */%0Apublic class OrientDbUtils %7B%0A%0A    public static long getDatabaseSize(ODatabaseDocument database) %7B%0A        return database.getSize();%0A    %7D%0A%0A    public static List%3CClassMetadata%3E getDatabaseClasses(ODatabaseDocument database) %7B%0A        Collection%3COClass%3E classes = database.getMetadata().getSchema().getClasses();%0A%0A        List%3CClassMetadata%3E result = new ArrayList%3CClassMetadata%3E();%0A        for (OClass clazz : classes) %7B%0A            result.add(new ClassMetadata(clazz.getName(), clazz.count(), clazz.getSize()));%0A        %7D%0A%0A        return result;%0A    %7D%0A%0A    public static List%3CClassMetadata%3E getDatabaseClasses(ODatabaseDocument database, String prefix) %7B%0A        Collection%3COClass%3E classes = database.getMetadata().getSchema().getClasses();%0A%0A        List%3CClassMetadata%3E result = new ArrayList%3CClassMetadata%3E();%0A        for (OClass clazz : classes) %7B%0A            if (clazz.getName().startsWith(prefix)) %7B%0A                result.add(new ClassMetadata(clazz.getName(), clazz.count(), clazz.getSize()));%0A            %7D%0A        %7D%0A%0A        return result;%0A    %7D%0A%0A    public static class ClassMetadata %7B%0A%0A        private String name;%0A        private long records;%0A        private long size;%0A%0A        public ClassMetadata(String name, long records, long size) %7B%0A            this.name = name;%0A            this.records = records;%0A            this.size = size;%0A        %7D%0A%0A        public String getName() %7B%0A            return name;%0A        %7D%0A%0A        public long getRecords() %7B%0A            return records;%0A        %7D%0A%0A        public long getSize() %7B%0A            return size;%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

add some useful methods related to orientdb