use of com.agiletec.aps.system.exception.ApsSystemException in project entando-core by entando.
the class DataObjectViewerHelper method getRenderizationInfo.
@Override
public DataObjectRenderizationInfo getRenderizationInfo(String dataobjectId, String modelId, boolean publishExtraTitle, RequestContext reqCtx) throws ApsSystemException {
DataObjectRenderizationInfo renderizationInfo = null;
try {
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
String langCode = currentLang.getCode();
Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
ApsProperties widgetConfig = widget.getConfig();
dataobjectId = this.extractDataId(dataobjectId, widgetConfig, reqCtx);
modelId = this.extractModelId(dataobjectId, modelId, widgetConfig, reqCtx);
if (dataobjectId != null && modelId != null) {
long longModelId = new Long(modelId).longValue();
this.setStylesheet(longModelId, reqCtx);
renderizationInfo = this.getDataObjectDispenser().getRenderizationInfo(dataobjectId, longModelId, langCode, reqCtx, true);
if (null == renderizationInfo) {
_logger.info("Null Renderization informations: dataobject={}", dataobjectId);
return null;
}
this.manageAttributeValues(renderizationInfo, publishExtraTitle, reqCtx);
} else {
_logger.warn("Parametri visualizzazione dataobject incompleti: dataobject={} modello={}", dataobjectId, modelId);
}
} catch (Throwable t) {
_logger.error("Error extracting renderization info", t);
throw new ApsSystemException("Error extracting renderization info", t);
}
return renderizationInfo;
}
use of com.agiletec.aps.system.exception.ApsSystemException in project entando-core by entando.
the class DataObjectViewerHelper method getAuthorizationInfo.
@Override
public PublicDataTypeAuthorizationInfo getAuthorizationInfo(String dataobjectId, RequestContext reqCtx) throws ApsSystemException {
PublicDataTypeAuthorizationInfo authInfo = null;
try {
Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
dataobjectId = this.extractDataId(dataobjectId, widget.getConfig(), reqCtx);
if (null == dataobjectId) {
_logger.info("Null dataobjectId");
return null;
}
authInfo = this.getDataAuthorizationHelper().getAuthorizationInfo(dataobjectId, true);
if (null == authInfo) {
_logger.info("Null authorization info by dataobject '" + dataobjectId + "'");
}
} catch (Throwable t) {
_logger.error("Error extracting dataobject authorization info by dataobject {}", dataobjectId, t);
throw new ApsSystemException("Error extracting dataobject authorization info by dataobject '" + dataobjectId + "'", t);
}
return authInfo;
}
use of com.agiletec.aps.system.exception.ApsSystemException in project entando-core by entando.
the class UserFilterOptionBean method getEntityFilter.
public EntitySearchFilter getEntityFilter() throws ApsSystemException {
EntitySearchFilter filter = null;
try {
if (!this.isAttributeFilter() || null == this.getFormFieldValues()) {
return null;
}
AttributeInterface attribute = this.getAttribute();
if (attribute instanceof ITextAttribute) {
String text = this.getFormFieldValues().get(this.getFormFieldNames()[0]);
filter = new EntitySearchFilter(attribute.getName(), true, text, true);
if (attribute.isMultilingual()) {
filter.setLangCode(this.getCurrentLang().getCode());
}
} else if (attribute instanceof DateAttribute) {
String start = this.getFormFieldValues().get(this.getFormFieldNames()[0]);
String end = this.getFormFieldValues().get(this.getFormFieldNames()[1]);
Date startDate = DateConverter.parseDate(start, this.getDateFormat());
Date endDate = DateConverter.parseDate(end, this.getDateFormat());
filter = new EntitySearchFilter(attribute.getName(), true, startDate, endDate);
} else if (attribute instanceof BooleanAttribute) {
String value = this.getFormFieldValues().get(this.getFormFieldNames()[0]);
String ignore = this.getFormFieldValues().get(this.getFormFieldNames()[1]);
if (null != ignore) {
return null;
} else if (null == value || value.equals("both")) {
// special option for three state Attribute
filter = new EntitySearchFilter(attribute.getName(), true);
filter.setNullOption(true);
} else {
filter = new EntitySearchFilter(attribute.getName(), true, value, false);
}
} else if (attribute instanceof NumberAttribute) {
String start = this.getFormFieldValues().get(this.getFormFieldNames()[0]);
String end = this.getFormFieldValues().get(this.getFormFieldNames()[1]);
BigDecimal startNumber = null;
try {
Integer startNumberInt = Integer.parseInt(start);
startNumber = new BigDecimal(startNumberInt);
} catch (Throwable t) {
}
BigDecimal endNumber = null;
try {
Integer endNumberInt = Integer.parseInt(end);
endNumber = new BigDecimal(endNumberInt);
} catch (Throwable t) {
}
filter = new EntitySearchFilter(attribute.getName(), true, startNumber, endNumber);
}
} catch (Throwable t) {
_logger.error("Error extracting entity search filters", t);
throw new ApsSystemException("Error extracting entity search filters", t);
}
return filter;
}
use of com.agiletec.aps.system.exception.ApsSystemException in project entando-core by entando.
the class DataObjectModelManager method addDataObjectModel.
@Override
public void addDataObjectModel(DataObjectModel model) throws ApsSystemException {
try {
this.getDataModelDAO().addDataModel(model);
// Long wrapLongId = new Long(model.getId());
this.getCacheWrapper().addModel(model);
this.notifyDataModelChanging(model, DataObjectModelChangedEvent.INSERT_OPERATION_CODE);
} catch (Throwable t) {
logger.error("Error saving a dataObjectModel", t);
throw new ApsSystemException("Error saving a dataObjectModel", t);
}
}
use of com.agiletec.aps.system.exception.ApsSystemException in project entando-core by entando.
the class DataObjectModelManager method removeDataObjectModel.
@Override
public void removeDataObjectModel(DataObjectModel model) throws ApsSystemException {
try {
this.getDataModelDAO().deleteDataModel(model);
this.getCacheWrapper().removeModel(model);
this.notifyDataModelChanging(model, DataObjectModelChangedEvent.REMOVE_OPERATION_CODE);
} catch (Throwable t) {
logger.error("Error deleting a dataObject model", t);
throw new ApsSystemException("Error deleting a dataObject model", t);
}
}
Aggregations