* @param usedArticles
* @return ordrelinje
*/
private OrderLine getOrderLine(ArticleTypeTreeNode leaf,
List<OrderLine> orderLines1, List<ArticleType> usedArticles) {
ArticleTypeTreeNode parent = leaf.getParent();
Object object = parent.getObject();
ArticleType articleType=null;
if (object instanceof ArticleTypeArticleType) {
articleType = ((ArticleTypeArticleType) object).getArticleTypeRef();
} else if(object instanceof ArticleType){
articleType = (ArticleType) object;
}
if (usedArticles == null) {
usedArticles = new ArrayList<ArticleType>();
}
if(articleType!=null){
usedArticles.add(articleType);
}
//if (parent.getParent() == null) {
if (parent.getParent() != null&&parent.getParent().getObject() instanceof ArrayListModel) {
return setOrderLineRefs(articleType, null, orderLines1,
usedArticles);
}
return getOrderLine(parent, orderLines1, usedArticles);
}