public static String getFullPath(CategorizedDescriptor entity, Category category) { String path = entity.getName(); while (category != null) { path = category.getName() + "/" + path; category = category.getCategory(); } return path; }
public static Dataset toDataset(CategorizedDescriptor entity, Category category) { Dataset dataset = new Dataset(); dataset.refId = entity.getRefId(); dataset.type = entity.getModelType(); dataset.version = Version.asString(entity.getVersion()); dataset.lastChange = entity.getLastChange(); dataset.name = entity.getName(); ModelType categoryType = null; if (category != null) { dataset.categoryRefId = category.getRefId(); categoryType = category.getModelType(); } else { if (entity.getModelType() == ModelType.CATEGORY) categoryType = ((CategoryDescriptor) entity).getCategoryType(); else categoryType = entity.getModelType(); } dataset.categoryType = categoryType; dataset.fullPath = getFullPath(entity, category); return dataset; }
public static String getFullPath(Category category) { return getFullPath(Descriptors.toDescriptor(category), category.getCategory()); }