use of com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute in project entando-core by entando.
the class LinkAttributeHandler method startLink.
private void startLink(Attributes attributes, String qName) throws SAXException {
this._linkType = extractAttribute(attributes, "type", qName, true);
((LinkAttribute) this.getCurrentAttr()).setSymbolicLink(new SymbolicLink());
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute in project entando-core by entando.
the class LinkAttributeHandler method endLink.
private void endLink() {
SymbolicLink symLink = ((LinkAttribute) this.getCurrentAttr()).getSymbolicLink();
if (null != symLink && null != _linkType) {
if (_linkType.equals("content")) {
symLink.setDestinationToContent(_contentDest);
} else if (_linkType.equals("external")) {
symLink.setDestinationToUrl(_urlDest);
} else if (_linkType.equals("page")) {
symLink.setDestinationToPage(_pageDest);
} else if (_linkType.equals("contentonpage")) {
symLink.setDestinationToContentOnPage(_contentDest, _pageDest);
}
}
_contentDest = null;
_urlDest = null;
_pageDest = null;
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute in project entando-core by entando.
the class TestLinkAttributeAction method testRemoveLink.
public void testRemoveLink() throws Throwable {
String contentId = "ART102";
String contentOnSessionMarker = this.extractSessionMarker(contentId, ApsAdminSystemConstants.EDIT);
this.executeEdit(contentId, "admin");
Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
assertNotNull(currentContent);
LinkAttribute linkAttribute = (LinkAttribute) currentContent.getAttribute("VediAnche");
assertNotNull(linkAttribute);
SymbolicLink symbolicLink = linkAttribute.getSymbolicLink();
assertNotNull(symbolicLink);
assertEquals("ART111", symbolicLink.getContentDest());
this.initContentAction("/do/jacms/Content", "removeLink", contentOnSessionMarker);
this.addParameter("attributeName", "VediAnche");
this.addParameter("langCode", "it");
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
currentContent = this.getContentOnEdit(contentOnSessionMarker);
assertNotNull(currentContent);
linkAttribute = (LinkAttribute) currentContent.getAttribute("VediAnche");
assertNotNull(linkAttribute);
symbolicLink = linkAttribute.getSymbolicLink();
assertNull(symbolicLink);
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute in project entando-core by entando.
the class TestPageLinkAction method testJoinPageLink_1.
public void testJoinPageLink_1() throws Throwable {
String contentOnSessionMarker = this.initJoinLinkTest("admin", "ART1", "VediAnche", "it");
this.initContentAction("/do/jacms/Content/Link", "joinPageLink", contentOnSessionMarker);
this.addParameter("linkType", String.valueOf(SymbolicLink.PAGE_TYPE));
this.addParameter("selectedNode", "pagina_11");
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
Content content = this.getContentOnEdit(contentOnSessionMarker);
LinkAttribute attribute = (LinkAttribute) content.getAttribute("VediAnche");
SymbolicLink symbolicLink = attribute.getSymbolicLink();
assertNotNull(symbolicLink);
assertEquals("pagina_11", symbolicLink.getPageDest());
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute in project entando-core by entando.
the class LinkAttributeActionHelper method removeLink.
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);
}
}
Aggregations