本文整理汇总了Java中org.springframework.web.jsf.FacesContextUtils类的典型用法代码示例。如果您正苦于以下问题:Java FacesContextUtils类的具体用法?Java FacesContextUtils怎么用?Java FacesContextUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FacesContextUtils类属于org.springframework.web.jsf包,在下文中一共展示了FacesContextUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configura
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
public String configura() {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleConfigService serviceConfig = ctx.getBean(SimpleConfigService.class);
SimpleVotableOptionService serviceVo = ctx.getBean(SimpleVotableOptionService.class);
FacesContext fc = FacesContext.getCurrentInstance();
try {
ConfigurationElection conf = new ConfigurationElection(getName(), getDescription(), getApplicationStart(),
getApplicationEnd(), getVotationStart(), getVotationEnd(), getVotableOptions(), getElectoralColleges(),
isMultipleVoting());
relacionaOpcionesVotoConf(getVotableOptions(), conf);
serviceConfig.saveConfiguration(conf);
serviceVo.saveVotableOption(getVotableOptions());
fc.addMessage("laInfo", new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", "Se ha guardado su configuración."));
} catch (Exception e) {
fc.addMessage("elError", new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Error al guardar la configuración"));
return null;
}
return null;
}
示例2: validar
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
@Override
public String validar(String email, String password) {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
CheckUserR vs = ctx.getBean(CheckUserR.class);
try {
vs.validar(email, password);
} catch (InvalidUserException e) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "", e.getMessage());
FacesContext.getCurrentInstance().addMessage("form-cuerpo:all", msg);
return "fracaso";
}
return "exito";
}
示例3: configura
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
public String configura() {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
InsertConfigurationR serviceConfig = ctx.getBean(InsertConfigurationR.class);
FacesContext fc = FacesContext.getCurrentInstance();
try {
ConfigurationElection conf = new ConfigurationElection(getName(), getDescription(), getApplicationStart(),
getApplicationEnd(), getVotationStart(), getVotationEnd(), getVotableOptions(), getElectoralColleges(),
isMultipleVoting());
relacionaOpcionesVotoConf(getVotableOptions(), conf);
serviceConfig.saveConfiguration(conf);
serviceConfig.saveVotableOption(getVotableOptions());
fc.addMessage("laInfo", new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", "Se ha guardado su configuración."));
} catch (Exception e) {
fc.addMessage("elError", new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Error al guardar la configuración"));
return null;
}
return null;
}
示例4: getCompanyRoot
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
/**
* Returns a company root node reference object.
*
* @return The NodeRef object
*/
public static NodeRef getCompanyRoot(final FacesContext context)
{
final String currentUserName = Application.getCurrentUser(context).getUserName();
// note: run in context of System user using tenant-specific store
// so that Company Root can be returned, even if the user does not have
// permission to access the Company Root (including, for example, the Guest user)
return AuthenticationUtil.runAs(new RunAsWork<NodeRef>()
{
public NodeRef doWork() throws Exception
{
ServiceRegistry sr = getServiceRegistry(context);
TenantService tenantService = (TenantService)FacesContextUtils.getRequiredWebApplicationContext(context).getBean("tenantService");
// get store ref (from config)
StoreRef storeRef = tenantService.getName(currentUserName, Repository.getStoreRef());
// get root path (from config)
String rootPath = Application.getRootPath(context);
return getCompanyRoot(sr.getNodeService(), sr.getSearchService(), sr.getNamespaceService(), storeRef, rootPath);
}
}, AuthenticationUtil.getSystemUserName());
}
示例5: getNamePathEx
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
/**
* Resolve a Path by converting each element into its display NAME attribute.
* Note: This method resolves path regardless access permissions.
* Fixes the UI part of the ETWOONE-214 and ETWOONE-238 issues
*
* @param path Path to convert
* @param separator Separator to user between path elements
* @param prefix To prepend to the path
*
* @return Path converted using NAME attribute on each element
*/
public static String getNamePathEx(FacesContext context, final Path path, final NodeRef rootNode, final String separator, final String prefix)
{
String result = null;
RetryingTransactionHelper transactionHelper = getRetryingTransactionHelper(context);
transactionHelper.setMaxRetries(1);
final NodeService runtimeNodeService = (NodeService)FacesContextUtils.getRequiredWebApplicationContext(context).getBean("nodeService");
result = transactionHelper.doInTransaction(
new RetryingTransactionCallback<String>()
{
public String execute() throws Throwable
{
return getNamePath(runtimeNodeService, path, rootNode, separator, prefix);
}
});
return result;
}
示例6: evaluate
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
NavigationBean nav =
(NavigationBean)FacesHelper.getManagedBean(facesContext, NavigationBean.BEAN_NAME);
// determine whether the workflow services are active
boolean workflowPresent = false;
WebApplicationContext springContext = FacesContextUtils.getRequiredWebApplicationContext(facesContext);
BPMEngineRegistry bpmReg = (BPMEngineRegistry)springContext.getBean(BPM_ENGINE_BEAN_NAME);
if (bpmReg != null)
{
String[] components = bpmReg.getWorkflowComponents();
workflowPresent = (components != null && components.length > 0);
}
return (workflowPresent && nav.getIsGuest() == false &&
node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION) == false);
}
示例7: validar
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
public String validar(){
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
ValidatorService vs = ctx.getBean(ValidatorService.class);
try {
vs.validar(email, password);
} catch (InvalidUserException e) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "", e.getMessage());
FacesContext.getCurrentInstance().addMessage("form-cuerpo:all", msg);
return "fracaso";
}
return "exito";
}
示例8: getList
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
public List<ConfigurationElection> getList() {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
VoteService vs = ctx.getBean(VoteService.class);
list = vs.getElections();
return list;
}
示例9: getVotableOptions
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
public List<VotableOption> getVotableOptions(ConfigurationElection configurationElection) {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
VoterVoteService vvs = ctx.getBean(VoterVoteService.class);
this.configurationElection = configurationElection;
return vvs.getVotableOptions(configurationElection);
}
示例10: getVotes
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
public List<Vote> getVotes(ConfigurationElection configurationElection) {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
VoterVoteService vvs = ctx.getBean(VoterVoteService.class);
this.configurationElection = configurationElection;
List<VotableOption> miLista=vvs.getVotableOptions(configurationElection);
votos=new ArrayList<Vote>();
Date d= new Date();
for(VotableOption v: miLista){
votos.add(new Vote(d, v, 0));
}
return votos;
}
示例11: verify
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
public String verify() {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleLoginMesaService login = ctx.getBean(SimpleLoginMesaService.class);
LugarVoto mesa = login.verify(id, password);
if (mesa != null) {
putMesaInSession(mesa);
return "principalMesa";
}
setResult("Contraseña o identificador incorrecto");
return null;
}
示例12: votar
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public String votar(OpcionVoto opcion) {
WebApplicationContext ctx = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleVoteService vote = ctx.getBean(SimpleVoteService.class);
WebApplicationContext ctx1 = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleConfiguracionService config = ctx1.getBean(SimpleConfiguracionService.class);
Configuracion c = config.getConf();
String s = getFecha(c.getFecha().toString());
Voto v = vote.getVoteBy(opcion.getNombre());
Timestamp actual = new Timestamp(new Date().getTime());
String act = getFecha(actual.toString());
if (act.contains(s) && actual.getHours() >= c.getHoraInicio()
&& actual.getHours() <= c.getHoraFin()) {
if (v != null)
vote.updateVote(opcion.getNombre());
else
vote.insertVote(opcion.getNombre());
setResult("Ya ha votado, no puede realizar mas votos");
setVotado(true);
} else {
setVotado(true);
setResult("Esta fuera de plazo de votacion");
}
return null;
}
示例13: opcionesVoto
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
public void opcionesVoto() {
WebApplicationContext ctx = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleOptionVoteService vote = ctx.getBean(SimpleOptionVoteService.class);
votos = (OpcionVoto[]) vote.getAllVoteOptions().toArray(new OpcionVoto[0]);
}
示例14: verify
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public String verify() {
WebApplicationContext ctx = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleLoginService login = ctx.getBean(SimpleLoginService.class);
WebApplicationContext ctx1 = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleConfiguracionService config = ctx1
.getBean(SimpleConfiguracionService.class);
Configuracion c = config.getConf();
String s = getFecha(c.getFecha().toString());
Timestamp actual = new Timestamp(new Date().getTime());
String act = getFecha(actual.toString());
if (act.contains(s) && actual.getHours() >= c.getHoraInicio()
&& actual.getHours() <= c.getHoraFin()) {
boolean yaVoto = login.comprobarUsuario(dni);
if (!yaVoto) {
UserLogin user = login.verify(dni, password);
if (user != null) {
putUserInSession(user);
return "principal";
}
setResult("Contraseña o usuario incorrecto");
} else {
setResult("Este usuario ya ha votado");
}
} else {
setResult("Actualmente no hay ninguna votaciones disponibles");
}
return null;
}
示例15: getVotes
import org.springframework.web.jsf.FacesContextUtils; //导入依赖的package包/类
public List<Vote> getVotes(ConfigurationElection configurationElection) {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
LoadVoteR vvs = ctx.getBean(LoadVoteR.class);
this.configurationElection = configurationElection;
List<VotableOption> miLista=vvs.getVotableOptions(configurationElection);
votos=new ArrayList<Vote>();
Date d= new Date();
for(VotableOption v: miLista){
votos.add(new Vote(d, v, 0));
}
return votos;
}