use of com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink in project entando-core by entando.
the class HypertextAttributeUtil method getSymbolicLinksOnText.
/**
* Restituisce la lista di Link Simbolici relativi ai link
* inseriti nel testo specificato.
* @param text Il testo da analizzare.
* @return La lista di link simbolici inserito internalmente al testo.
*/
public static List<SymbolicLink> getSymbolicLinksOnText(String text) {
List<SymbolicLink> links = new ArrayList<SymbolicLink>();
if (null != text && text.length() > 0) {
String temp = text;
String START_HREF = "href=\"" + SymbolicLink.SYMBOLIC_DEST_PREFIX;
String END_HREF = SymbolicLink.SYMBOLIC_DEST_POSTFIX + "\"";
while (temp.indexOf(START_HREF) > 0) {
int start = temp.indexOf(START_HREF);
int end = temp.indexOf(END_HREF);
if (start < end) {
String symbLinkString = temp.substring(start + 6, end + 2);
SymbolicLink symbLink = new SymbolicLink();
boolean isValidLink = symbLink.setSymbolicDestination(symbLinkString);
if (isValidLink) {
links.add(symbLink);
}
}
if (end > 0) {
temp = temp.substring(end + 2, temp.length() - 1);
} else {
temp = temp.substring(start + 6, temp.length() - 1);
}
}
}
return links;
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink 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.SymbolicLink 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.SymbolicLink in project entando-core by entando.
the class ContentWrapper method getContentLink.
/**
* Restituisce un URL simbolico che punta al contenuto stesso (link di
* tipo SymbolicLink.CONTENT_TYPE).
* @return Un URL simbolico da utilizzare come href in un tag <a>
*/
public String getContentLink() {
SymbolicLink link = new SymbolicLink();
link.setDestinationToContent(this.getId());
return link.getSymbolicDestination();
}
use of com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink 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);
}
Aggregations