示例#1
0
 private List createAllPropertiesNames() throws XavaException {
   List result = new ArrayList();
   // First the properties from a possible @EmbeddedId
   for (Iterator itRef = getMetaModel().getMetaReferencesKey().iterator(); itRef.hasNext(); ) {
     MetaReference ref = (MetaReference) itRef.next();
     if (ref.isAggregate()) {
       for (Iterator itKey =
               ref.getMetaModelReferenced()
                   .getPropertiesNamesWithoutHiddenNorTransient()
                   .iterator();
           itKey.hasNext(); ) {
         result.add(ref.getName() + "." + itKey.next());
       }
     }
   }
   // Now the plain properties
   result.addAll(getMetaModel().getPropertiesNamesWithoutHiddenNorTransient());
   return result;
 }
 private String transformAgregateProperty(String property) {
   StringBuffer result = new StringBuffer();
   StringTokenizer st = new StringTokenizer(property, ".");
   String member = "";
   while (st.hasMoreTokens()) {
     String token = st.nextToken();
     result.append(token);
     if (!st.hasMoreTokens()) break;
     member = member + token;
     try {
       MetaReference ref = getMetaModel().getMetaReference(member);
       if (ref.isAggregate()) result.append('_');
       else result.append('.');
     } catch (XavaException ex) {
       result.append('.');
     }
     member = member + ".";
   }
   return result.toString();
 }
  public int doStartTag() throws JspException {
    try {
      HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
      ModuleContext context = (ModuleContext) request.getSession().getAttribute("context");

      String viewObject = request.getParameter("viewObject");
      viewObject = (viewObject == null || viewObject.equals("")) ? "xava_view" : viewObject;
      View view = (View) context.get(request, viewObject);

      MetaReference metaReference = view.getMetaReference(reference).cloneMetaReference();
      metaReference.setName(reference);
      String prefix = request.getParameter("propertyPrefix");
      prefix = prefix == null ? "" : prefix;
      String application = request.getParameter("application");
      String module = request.getParameter("module");
      String referenceKey = Ids.decorate(application, module, prefix + reference);
      request.setAttribute(referenceKey, metaReference);
      String editorURL =
          "reference.jsp?referenceKey="
              + referenceKey
              + "&onlyEditor=true&frame=false&composite=false&descriptionsList=true";
      String editorPrefix = Module.isPortlet() ? "/WEB-INF/jsp/xava/" : "/xava/";
      try {
        pageContext.include(editorPrefix + editorURL);
      } catch (ServletException ex) {
        Throwable cause = ex.getRootCause() == null ? ex : ex.getRootCause();
        log.error(cause.getMessage(), cause);
        pageContext.include(editorPrefix + "editors/notAvailableEditor.jsp");
      } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        pageContext.include(editorPrefix + "editors/notAvailableEditor.jsp");
      }
    } catch (Exception ex) {
      log.error(ex.getMessage(), ex);
      throw new JspException(XavaResources.getString("descriptionsList_tag_error", reference));
    }
    return SKIP_BODY;
  }
示例#4
0
 public boolean hasReferenceMapping(MetaReference metaReference) {
   if (referenceMappings == null) return false;
   return referenceMappings.containsKey(metaReference.getName());
 }