io.github.rongaru.javaee.webapp.bean.AbstractBeanJSF Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javaee Show documentation
Show all versions of javaee Show documentation
Java Classes For JavaEE JSF.
The newest version!
package io.github.rongaru.javaee.webapp.bean;
import io.github.rongaru.javaee.utilities.CDIManagedBeanUtils;
import io.github.rongaru.javaee.utilities.FacesMessageUtils;
import io.github.rongaru.javaee.utilities.FacesViewUtils;
import io.github.rongaru.javaee.utilities.GenericUtils;
import io.github.rongaru.javaee.webapp.model.AbstractDataModelJSF;
import java.util.Collections;
import java.util.List;
public abstract class AbstractBeanJSF< Dto, Service, UserDto, DataModelJSF, UserLoginDataModelJSF > extends AbstractBeanJSF_3< Dto, Service, UserDto, DataModelJSF, UserLoginDataModelJSF > {
protected void deleteAndCreateDataModelJSF( ) {
Class< DataModelJSF > dataModelJSFClass = GenericUtils.getInstanceClass( this.getClass( ), 3 );
setDataModelJSF( CDIManagedBeanUtils.destroyAndConstructContextManagedBean( getBeanManager( ), dataModelJSFClass ) );
}
protected void deleteUselessSessionViewScopedDataModelJSF( ) {
Class< DataModelJSF > dataModelJSFClass = GenericUtils.getInstanceClass( this.getClass( ), 3 );
CDIManagedBeanUtils.destroyUselessSessionViewScopedDataModelJSFManagedBeansNotIn( getBeanManager( ), Collections.singletonList( dataModelJSFClass ) );
}
protected void setScreenRedirectionDefaultParameters( DataModelJSF dataModelJSF ) {
List< Dto > records = getDataTableRecordDtos( );
getAbstractDataModelJSF( ).setRecords( records );
}
protected void setViewElementViewProperties( Dto record, DataModelJSF dataModelJSF ) {
/* Implementation */
}
public String redirectScreenView( ) {
DataModelJSF dataModelJSF1 = getDataModelJSF( );
UserDto userDto = getAbstractUserLoginDataModelJSF( ).getUserDto( );
if ( isUserHasPermissionsForScreen( userDto, dataModelJSF1 ) ) {
deleteAndCreateDataModelJSF( );
deleteUselessSessionViewScopedDataModelJSF( );
DataModelJSF dataModelJSF2 = getDataModelJSF( );
setScreenPermissionsForUser( userDto, dataModelJSF2 );
setScreenRedirectionDefaultParameters( dataModelJSF2 );
String requestAllowedScreen = getRequestAllowedScreen( );
return FacesViewUtils.redirect( requestAllowedScreen );
}
FacesMessageUtils.createErrorMessage( "Request Denied" );
String requestDeniedScreen = getRequestDeniedScreen( );
return FacesViewUtils.redirect( requestDeniedScreen );
}
public void initViewElement( ) {
AbstractDataModelJSF< Dto > abstractDataModelJSF = getAbstractDataModelJSF( );
if ( abstractDataModelJSF.isUserHasViewPermission( ) ) {
abstractDataModelJSF.setCreateViewPanel( true );
DataModelJSF dataModelJSF = this.getDataModelJSF( );
Dto recordInstance = abstractDataModelJSF.getRecord( );
setViewElementViewProperties( recordInstance, dataModelJSF );
} else {
FacesMessageUtils.createErrorMessage( "Request Denied" );
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy