• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Sessions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.zkoss.zk.ui.Sessions的典型用法代码示例。如果您正苦于以下问题:Java Sessions类的具体用法?Java Sessions怎么用?Java Sessions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Sessions类属于org.zkoss.zk.ui包,在下文中一共展示了Sessions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: login

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Override
public boolean login(String account, String password) {
    User user = userInfoService.findUser(account);
    //a simple plan text password verification
    if (user == null || !user.getPassword().equals(password)) {
        return false;
    }

    Session sess = Sessions.getCurrent();
    UserCredential cre = new UserCredential(user.getAlias(), user.getName());
    //just in case for this demo.
    if (cre.isAnonymous()) {
        return false;
    }
    sess.setAttribute("userCredential", cre);

    //TODO handle the role here for authorization
    return true;
}
 
开发者ID:odelarosa,项目名称:ZkPortal,代码行数:20,代码来源:MyAuthenticationService.java


示例2: filterInstances

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
/**
 * Filters instances according to the content on the filter fields.
 */
public void filterInstances () {
    //Re-render the tree
    Tree tree = (Tree) getFellow("overviewTree");
    //Set the new instances
    ((OverviewTreeModel) tree.getModel()).setInstances(instances);
    //Hide fields
    displayOrHideAreas();
    
    //Set filters on session
    Sessions.getCurrent().setAttribute(CommonConstants.ATTRIBUTE_USER_FILTER_ACTIONS, ((Combobox) getFellow("actionFilter")).getSelectedIndex());
    Sessions.getCurrent().setAttribute(CommonConstants.ATTRIBUTE_USER_FILTER_CATEGORY, ((Combobox) getFellow("categoryFilter")).getSelectedIndex());
    Sessions.getCurrent().setAttribute(CommonConstants.ATTRIBUTE_USER_FILTER_DB_NAME, ((Textbox) getFellow("dbNameFilter")).getValue());
    Sessions.getCurrent().setAttribute(CommonConstants.ATTRIBUTE_USER_FILTER_DB_TYPE, ((Combobox) getFellow("dbTypeFilter")).getSelectedIndex());
    Sessions.getCurrent().setAttribute(CommonConstants.ATTRIBUTE_USER_FILTER_E_GROUP, ((Textbox) getFellow("eGroupFilter")).getValue());
    Sessions.getCurrent().setAttribute(CommonConstants.ATTRIBUTE_USER_FILTER_HOST, ((Textbox) getFellow("hostFilter")).getValue());
    Sessions.getCurrent().setAttribute(CommonConstants.ATTRIBUTE_USER_FILTER_PROJECT, ((Textbox) getFellow("projectFilter")).getValue());
    Sessions.getCurrent().setAttribute(CommonConstants.ATTRIBUTE_USER_FILTER_USERNAME, ((Textbox) getFellow("usernameFilter")).getValue());
}
 
开发者ID:cerndb,项目名称:dbod-webapp,代码行数:22,代码来源:OverviewController.java


示例3: afterCompose

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
/**
 * Method executed after composing the page. Sets the model of the grid
 * with the instances obtained before composing.
 */
@Override
public void afterCompose() {
    //Upgrades grid
    Grid upgradesGrid = (Grid) getFellow("upgradesGrid");
    upgradesGrid.setModel(new UpgradesListModel(upgrades));
    upgradesGrid.setRowRenderer(new UpgradesGridRenderer(upgradeDAO));
    
    displayOrHideAreas();
    
    Boolean showAllUpgrades = (Boolean) Sessions.getCurrent().getAttribute(CommonConstants.ATTRIBUTE_ADMIN_SHOW_ALL_UPGRADES);
    if (showAllUpgrades != null && showAllUpgrades) {
        showAllUpgrades(showAllUpgrades);
    }
    else {
        showAllUpgrades(false);
    }
}
 
开发者ID:cerndb,项目名称:dbod-webapp,代码行数:22,代码来源:UpgradesController.java


示例4: showAllUpgrades

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
/**
 * Displays all upgrades in the view
 * 
 * @param show indicates if all should be displayed or not
 */
public void showAllUpgrades(boolean show) {
    Grid grid = (Grid) getFellow("upgradesGrid");
    Hbox showAll = (Hbox) getFellow("showAllUpgrades");
    Hbox paging = (Hbox) getFellow("pagingUpgrades");
    if (show) {
        grid.setMold("default");
        showAll.setStyle("display:none");
        paging.setStyle("display:block");
    }
    else {
        grid.setMold("paging");
        grid.setPageSize(10);
        showAll.setStyle("display:block");
        paging.setStyle("display:none");
    }
    Sessions.getCurrent().setAttribute(CommonConstants.ATTRIBUTE_ADMIN_SHOW_ALL_UPGRADES, show);
}
 
开发者ID:cerndb,项目名称:dbod-webapp,代码行数:23,代码来源:UpgradesController.java


示例5: afterCompose

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
/**
 * Method executed after composing the page. Sets the model of the grid
 * with the instances obtained before composing.
 */
@Override
public void afterCompose() {
    //Destroy grid
    Grid destroyGrid = (Grid) getFellow("destroyGrid");
    destroyGrid.setModel(new DestroyListModel(toDestroy));
    destroyGrid.setRowRenderer(new DestroyGridRenderer(instanceDAO));
    
    displayOrHideAreas();
    
    Boolean showAllToDestroy = (Boolean) Sessions.getCurrent().getAttribute(CommonConstants.ATTRIBUTE_ADMIN_SHOW_ALL_TO_DESTROY);
    if (showAllToDestroy != null && showAllToDestroy) {
        showAllToDestroy(showAllToDestroy);
    }
    else {
        showAllToDestroy(false);
    }
}
 
开发者ID:cerndb,项目名称:dbod-webapp,代码行数:22,代码来源:ExpiredController.java


示例6: showAllToDestroy

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
/**
 * Displays all instances to destroy
 * 
 * @param show indicates if all should be displayed or not
 */
public void showAllToDestroy(boolean show) {
    Grid grid = (Grid) getFellow("destroyGrid");
    Hbox showAll = (Hbox) getFellow("showAllToDestroy");
    Hbox paging = (Hbox) getFellow("pagingToDestroy");
    if (show) {
        grid.setMold("default");
        showAll.setStyle("display:none");
        paging.setStyle("display:block");
    }
    else {
        grid.setMold("paging");
        grid.setPageSize(10);
        showAll.setStyle("display:block");
        paging.setStyle("display:none");
    }
    Sessions.getCurrent().setAttribute(CommonConstants.ATTRIBUTE_ADMIN_SHOW_ALL_TO_DESTROY, show);
}
 
开发者ID:cerndb,项目名称:dbod-webapp,代码行数:23,代码来源:ExpiredController.java


示例7: login

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Listen("onClick = #loginButton")
public void login()
{
    Clients.showBusy("Connection...");
    String userName = userNameTextBox.getValue();
    String password = passwordTextBox.getValue();
    showNotify(userName + " / " + password);
    DbSession dbSession = DbSessionFactory.produceDbSession(selectedDbConnection, userName, password);
    try 
    {
        dbSession.validate();
        Sessions.getCurrent(true).setAttribute("dbsession", dbSession);
        Executions.sendRedirect("database.zul");
    }
    catch (Exception ex)
    {
        showNotify(ex.getMessage());
    }
    Clients.clearBusy();
}
 
开发者ID:jz2000,项目名称:oracle-db-truancy,代码行数:21,代码来源:WelcomeController.java


示例8: searchObject

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Listen("onClick = #searchObjectButton")
public void searchObject()
{
    DbSession dbSession = (DbSession)Sessions.getCurrent().getAttribute("dbsession");
    if (dbSession == null) 
    {
            showNotify("NO SESSION");
    }
    else
    {
        try 
        {
            String keyword = searchObjectTextBox.getValue();
            List<DbObject> result = dbSession.searchObjects(selectedObjectType.getTypeName(), keyword);
            selectedObjectTypeItemsListBox.setModel(new ListModelList<>(result));
            selectedObject = null;
        }
        catch(Exception ex) 
        {
            showNotify(ex.getMessage());
        }
    }
}
 
开发者ID:jz2000,项目名称:oracle-db-truancy,代码行数:24,代码来源:DatabaseController.java


示例9: init

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Init
public void init() {
    QLog.l().logQUser().debug("Loding page: init");
    final Session sess = Sessions.getCurrent();

    final User userL = (User) sess.getAttribute("userForQUser");
    setKeyRegimForUser(userL);
    setCFMSAttributes();
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:10,代码来源:Form.java


示例10: logout

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Command
@NotifyChange(value = { "btnsDisabled", "login", "user", "postponList", "customer",
        "avaitColumn", "officeName" })
public void logout() {
    QLog.l().logQUser().debug("Logout " + user.getName());

    // Set all of the session parameters back to defaults
    setKeyRegim(KEYS_OFF);
    checkCFMSType = false;
    checkCFMSHidden = "display: none;";
    checkCFMSHeight = "0%";
    checkCombo = false;
    customer = null;
    officeName = "";

    // Andrew - to change quser state for GABoard
    QUser quser = user.getUser();
    quser.setCurrentState(false);
    // QLog.l().logQUser().debug("\n\n\n\n COUNT: " + quser.getName() + "\n\n\n\n");
    // QLog.l().logQUser().debug("\n\n\n\n COUNT: " + quser.getCurrentState() + "\n\n\n\n");

    final Session sess = Sessions.getCurrent();
    sess.removeAttribute("userForQUser");
    UsersInside.getInstance().getUsersInside().remove(user.getName() + user.getPassword());
    user.setCustomerList(Collections.<QPlanService> emptyList());
    user.setName("");
    user.setPassword("");
    user.setGABoard(false);

    for (QSession session : QSessions.getInstance().getSessions()) {
        if (user.getUser().getId().equals(session.getUser().getId())) {
            QSessions.getInstance().getSessions().remove(session);
            break;
        }
    }

    clientDashboardNorth.setStyle(checkCFMSHidden);
    clientDashboardNorth.setSize(checkCFMSHeight);
    btn_invite.setVisible(false);
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:41,代码来源:Form.java


示例11: refreshListServices

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Command
@NotifyChange(value = { "postponList", "avaitColumn" })
public void refreshListServices() {
    if (isLogin()) {
        // тут поддержание сессии как в веб приложении Here the maintenance of the session as a web application
        UsersInside.getInstance().getUsersInside().put(user.getName() + user.getPassword(), new Date().getTime());
        // тут поддержание сессии как залогинившегося юзера в СУО Here the maintenance of the session as a logged user in the MSA
        QSessions.getInstance()
                .update(user.getUser().getId(), Sessions.getCurrent().getRemoteHost(), Sessions.getCurrent().getRemoteAddr().getBytes());

        final StringBuilder st = new StringBuilder();
        int number = user.getPlan().size();

        user.getPlan().forEach((QPlanService p) -> {
            st.append(user.getLineSize(p.getService().getId()));
        });

        if (!oldSt.equals(st.toString())) {
            List<QPlanService> plans = user.getPlan();
            user.setCustomerList(plans);
            service_list.setModel(service_list.getModel());
            oldSt = st.toString();
            Sort();
            BindUtils.postNotifyChange(null, null, Form.this, "*");
        }
    }
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:28,代码来源:Form.java


示例12: validateMultipleLogin

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
private void validateMultipleLogin(ValidationContext ctx, String name, String pass) {
    final Long l = UsersInside.getInstance().getUsersInside().get(name + pass);
    if (l != null && new Date().getTime() - l < 60000) {
        //this.addInvalidMessage(ctx, "name", l("user_rady_workng"));
        //If user already login somewher else, make him force logout
        for (QSession session : QSessions.getInstance().getSessions()) {
            if (name.equals(session.getUser().getName())) {
                QSessions.getInstance().getSessions().remove(session);
                return;
            }
        }
    } else {
        QUser usr = null;
        for (QUser user : QUserList.getInstance().getItems()) {
            if (user.getName().equalsIgnoreCase(name) && user.isCorrectPassword(pass)) {
                usr = user;
            }
        }
        if (usr == null) {
            this.addInvalidMessage(ctx, "name", l("user_not_found"));
        } else {
            // Sessions.getCurrent().getRemoteHost() Deprecated. as of release 7.0.0, use Execution.getRemoteHost() instead.
            // Sessions.getCurrent().getRemoteAddr() Deprecated. as of release 7.0.0, use Execution.getRemoteAddr() instead.
            QLog.l().logQUser().trace(
                Sessions.getCurrent().hashCode() + " - User validate RemoteHost=" + Sessions
                    .getCurrent().getRemoteHost() + " RemoteAddr=" + Sessions.getCurrent()
                    .getRemoteAddr()
                    + " LocalAddr=" + Sessions.getCurrent().getLocalAddr() + " LocalName="
                    + Sessions
                    .getCurrent().getLocalName() + " ServerName=" + Sessions.getCurrent()
                    .getServerName());
            //if (!QSessions.getInstance().check(usr.getId(), Sessions.getCurrent().getRemoteHost(), Sessions.getCurrent().getRemoteAddr().getBytes())) {
            if (!QSessions.getInstance()
                .check(usr.getId(), "" + Sessions.getCurrent().hashCode(),
                    ("" + Sessions.getCurrent().hashCode()).getBytes())) {
                this.addInvalidMessage(ctx, "name", l("user_allerady_in"));
            }
        }
    }
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:41,代码来源:UserLoginValidator.java


示例13: refreshListServices

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Command
@NotifyChange(value = {"customersCount"})
public void refreshListServices() {
    for (QUser user : QUserList.getInstance().getItems()) {
        if (user.getName().equalsIgnoreCase("Smartboard")) {
            QSessions.getInstance().update(user.getId(), Sessions.getCurrent().getRemoteHost(),
                Sessions.getCurrent().getRemoteAddr().getBytes());
        }
    }
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:11,代码来源:QBoard.java


示例14: refreshSmartBoard

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Command
public void refreshSmartBoard(){
    final Session sess = Sessions.getCurrent();
    if (sess==null) {
        Executions.getCurrent().sendRedirect("");
    }
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:8,代码来源:QBoard.java


示例15: getUserCredential

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Override
public UserCredential getUserCredential() {
    Session sess = Sessions.getCurrent();
    UserCredential cre = (UserCredential) sess.getAttribute("userCredential");
    if (cre == null) {
        cre = new UserCredential();//new a anonymous user and set to session
        sess.setAttribute("userCredential", cre);
    }
    return cre;
}
 
开发者ID:odelarosa,项目名称:ZkPortal,代码行数:11,代码来源:MyAuthenticationService.java


示例16: setUser

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
public static void setUser(User user) {
	Session zkSession = Sessions.getCurrent();
	synchronized (zkSession) {
		zkSession.setAttribute(KEY_USER_MODEL, user);
		zkSession.setAttribute("user", user);
	}
}
 
开发者ID:beemsoft,项目名称:techytax-zk,代码行数:8,代码来源:UserCredentialManager.java


示例17: init

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
private static Properties init()
{
    Properties prop = new Properties();
    String configPath = ((ServletContext)Sessions.getCurrent().getWebApp().getServletContext()).getInitParameter(CommonConstants.CONFIG_LOCATION);
    try (InputStream input = new FileInputStream(configPath)) {
        prop.load(input);
    } catch (IOException ex) {
        Logger.getLogger(ConfigLoader.class.getName()).log(Level.SEVERE, "EXCEPTION READING CONFIG FILE ON " + configPath, ex);
    }
    return prop;
}
 
开发者ID:cerndb,项目名称:dbod-webapp,代码行数:12,代码来源:ConfigLoader.java


示例18: afterCompose

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@AfterCompose
public void afterCompose(@ContextParam(ContextType.VIEW) Component view){
	Selectors.wireComponents(view, this, false);
	//Se agrega referencia del tb_tabbox contenedor de la app
	Sessions.getCurrent().setAttribute("tb_tabboxCtl", tb_tabbox);
	Sessions.getCurrent().setAttribute("textboxUsuario", nombreUsuario);
}
 
开发者ID:zerstoren1234567,项目名称:PruebaDesarrollo,代码行数:8,代码来源:PrincipalCtl.java


示例19: openSelectedObjectTupe

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Listen("onClick = #openObjectTypeButton")
public void openSelectedObjectTupe()
{
    if (selectedObjectType == null) 
    {
        showNotify("No object type selected");
    } 
    else
    {
        selectedObjectTypeTitle.setValue(selectedObjectType.getTypeLabel());
        DbSession dbSession = (DbSession)Sessions.getCurrent().getAttribute("dbsession");
        if (dbSession == null) 
        {
                showNotify("NO SESSION");
        }
        else
        {
            try 
            {
                List<DbObject> objects = dbSession.getObjectsForType(selectedObjectType.getTypeName());
                selectedObjectTypeItemsListBox.setModel(new ListModelList<>(objects));
                selectedObject = null;
            }
            catch(Exception ex) 
            {
                showNotify(ex.getMessage());
            }
        }
    }
}
 
开发者ID:jz2000,项目名称:oracle-db-truancy,代码行数:31,代码来源:DatabaseController.java


示例20: login

import org.zkoss.zk.ui.Sessions; //导入依赖的package包/类
@Command
@NotifyChange(value = { "btnsDisabled", "login", "user", "postponList", "customer",
        "avaitColumn", "officeName", "userList", "currentState", "userListbyOffice" })
public void login() {

    Uses.userTimeZone = (TimeZone) Sessions.getCurrent()
            .getAttribute("org.zkoss.web.preferred.timeZone");
    QLog.l().logQUser().debug("Login : " + user.getName());
    // if (user.getUser().getName().equals("Administrator")) {
    if (user.getUser().getAdminAccess()) {
        user.setGABoard(true);
    }
    QLog.l().logQUser().debug("STATUS : " + user.getGABoard());

    final Session sess = Sessions.getCurrent();
    sess.setAttribute("userForQUser", user);
    customer = user.getUser().getCustomer();

    // TODO for testing
    // need disabled
    user.getPlan().forEach((QPlanService p) -> {
        final CmdParams params = new CmdParams();
        params.serviceId = p.getService().getId();
        params.priority = 2;
        // */todo disabled*/ Executer.getInstance().getTasks().get(Uses.TASK_STAND_IN).process(params, "", new byte[4]);
    });

    setKeyRegimForUser(user);

    // QUser quser = user.getUser();
    Long userId = user.getUser().getId();
    QUser quser = QUserList.getInstance().getById(userId);
    currentState = true;
    quser.setCurrentState(currentState);
    if (quser != null) {
        officeName = user.getUser().getOffice().getName();
    }

    setCFMSAttributes();

    clientDashboardNorth.setSize(checkCFMSHeight);
    clientDashboardNorth.setStyle(checkCFMSHidden);
    clientDashboardNorth.invalidate();

    if (getCFMSType()) {
        btn_invite.setVisible(true);
    }
    else {
        btn_invite.setVisible(false);
    }
    // GA_list.setModel(GA_list.getModel());
    // GA_list.getModel();
    BindUtils.postNotifyChange(null, null, Form.this, "*");
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:55,代码来源:Form.java



注:本文中的org.zkoss.zk.ui.Sessions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JWEAlgorithm类代码示例发布时间:2022-05-23
下一篇:
Java SFinishedBuild类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap