use of com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface in project entando-core by entando.
the class LinkAttributeActionHelper method getLinkAttribute.
protected AttributeInterface getLinkAttribute(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);
return getLinkAttribute(includedAttribute, request);
} else if (attribute instanceof MonoListAttribute) {
Integer elementIndex = (Integer) session.getAttribute(LIST_ELEMENT_INDEX_SESSION_PARAM);
AttributeInterface attributeElement = ((MonoListAttribute) attribute).getAttribute(elementIndex.intValue());
return getLinkAttribute(attributeElement, request);
} else if (attribute instanceof LinkAttribute) {
return attribute;
} else {
throw new RuntimeException("Caso non gestito : Atttributo tipo " + attribute.getClass());
}
}
use of com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface in project entando-core by entando.
the class LinkAttributeActionHelper method removeLink.
@Override
public void removeLink(HttpServletRequest request) {
HttpSession session = request.getSession();
Content currentContent = getContent(request);
String attributeName = (String) session.getAttribute(ATTRIBUTE_NAME_SESSION_PARAM);
AttributeInterface attribute = (AttributeInterface) currentContent.getAttribute(attributeName);
removeLink(attribute, request);
removeSessionParams(session);
}
use of com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface in project entando-core by entando.
the class ListAttributeAction method addListElement.
@Override
public String addListElement() {
try {
super.addListElement();
Content content = this.getContent();
int index = -1;
ListAttributeInterface currentAttribute = (ListAttributeInterface) content.getAttribute(this.getAttributeName());
String nestedType = currentAttribute.getNestedAttributeTypeCode();
if (!nestedType.equals("Attach") && !nestedType.equals("Image") && !nestedType.equals("Link")) {
return SUCCESS;
}
if (currentAttribute instanceof MonoListAttribute) {
List<AttributeInterface> attributes = ((MonoListAttribute) currentAttribute).getAttributes();
index = attributes.size() - 1;
} else if (currentAttribute instanceof ListAttribute) {
List<AttributeInterface> attributes = ((ListAttribute) currentAttribute).getAttributeList(this.getListLangCode());
index = attributes.size() - 1;
}
this.setElementIndex(index);
if (nestedType.equals("Attach") || nestedType.equals("Image")) {
this.setResourceTypeCode(nestedType);
return "chooseResource";
} else {
return "chooseLink";
}
} catch (Throwable t) {
_logger.error("error in addListElement", t);
// ApsSystemUtils.logThrowable(t, this, "addListElement");
return FAILURE;
}
}
use of com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface in project entando-core by entando.
the class ResourceAttributeActionHelper method removeResource.
public static void removeResource(HttpServletRequest request) {
HttpSession session = request.getSession();
String attributeName = (String) session.getAttribute(ATTRIBUTE_NAME_SESSION_PARAM);
AttributeInterface attribute = (AttributeInterface) getContent(request).getAttribute(attributeName);
removeResource(attribute, request);
removeSessionParams(session);
}
use of com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface in project entando-core by entando.
the class ResourceAttributeActionHelper method joinResource.
/**
* Associa la risorsa all'attributo del contenuto o all'elemento dell'attributo lista
* o all'elemento dell'attributo Composito (sia semplice che in lista).
*/
public static void joinResource(ResourceInterface resource, HttpServletRequest request) {
HttpSession session = request.getSession();
Content currentContent = ResourceAttributeActionHelper.getContent(request);
String attributeName = (String) session.getAttribute(ATTRIBUTE_NAME_SESSION_PARAM);
AttributeInterface attribute = (AttributeInterface) currentContent.getAttribute(attributeName);
joinResource(attribute, resource, session);
removeSessionParams(session);
}
Aggregations