use of io.imunity.furms.ui.community.allocations.CommunityAllocationModelsMapper in project furms by unity-idm.
the class CommunityAllocationFormView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
CommunityAllocationViewModel serviceViewModel = ofNullable(parameter).flatMap(id -> handleExceptions(() -> communityAllocationService.findByIdWithRelatedObjects(id))).flatMap(Function.identity()).map(CommunityAllocationModelsMapper::map).orElseGet(() -> {
String communityId = event.getLocation().getQueryParameters().getParameters().get("communityId").iterator().next();
return new CommunityAllocationViewModel(communityId, communityService.findById(communityId).get().getName());
});
this.communityId = serviceViewModel.getCommunityId();
String trans = parameter == null ? "view.fenix-admin.resource-credits-allocation.form.parameter.new" : "view.fenix-admin.resource-credits-allocation.form.parameter.update";
breadCrumbParameter = new BreadCrumbParameter(parameter, getTranslation(trans));
communityAllocationFormComponent.setModelObject(serviceViewModel, () -> communityAllocationService.getOccupiedNames(communityId));
}
Aggregations