git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@131198 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0dbccf3db8
commit
23b4ffe784
4
.project
4
.project
|
@ -16,12 +16,12 @@
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
<wb-module deploy-name="accounting-analytics">
|
||||||
|
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||||
|
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
|
||||||
|
</wb-module>
|
||||||
|
</project-modules>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<faceted-project>
|
||||||
|
<installed facet="java" version="1.7"/>
|
||||||
|
<installed facet="jst.utility" version="1.0"/>
|
||||||
|
</faceted-project>
|
|
@ -0,0 +1,2 @@
|
||||||
|
disabled=06target
|
||||||
|
eclipse.preferences.version=1
|
3
pom.xml
3
pom.xml
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.accounting</groupId>
|
<groupId>org.gcube.accounting</groupId>
|
||||||
<artifactId>accounting-analytics</artifactId>
|
<artifactId>accounting-analytics</artifactId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>2.2.0-SNAPSHOT</version>
|
||||||
<name>accounting-analytics</name>
|
<name>accounting-analytics</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -78,6 +78,7 @@
|
||||||
<version>1.0.13</version>
|
<version>1.0.13</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -74,9 +74,6 @@ public class NumberedFilter extends Filter {
|
||||||
|
|
||||||
public int compareTo(NumberedFilter numberedFilter) {
|
public int compareTo(NumberedFilter numberedFilter) {
|
||||||
int compareResult = this.d.compareTo(numberedFilter.d);
|
int compareResult = this.d.compareTo(numberedFilter.d);
|
||||||
if(compareResult==0){
|
|
||||||
super.compareTo(numberedFilter);
|
|
||||||
}
|
|
||||||
return compareResult;
|
return compareResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,11 +162,11 @@ public class TemporalConstraint {
|
||||||
int calendarValue = calendarValues[aggregationMode.ordinal()].getCalendarValue();
|
int calendarValue = calendarValues[aggregationMode.ordinal()].getCalendarValue();
|
||||||
|
|
||||||
Calendar alignedStartTime = getAlignedStartTime();
|
Calendar alignedStartTime = getAlignedStartTime();
|
||||||
logger.trace("Aligned StartTime : {}", timeInMillisToString(alignedStartTime.getTimeInMillis()));
|
//logger.trace("Aligned StartTime : {}", timeInMillisToString(alignedStartTime.getTimeInMillis()));
|
||||||
|
|
||||||
Calendar alignedEndTime = getAlignedEndTime();
|
Calendar alignedEndTime = getAlignedEndTime();
|
||||||
long alignedEndTimeInMillis = alignedEndTime.getTimeInMillis();
|
long alignedEndTimeInMillis = alignedEndTime.getTimeInMillis();
|
||||||
logger.trace("Aligned EndTime : {}", timeInMillisToString(alignedEndTime.getTimeInMillis()));
|
//logger.trace("Aligned EndTime : {}", timeInMillisToString(alignedEndTime.getTimeInMillis()));
|
||||||
|
|
||||||
Calendar progressTime = Calendar.getInstance();
|
Calendar progressTime = Calendar.getInstance();
|
||||||
progressTime.setTimeZone(DEFAULT_TIME_ZONE);
|
progressTime.setTimeZone(DEFAULT_TIME_ZONE);
|
||||||
|
|
|
@ -41,6 +41,7 @@ public abstract class AccountingPersistenceBackendQueryFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountingPersistenceBackendQuery accountingPersistenceQuery = accountingPersistenceQueries.get(scope);
|
AccountingPersistenceBackendQuery accountingPersistenceQuery = accountingPersistenceQueries.get(scope);
|
||||||
|
logger.debug("Scope {}", scope);
|
||||||
if(accountingPersistenceQuery==null){
|
if(accountingPersistenceQuery==null){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -49,24 +50,26 @@ public abstract class AccountingPersistenceBackendQueryFactory {
|
||||||
Class<? extends AccountingPersistenceBackendQuery> foundClass=null;
|
Class<? extends AccountingPersistenceBackendQuery> foundClass=null;
|
||||||
try {
|
try {
|
||||||
foundClass = found.getClass();
|
foundClass = found.getClass();
|
||||||
|
logger.debug("Testing foundClass{}", foundClass.toString());
|
||||||
String foundClassName = foundClass.getSimpleName();
|
String foundClassName = foundClass.getSimpleName();
|
||||||
logger.debug("Testing {}", foundClassName);
|
logger.debug("Testing foundClassName{}", foundClassName);
|
||||||
AccountingPersistenceBackendQueryConfiguration configuration = new AccountingPersistenceBackendQueryConfiguration(foundClass);
|
AccountingPersistenceBackendQueryConfiguration configuration = new AccountingPersistenceBackendQueryConfiguration(foundClass);
|
||||||
found.prepareConnection(configuration);
|
found.prepareConnection(configuration);
|
||||||
accountingPersistenceQuery = found;
|
accountingPersistenceQuery = found;
|
||||||
break;
|
break;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(String.format("%s not initialized correctly. It will not be used", foundClass.getSimpleName()));
|
logger.error(String.format("%s not initialized correctly. It will not be used", foundClass.getSimpleName()),e);
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(Exception e){
|
} catch(Exception e){
|
||||||
logger.error(String.format("service loader or not initialized correctly."));
|
logger.error(String.format("service loader or not initialized correctly."));
|
||||||
|
e.printStackTrace();
|
||||||
throw new NoUsableAccountingPersistenceQueryFound(e.getLocalizedMessage());
|
throw new NoUsableAccountingPersistenceQueryFound(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(accountingPersistenceQuery==null){
|
if(accountingPersistenceQuery==null){
|
||||||
logger.error(String.format("accountingPersistenceQuery null"));
|
logger.error(String.format("accountingPersistenceQuery null"));
|
||||||
throw new NoUsableAccountingPersistenceQueryFound();
|
throw new NoUsableAccountingPersistenceQueryFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,10 +168,6 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
|
||||||
String topKey, String orderingProperty, boolean pad, int limit)
|
String topKey, String orderingProperty, boolean pad, int limit)
|
||||||
throws DuplicatedKeyFilterException, KeyException, ValueException,
|
throws DuplicatedKeyFilterException, KeyException, ValueException,
|
||||||
Exception {
|
Exception {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> got;
|
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> got;
|
||||||
|
|
||||||
if(orderingProperty==null){
|
if(orderingProperty==null){
|
||||||
|
@ -182,15 +178,13 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
|
||||||
.getTopValues(clz, temporalConstraint, filters, topKey,
|
.getTopValues(clz, temporalConstraint, filters, topKey,
|
||||||
orderingProperty);
|
orderingProperty);
|
||||||
|
|
||||||
|
|
||||||
int count = got.size() > limit ? limit : got.size();
|
int count = got.size() > limit ? limit : got.size();
|
||||||
|
|
||||||
NumberedFilter firstRemovalKey = null;
|
NumberedFilter firstRemovalKey = null;
|
||||||
|
|
||||||
for(NumberedFilter nf : got.keySet()){
|
for(NumberedFilter nf : got.keySet()){
|
||||||
if(--count>=0 || limit<=0){
|
if(--count>=0 || limit<=0){
|
||||||
if(pad){
|
if(pad){
|
||||||
padMap(got.get(nf), temporalConstraint);
|
padMap(got.get(nf), temporalConstraint);
|
||||||
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(firstRemovalKey==null){
|
if(firstRemovalKey==null){
|
||||||
|
@ -200,11 +194,9 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(firstRemovalKey!=null){
|
if(firstRemovalKey!=null){
|
||||||
return got.subMap(got.firstKey(), firstRemovalKey);
|
return got.subMap(got.firstKey(), firstRemovalKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return got;
|
return got;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
|
||||||
<logger name="org.gcube" level="TRACE" />
|
<logger name="org.gcube" level="DEBUG" />
|
||||||
|
|
||||||
<root level="WARN">
|
<root level="WARN">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
Loading…
Reference in New Issue