Example #1
0
 public static String getFullPath(CategorizedDescriptor entity, Category category) {
   String path = entity.getName();
   while (category != null) {
     path = category.getName() + "/" + path;
     category = category.getCategory();
   }
   return path;
 }
Example #2
0
 public static void openEditor(CategorizedDescriptor d) {
   if (d == null) {
     log.error("model is null, could not open editor");
     return;
   }
   log.trace("open editor for {} ", d);
   String editorId = getEditorId(d.getModelType());
   if (editorId == null) log.error("could not find editor for model {}", d);
   else {
     ModelEditorInput input = new ModelEditorInput(d);
     Editors.open(input, editorId);
   }
 }
Example #3
0
 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;
 }