if (lens) {
if (null != lenses) {
// find label lens for resource
Iterator<Lens> instancesIt = lenses.getInstanceLenses().iterator();
while (instancesIt.hasNext()) {
Lens check = instancesIt.next();
if (check.hasPurpose(new Purpose(FresnelCore.labelLens))) {
AggregateLabel labels = new AggregateLabel(applyLabelLens(check, in, focus, 0, MAXIMUM_LENS_DEPTH));
if (labels.getString().trim().equals(""))
continue;
else
return new Title(labels);
}
}
// find label lens for resource's type
Iterator<Lens> classesIt = lenses.getClassLenses().iterator();
while (classesIt.hasNext()) {
Lens check = classesIt.next();
if (check.hasPurpose(new Purpose(FresnelCore.labelLens))) {
AggregateLabel labels = new AggregateLabel(applyLabelLens(check, in, focus, 0, MAXIMUM_LENS_DEPTH));
if (labels.getString().trim().equals(""))
continue;
else
return new Title(labels);
}
}
}
if (null != instanceLenses) {
// find label lens for resource
Iterator<Lens> instancesIt = instanceLenses.getInstanceLenses().iterator();
while (instancesIt.hasNext()) {
Lens check = instancesIt.next();
if (check.hasPurpose(new Purpose(FresnelCore.labelLens))) {
AggregateLabel labels = new AggregateLabel(applyLabelLens(check, in, focus, 0, MAXIMUM_LENS_DEPTH));
if (labels.getString().trim().equals(""))
continue;
else
return new Title(labels);
}
}
}
if (null != classLenses) {
// find label lens for resource
Iterator<Lens> classesIt = classLenses.getClassLenses().iterator();
while (classesIt.hasNext()) {
Lens check = classesIt.next();
if (check.hasPurpose(new Purpose(FresnelCore.labelLens))) {
AggregateLabel labels = new AggregateLabel(applyLabelLens(check, in, focus, 0, MAXIMUM_LENS_DEPTH));
if (labels.getString().trim().equals(""))
continue;
else
return new Title(labels);