use of javax.persistence.Transient in project mycore by MyCoRe-Org.
the class MCRCategoryImpl method getRightSiblingOrOfAncestor.
@Transient
MCRCategoryImpl getRightSiblingOrOfAncestor() {
int index = getPositionInParent();
MCRCategoryImpl parent = (MCRCategoryImpl) getParent();
if (index + 1 < parent.getChildren().size()) {
// has right sibling
return (MCRCategoryImpl) parent.getChildren().get(index + 1);
}
if (parent.getParent() != null) {
// recursive call to get right sibling of parent
return parent.getRightSiblingOrOfAncestor();
}
// is root
return parent;
}
use of javax.persistence.Transient in project mycore by MyCoRe-Org.
the class MCRCategoryImpl method getLeftSiblingOrOfAncestor.
@Transient
MCRCategoryImpl getLeftSiblingOrOfAncestor() {
int index = getPositionInParent();
MCRCategoryImpl parent = (MCRCategoryImpl) getParent();
if (index > 0) {
// has left sibling
return (MCRCategoryImpl) parent.getChildren().get(index - 1);
}
if (parent.getParent() != null) {
// recursive call to get left sibling of parent
return parent.getLeftSiblingOrOfAncestor();
}
// is root
return parent;
}
use of javax.persistence.Transient in project mycore by MyCoRe-Org.
the class MCRCategoryImpl method getPositionInParentByID.
@Transient
private int getPositionInParentByID() {
int position = 0;
for (MCRCategory sibling : parent.getChildren()) {
if (getId().equals(sibling.getId())) {
return position;
}
position++;
}
if (LOGGER.isDebugEnabled()) {
StringBuilder sb = new StringBuilder("List of children of parent: ");
sb.append(parent.getId()).append('\n');
for (MCRCategory sibling : parent.getChildren()) {
sb.append(sibling.getId()).append('\n');
}
LOGGER.debug(sb.toString());
}
throw new IndexOutOfBoundsException("Position -1 is not valid: " + getId() + " parent:" + parent.getId() + " children: " + parent.getChildren().stream().map(MCRCategory::getId).map(MCRCategoryID::getID).collect(Collectors.joining(", ")));
}
use of javax.persistence.Transient in project mycore by MyCoRe-Org.
the class MCRCategoryImpl method getLeftSiblingOrParent.
@Transient
MCRCategoryImpl getLeftSiblingOrParent() {
int index = getPositionInParent();
MCRCategoryImpl parent = (MCRCategoryImpl) getParent();
if (index == 0) {
return parent;
}
return (MCRCategoryImpl) parent.getChildren().get(index - 1);
}
use of javax.persistence.Transient in project OpenClinica by OpenClinica.
the class RuleSetRuleBean method getAllActionsWithEvaluatesToAsKey.
@Transient
public HashMap<String, ArrayList<RuleActionBean>> getAllActionsWithEvaluatesToAsKey() {
HashMap<String, ArrayList<RuleActionBean>> h = new HashMap<String, ArrayList<RuleActionBean>>();
for (RuleActionBean action : actions) {
String key = action.getExpressionEvaluatesTo().toString();
if (h.containsKey(key)) {
h.get(key).add(action);
} else {
ArrayList<RuleActionBean> a = new ArrayList<RuleActionBean>();
a.add(action);
h.put(key, a);
}
}
return h;
}
Aggregations