for(int i = 0; i < sortedObjectList.size(); i++) {
extractReputationFromEntity(repImp, sortedObjectList.get(i),importationUnit,
entity, algorithmsImpl, reputations);
}
} else if(systems.getObject() instanceof CollectingSystemBehaviour) {
CollectingSystemBehaviour system = (CollectingSystemBehaviour)systems.getObject();
//It was checked before
/*for(Community community : entity.getIdentificatorInCommunities().keySet()) {
if(community != importationUnit.getImportedCommunity()) {
continue;
}
}*/
try {
Map<Metric,List<Object>> reputation = null;
if(system.getRoot().getObjectClass() != null) {
String className = system.getRoot().getObjectClass();
Class classImpl = Class.forName(className);
//Erase previous objects that are instances of the class of this new object
for(int i = 0; i < algorithmsImpl.size(); i++) {
Object algorithmObj = algorithmsImpl.get(i);
if(!classImpl.isInstance(algorithmObj)) {
continue;
}
ModelException.sendMessage(ModelException.WARNING,
"Previous object(class:"+algorithmObj.getClass()+" was instance" +
" of the class of a new object(class"+classImpl+")");
algorithmsImpl.remove(i);
i--;
}
algorithmsImpl.add(classImpl.newInstance());
}
if(system.getRoot().getAlgorithmPath() != null) {
reputation = executeAlgorithm(algorithmsImpl,repImp, importationUnit,system,
entity, system.getRoot().getAlgorithmPath());
} else {
reputation = ExtractReputationByDefaultMethods(
repImp, importationUnit, system, entity);
}
//Add new imported Reputation to stored imported Reputation
if(reputation != null && reputation.size() > 0) {
if(reputations.containsKey(system.getRoot())) {
ModelException.sendMessage(ModelException.ERROR,
"CollectingSystem(resource:"+system.getRoot().getResource()+
") already exists in previous imported reputation from the same"
+"ImportationUnit(res:"+importationUnit.getResource()+"in the"
+"same ReputationImporter(res:"+repImp.getRoot().getResource()+")");
for(Metric metric : reputation.keySet()) {
if(reputations.get(system.getRoot()).containsKey(metric)) {
reputations.get(system.getRoot()).get(metric).addAll(
reputation.get(metric));
} else {
reputations.get(system.getRoot()).put(metric,reputation.get(metric));
}
}
} else {
reputations.put(system.getRoot(), reputation);
}
}
} catch(MalformedURLException e) {
ModelException.throwException(ModelException.EXTRACT_REPUTATION_URL,
e.getMessage()+"("+e.getClass()+")");