コード例 #1
0
 protected void updateLink(
     AttributeInterface currentAttribute, String[] destinations, int destType) {
   if (destinations.length != 3) {
     throw new RuntimeException("Destinazioni non riconosciute");
   }
   SymbolicLink symbolicLink = new SymbolicLink();
   switch (destType) {
     case (SymbolicLink.CONTENT_TYPE):
       symbolicLink.setDestinationToContent(destinations[1]);
       break;
     case (SymbolicLink.CONTENT_ON_PAGE_TYPE):
       symbolicLink.setDestinationToContentOnPage(destinations[1], destinations[2]);
       break;
     case SymbolicLink.PAGE_TYPE:
       symbolicLink.setDestinationToPage(destinations[2]);
       break;
     case SymbolicLink.URL_TYPE:
       symbolicLink.setDestinationToUrl(destinations[0]);
       break;
     default:
       symbolicLink.setDestinationToContent("");
       break;
   }
   ((LinkAttribute) currentAttribute).setSymbolicLink(symbolicLink);
 }
コード例 #2
0
 protected void removeLink(AttributeInterface attribute, HttpServletRequest request) {
   HttpSession session = request.getSession();
   if (attribute instanceof CompositeAttribute) {
     String includedAttributeName =
         (String) session.getAttribute(INCLUDED_ELEMENT_NAME_SESSION_PARAM);
     AttributeInterface includedAttribute =
         ((CompositeAttribute) attribute).getAttribute(includedAttributeName);
     removeLink(includedAttribute, request);
   } else if (attribute instanceof LinkAttribute) {
     ((LinkAttribute) attribute).setSymbolicLink(null);
     ((LinkAttribute) attribute).getTextMap().clear();
   } else if (attribute instanceof MonoListAttribute) {
     Integer elementIndex = (Integer) session.getAttribute(LIST_ELEMENT_INDEX_SESSION_PARAM);
     AttributeInterface attributeElement =
         ((MonoListAttribute) attribute).getAttribute(elementIndex.intValue());
     removeLink(attributeElement, request);
   }
 }