*/
public boolean correspondsTo(ContextEntry ce) {
if (ce==null) {
return false;
}
OLATResourceable ceResourceable = ce.getOLATResourceable();
if (ceResourceable==null) {
return false;
}
if (resourceable_!=null) {
if (ceResourceable.getResourceableTypeName().equals(resourceable_.getResourceableTypeName()) &&
ceResourceable.getResourceableId().equals(resourceable_.getResourceableId())) {
return true;
}
if (ceResourceable instanceof RepositoryEntry) {
RepositoryEntry re = (RepositoryEntry) ceResourceable;
OLATResource ores = re.getOlatResource();
if (ores!=null &&
ores.getResourceableTypeName().equals(resourceable_.getResourceableTypeName()) &&
ores.getResourceableId().equals(resourceable_.getResourceableId())) {
return true;
}
} else if (OresHelper.calculateTypeName(RepositoryEntry.class).equals(ceResourceable.getResourceableTypeName())) {
// @TODO: Performance hit! Speed optimize this!
// OLAT-4996
// OLAT-4955
// that's the jump-in case where the ContextEntry says it has a [RepositoryEntry:123212321] but
// the actual class of ceResourceable is not a RepositoryEntry but an OresHelper$3 ...
// in which case all we have is the key of the repositoryentry and we must make a DB lookup to
// map the repo key to the corresponding olatresource
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(ceResourceable.getResourceableId());
if (re!=null) {
OLATResource ores = re.getOlatResource();
if (ores!=null &&
ores.getResourceableTypeName().equals(resourceable_.getResourceableTypeName()) &&
ores.getResourceableId().equals(resourceable_.getResourceableId())) {
return true;
}
}
}
return ceResourceable.equals(resourceable_);
}
// if resourceable_ is null it's rather difficult to compare us with the contextentry
// we still try...
if (type_.equals(StringResourceableType.targetIdentity.name()) &&
ceResourceable.getResourceableTypeName()=="Identity") {
return id_.equals(String.valueOf(ceResourceable.getResourceableId()));
}
return false;
}