53 lines
1.7 KiB
Java
53 lines
1.7 KiB
Java
package org.gcube.data.access.accounting.summary.access.test;
|
|
|
|
import java.sql.SQLException;
|
|
import java.util.Date;
|
|
import java.util.GregorianCalendar;
|
|
|
|
import org.gcube.accounting.accounting.summary.access.AccountingDao;
|
|
import org.gcube.accounting.accounting.summary.access.ParameterException;
|
|
import org.gcube.accounting.accounting.summary.access.impl.AccountingDaoImpl;
|
|
import org.gcube.accounting.accounting.summary.access.impl.Queries;
|
|
import org.gcube.accounting.accounting.summary.access.model.MeasureResolution;
|
|
import org.gcube.accounting.accounting.summary.access.model.Report;
|
|
import org.gcube.accounting.accounting.summary.access.model.ScopeDescriptor;
|
|
|
|
public class SimpleTest {
|
|
|
|
public static void main(String[] args) throws ParameterException, Exception {
|
|
TokenSetter.set("/d4science.research-infrastructures.eu");
|
|
// AccountingDao dao=AccountingDao.get();
|
|
AccountingDao dao=AccountingDao.get(new DummyContextTreeProvider());
|
|
|
|
ScopeDescriptor desc=dao.getTree(null);
|
|
|
|
|
|
System.out.println(desc);
|
|
|
|
// Date from=new Date(1514764800000l);
|
|
|
|
Date from=new GregorianCalendar(2017,0,1).getTime();
|
|
Date to=new GregorianCalendar(2018,7,1).getTime();
|
|
|
|
// Date to=from;
|
|
|
|
scan(desc,from,to,dao);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
private static void scan(ScopeDescriptor desc, Date from, Date to, AccountingDao dao) throws ParameterException, SQLException {
|
|
System.out.println("**********************************************************************************************************");
|
|
System.out.println(desc);
|
|
System.out.println(dao.getReportByScope(desc, from, to, MeasureResolution.MONTHLY));
|
|
// if(desc.hasChildren()) {
|
|
// for(ScopeDescriptor child:desc.getChildren())
|
|
// scan(child,from,to,dao);
|
|
// }
|
|
}
|
|
|
|
|
|
}
|