/*
*
* Copyright 2005 AgileTec s.r.l. (http://www.agiletec.it) All rights reserved.
*
* This file is part of jAPS software.
* jAPS is a free software;
* you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; version 2.
*
* See the file License for the specific language governing permissions
* and limitations under the License
*
*
*
* Copyright 2005 AgileTec s.r.l. (http://www.agiletec.it) All rights reserved.
*
*/
package com.agiletec.plugins.jacms.apsadmin.content.attribute.action.link;
import javax.servlet.http.HttpSession;
import com.agiletec.apsadmin.system.BaseAction;
import com.agiletec.plugins.jacms.aps.system.services.content.model.Content;
import com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink;
import com.agiletec.plugins.jacms.apsadmin.content.ContentActionConstants;
import com.agiletec.plugins.jacms.apsadmin.content.attribute.action.link.helper.ILinkAttributeActionHelper;
/**
* Classe action delegata alla gestione dei link esterni nelle
* operazioni sugli attributi tipo Link.
* @author E.Santoboni
*/
public class UrlLinkAction extends BaseAction {
/**
* Gestisce la richiesta di associazione di un link esterno.
* @return Il codice del risultato.
*/
public String joinUrlLink() {
String[] destinations = {this.getUrl(), null, null};
this.buildEntryContentAnchorDest();
this.getLinkAttributeHelper().joinLink(destinations, SymbolicLink.URL_TYPE, this.getRequest());
return SUCCESS;
}
private void buildEntryContentAnchorDest() {
HttpSession session = this.getRequest().getSession();
String anchorDest = this.getLinkAttributeHelper().buildEntryContentAnchorDest(session);
this.setEntryContentAnchorDest(anchorDest);
}
/**
* Restituisce il contenuto in sesione.
* @return Il contenuto in sesione.
*/
public Content getContent() {
return (Content) this.getRequest().getSession().getAttribute(ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT);
}
public SymbolicLink getSymbolicLink() {
return (SymbolicLink) this.getRequest().getSession().getAttribute(ILinkAttributeActionHelper.SYMBOLIC_LINK_SESSION_PARAM);
}
public String getUrl() {
return _url;
}
public void setUrl(String url) {
this._url = url;
}
public String getEntryContentAnchorDest() {
if (null == this._entryContentAnchorDest) {
this.buildEntryContentAnchorDest();
}
return _entryContentAnchorDest;
}
protected void setEntryContentAnchorDest(String entryContentAnchorDest) {
this._entryContentAnchorDest = entryContentAnchorDest;
}
/**
* Restituisce la classe helper della gestione degli attributi di tipo Link.
* @return La classe helper degli attributi di tipo Link.
*/
protected ILinkAttributeActionHelper getLinkAttributeHelper() {
return _linkAttributeHelper;
}
/**
* Setta la classe helper della gestione degli attributi di tipo Link.
* @param linkAttributeHelper La classe helper degli attributi di tipo Link.
*/
public void setLinkAttributeHelper(ILinkAttributeActionHelper linkAttributeHelper) {
this._linkAttributeHelper = linkAttributeHelper;
}
private String _url;
private String _entryContentAnchorDest;
private ILinkAttributeActionHelper _linkAttributeHelper;
}