use of org.entando.entando.aps.system.exception.RestServerError in project entando-core by entando.
the class GuiFragmentService method getGuiFragments.
@Override
public PagedMetadata<GuiFragmentDtoSmall> getGuiFragments(RestListRequest restListReq) {
PagedMetadata<GuiFragmentDtoSmall> pagedMetadata = null;
try {
SearcherDaoPaginatedResult<GuiFragment> fragments = this.getGuiFragmentManager().getGuiFragments(restListReq.buildFieldSearchFilters());
List<GuiFragmentDtoSmall> dtoList = this.getDtoSmallBuilder().convert(fragments.getList());
pagedMetadata = new PagedMetadata<>(restListReq, fragments);
pagedMetadata.setBody(dtoList);
} catch (Throwable t) {
logger.error("error in search fragments", t);
throw new RestServerError("error in search fragments", t);
}
return pagedMetadata;
}
use of org.entando.entando.aps.system.exception.RestServerError in project entando-core by entando.
the class GuiFragmentService method updateGuiFragment.
@Override
public GuiFragmentDto updateGuiFragment(GuiFragmentRequestBody guiFragmentRequest) {
String code = guiFragmentRequest.getCode();
try {
GuiFragment fragment = this.getGuiFragmentManager().getGuiFragment(code);
if (null == fragment) {
throw new RestRourceNotFoundException(GuiFragmentValidator.ERRCODE_FRAGMENT_DOES_NOT_EXISTS, "fragment", code);
}
fragment.setGui(guiFragmentRequest.getGuiCode());
this.getGuiFragmentManager().updateGuiFragment(fragment);
return this.getDtoBuilder().convert(fragment);
} catch (RestRourceNotFoundException e) {
throw e;
} catch (ApsSystemException e) {
logger.error("Error updating fragment {}", code, e);
throw new RestServerError("error in update fragment", e);
}
}
use of org.entando.entando.aps.system.exception.RestServerError in project entando-core by entando.
the class GuiFragmentService method addGuiFragment.
@Override
public GuiFragmentDto addGuiFragment(GuiFragmentRequestBody guiFragmentRequest) {
try {
GuiFragment fragment = this.createGuiFragment(guiFragmentRequest);
this.getGuiFragmentManager().addGuiFragment(fragment);
return this.getDtoBuilder().convert(fragment);
} catch (ApsSystemException e) {
logger.error("Error adding fragment", e);
throw new RestServerError("error add fragment", e);
}
}
use of org.entando.entando.aps.system.exception.RestServerError in project entando-core by entando.
the class GuiFragmentService method removeGuiFragment.
@Override
public void removeGuiFragment(String guiFragmentCode) {
try {
GuiFragment fragment = this.getGuiFragmentManager().getGuiFragment(guiFragmentCode);
if (null == fragment) {
return;
}
GuiFragmentDto dto = this.getDtoBuilder().convert(fragment);
BeanPropertyBindingResult validationResult = this.checkFragmentForDelete(fragment, dto);
if (validationResult.hasErrors()) {
throw new ValidationGenericException(validationResult);
}
this.getGuiFragmentManager().deleteGuiFragment(guiFragmentCode);
} catch (ApsSystemException e) {
logger.error("Error in delete guiFragmentCode {}", guiFragmentCode, e);
throw new RestServerError("error in delete guiFragmentCode", e);
}
}
use of org.entando.entando.aps.system.exception.RestServerError in project entando-core by entando.
the class LabelService method removeLabelGroup.
@Override
public void removeLabelGroup(String code) {
try {
ApsProperties labelGroup = this.getI18nManager().getLabelGroup(code);
if (null == labelGroup) {
logger.warn("no label found with key {}", code);
return;
}
this.getI18nManager().deleteLabelGroup(code);
} catch (ApsSystemException t) {
logger.error("error in delete label group with code {}", code, t);
throw new RestServerError("error in delete label group", t);
}
}
Aggregations