Пример #1
0
  private void processCreateModelRequest(
      VitroRequest vreq, ModelMaker maker, WhichService modelType) {
    String modelName = vreq.getParameter("modelName");

    if (modelName != null) {
      try {
        URI graphURI = new URI(modelName);

        if (graphURI.getScheme() == null) {
          String origName = modelName;
          modelName = CREATED_GRAPH_BASE_URI + modelName;
          log.info("The model name has been changed from " + origName + " to " + modelName);
        }

        doCreateModel(modelName, maker);
        showModelList(vreq, maker, modelType);
      } catch (URISyntaxException e) {
        throw new RuntimeException("the model name must be a valid URI");
      }
    } else {
      vreq.setAttribute("modelType", modelType.toString());
      vreq.setAttribute("title", "Create New Model");
      vreq.setAttribute("bodyJsp", CREATE_MODEL_JSP);
    }
  }
Пример #2
0
 protected void showModelList(VitroRequest vreq, ModelMaker maker, WhichService modelType) {
   vreq.setAttribute("modelType", modelType.toString());
   if (modelType == CONTENT) {
     vreq.setAttribute("infoLine", "Main Store models");
   } else {
     vreq.setAttribute("infoLine", "Configuration models");
   }
   vreq.setAttribute("modelNames", maker.listModels().toList());
   vreq.setAttribute("bodyAttr", "onLoad=\"init()\"");
   vreq.setAttribute("title", "Available Models");
   vreq.setAttribute("bodyJsp", LIST_MODELS_JSP);
 }