Package open.dolphin.infomodel

Examples of open.dolphin.infomodel.UserModel


           
            logger.info("Host Service を取得しました。");
           
            // Admin Model
            FacilityModel facility = new FacilityModel();
            UserModel admin = new UserModel();
            admin.setFacilityModel(facility);

            // 施設OID
            facility.setFacilityId(DEFAULT_FACILITY_OID);

            facility.setFacilityName(prop.get("facility.name"));
            facility.setZipCode(prop.get("facility.zipcode"));
            facility.setAddress(prop.get("facility.address"));
            facility.setTelephone(prop.get("facility.telephone"));
            facility.setUrl(prop.get("facility.url"));
            Date date = new Date();
            facility.setRegisteredDate(date);
            facility.setMemberType(MEMBER_TYPE);

            //admin.setUserId(prop.get("admin.id"));
            //admin.setPassword(prop.get("admin.password"));
            if (userId == null || userId.equals("")) {
                admin.setUserId(prop.get("admin.login.id"));
            } else {
                admin.setUserId(userId);
            }
            if (password == null || password.equals("")) {
                admin.setPassword(prop.get("admin.login.password"));
            } else {
                admin.setPassword(password);
            }
            //String Algorithm = "MD5";
            //String encoding = "hex";
            //String charset = null;
            //String hashPass = CryptoUtil.createPasswordHash(Algorithm, encoding, charset, admin.getUserId(), admin.getPassword());
            String hashPass = HashUtil.MD5(admin.getPassword());
            admin.setPassword(hashPass);
            admin.setSirName(prop.get("admin.sir.name"));
            admin.setGivenName(prop.get("admin.given.name"));
            admin.setCommonName(admin.getSirName() + " " + admin.getGivenName());

            // 医療資格
            LicenseModel license = new LicenseModel();
            license.setLicense("doctor");
            license.setLicenseDesc("医師");
            license.setLicenseCodeSys("MML0026");
            admin.setLicenseModel(license);

            // 診療科
            DepartmentModel dept = new DepartmentModel();
            dept.setDepartment("01");
            dept.setDepartmentDesc("内科");
            dept.setDepartmentCodeSys("MML0028");
            admin.setDepartmentModel(dept);

            // Email
            String email = prop.get("admin.email");
            if (email == null || email.equals("")) {
                admin.setEmail(prop.get("someone@some-clinic.jp"));
            } else {
                admin.setEmail(email);
            }

            // MemberTpe
            admin.setMemberType(MEMBER_TYPE);

            // 登録日
            admin.setRegisteredDate(date);

            // 登録
            service.addFacilityAdmin(admin);

            logger.info("管理者を登録しました。");
View Full Code Here


       
        Collection c = getService().getAllUser();
        ArrayList<UserModel> ret = new ArrayList<UserModel>();

        for (Iterator iter = c.iterator(); iter.hasNext(); ) {
            UserModel user = (UserModel) iter.next();
            ret.add(user);
        }

        return ret;
    }
View Full Code Here

        public void get() {
           
            //
            // UserModel を Project から設定する
            //
            UserModel user = Project.getUserModel();
            uid.setText(user.idAsLocal());
            sn.setText(user.getSirName());
            givenName.setText(user.getGivenName());
            userPassword1.setText(DUMMY_PASSWORD);
            userPassword2.setText(DUMMY_PASSWORD);
            email.setText(user.getEmail());
            String license = user.getLicenseModel().getLicense();
            for (int i = 0; i < licenses.length; i++) {
                if (license.equals(licenses[i].getLicense())) {
                    licenseCombo.setSelectedIndex(i);
                    break;
                }
            }
            String deptStr = user.getDepartmentModel().getDepartment();
            for (int i = 0; i < depts.length; i++) {
                if (deptStr.equals(depts[i].getDepartment())) {
                    deptCombo.setSelectedIndex(i);
                    break;
                }
View Full Code Here

            }
           
            //
            // Project からユーザモデルを取得する
            //
            UserModel user = Project.getUserModel();
           
            //
            // 更新が成功するまでは変更しない
            //
            final UserModel updateModel = new UserModel();
            updateModel.setId(user.getId());
            updateModel.setFacilityModel(user.getFacilityModel());
            updateModel.setMemberType(user.getFacilityModel().getMemberType());
            //updateModel.setMemberType(user.getMemberType());
           
            //
            // ログインIDを設定する
            //
            String userId = user.getFacilityModel().getFacilityId() + ":" + uid.getText().trim();
            updateModel.setUserId(userId);
           
            //
            // パスワードを設定する
            //
            final String password = new String(userPassword1.getPassword());
           
            if (!password.equals(DUMMY_PASSWORD)) {
           
                // Password の hash 化を行う
                //String Algorithm = ClientContext.getString("addUser.password.hash.algorithm");
                //String encoding = ClientContext.getString("addUser.password.hash.encoding");
                //String charset = ClientContext.getString("addUser.password.hash.charset");
                //String charset = null;
                //String hashPass = CryptoUtil.createPasswordHash(Algorithm, encoding, charset, userId, password);
                String hashPass = HashUtil.MD5(password);
                updateModel.setPassword(hashPass);
               
            } else {
                //
                // パスワードは変更されていない
                //
                updateModel.setPassword(user.getPassword());
            }
           
            //
            // 姓名を設定する
            //
            String snSt = sn.getText().trim();
            updateModel.setSirName(snSt);
            String givenNameSt = givenName.getText().trim();
            updateModel.setGivenName(givenNameSt);
            updateModel.setCommonName(snSt + " " + givenNameSt);
           
            //
            // 電子メールを設定する
            //
            updateModel.setEmail(email.getText().trim());
           
            //
            // 医療資格を設定する
            //
            int selected = licenseCombo.getSelectedIndex();
            updateModel.setLicenseModel(licenses[selected]);
           
            //
            // 診療科を設定する
            //
            selected = deptCombo.getSelectedIndex();
            updateModel.setDepartmentModel(depts[selected]);
           
            //
            // Roleを付け加える
            //
            Collection<RoleModel> roles = user.getRoles();
            for (RoleModel role : roles) {
                role.setUserId(user.getUserId());
                RoleModel updateRole = new RoleModel();
                updateRole.setId(role.getId());
                updateRole.setRole(role.getRole());
                updateRole.setUser(updateModel);
                updateRole.setUserId(updateModel.getUserId());
                updateModel.addRole(updateRole);
            }
           
            // タスクを実行する
            final UserDelegater udl = new UserDelegater();
            int maxEstimation = ClientContext.getInt("task.default.maxEstimation");
            int delay = ClientContext.getInt("task.default.delay");
            String message = null;
            Component c = getFrame();
           
            Task task = new Task<Boolean>(c, message, PROGRESS_NOTE, maxEstimation) {
       
                @Override
                protected Boolean doInBackground() throws Exception {
                    logger.debug("ChangePassword doInBackground");
                    int cnt = udl.updateUser(updateModel);
                    return cnt > 0 ? true : false;
                }
               
                @Override
                protected void succeeded(Boolean result) {
                    logger.debug("ChangePassword succeeded");

                    if (udl.isNoError()) {
                        //
                        // Project を更新する
                        //
                        Project.getProjectStub().setUserModel(updateModel);
                        DolphinPrincipal principal = new DolphinPrincipal();
                        principal.setUserId(updateModel.idAsLocal());
                        principal.setFacilityId(updateModel.getFacilityModel().getFacilityId());
                        Project.getProjectStub().setUserId(updateModel.idAsLocal());
                        Project.getProjectStub().setDolphinPrincipal(principal);
                       
                        JOptionPane.showMessageDialog(getFrame(),
                                SUCCESS_MESSAGE,
                                ClientContext.getFrameTitle(getName()),
View Full Code Here

        connect();
        setModel(adminModel);
    }
   
    public UserModel getModel() {
        adminModel = new UserModel();
        return getAdminUser(adminModel);
    }
View Full Code Here

     */
    @RolesAllowed("admin")
    @Override
    public int removeUser(String removeId) {
       
        UserModel remove = getUser(removeId);
        long removePk = remove.getId();
       
        // Stamp を削除する
        Collection<StampModel> stamps = (Collection<StampModel>) em.createQuery("from StampModel s where s.userId = :pk")
        .setParameter("pk", removePk)
        .getResultList();
        for (StampModel stamp : stamps) {
            em.remove(stamp);
        }
       
        // Subscribed Tree を削除する
        Collection<SubscribedTreeModel> subscribedTrees = (Collection<SubscribedTreeModel>)
        em.createQuery("from SubscribedTreeModel s where s.user.id = :pk")
        .setParameter("pk", removePk)
        .getResultList();
        for (SubscribedTreeModel tree : subscribedTrees) {
            em.remove(tree);
        }
       
        // PublishedTree を削除する
        Collection<PublishedTreeModel> publishedTrees = (Collection<PublishedTreeModel>)
        em.createQuery("from PublishedTreeModel p where p.user.id = :pk")
        .setParameter("pk", removePk)
        .getResultList();
        for (PublishedTreeModel tree : publishedTrees) {
            em.remove(tree);
        }
       
        // PersonalTreeを削除する
        StampTreeModel stampTree = (StampTreeModel) em.createQuery("from StampTreeModel s where s.user.id = :pk")
        .setParameter("pk", removePk)
        .getSingleResult();
        em.remove(stampTree);
       
        //
        // ユーザを削除する
        //
        if (remove.getLicenseModel().getLicense().equals("doctor")) {
            StringBuilder sb = new StringBuilder();
            sb.append(new Date());
            String note = sb.toString();
            remove.setMemo(note);
            remove.setPassword("c9dbeb1de83e60eb1eb3675fa7d69a02");
            remove.setMemberType("EXPIRED");
        } else {
            em.remove(remove);
        }
           
        boolean deleteDoc = false;
View Full Code Here

     * 施設及び管理者アカウントを登録する。
     */
    private void addFacilityAdmin() {
       
        // 登録するユーザモデルを得る
        UserModel model = accountInfo.getModel();
       
        // Password の hash化を行う
        String userId = model.getUserId();
        String hashPass = HashUtil.MD5(model.getPassword());
        //String Algorithm = ClientContext.getString("addUser.password.hash.algorithm");
        //String encoding = ClientContext.getString("addUser.password.hash.encoding");
        //String charset = ClientContext.getString("addUser.password.hash.charset");
        //String charset = null;
        //String hashPass = CryptoUtil.createPasswordHash(Algorithm,encoding,charset,userId,model.getPassword());
        model.setPassword(hashPass);
       
        String message = "アカウント登録";
        String note = userId + "を登録しています...";
        Component c = SwingUtilities.getWindowAncestor(this);
       
View Full Code Here

     */
    @RolesAllowed("user")
    @Override
    public UserModel getUser(String userId) {
        checkIdAsComposite(ctx, userId);
        UserModel user = (UserModel) em.createQuery("from UserModel u where u.userId = :uid")
        .setParameter("uid", userId)
        .getSingleResult();
       
        if (user.getMemberType() != null && user.getMemberType().equals("EXPIRED")) {
            throw new SecurityException("Expired User");
        }
       
        return user;
    }
View Full Code Here

        .setParameter("fid", getCallersFacilityId(ctx)+"%")
        .getResultList();
       
        Collection<UserModel> ret = new ArrayList<UserModel>();
        for (Iterator iter = results.iterator(); iter.hasNext(); ) {
            UserModel user = (UserModel) iter.next();
            if (user != null && user.getMemberType() != null && (!user.getMemberType().equals("EXPIRED"))) {
                ret.add(user);
            }
        }
       
        return ret;
View Full Code Here

     */
    @RolesAllowed("user")
    @Override
    public int updateUser(UserModel update) {
        //checkFacility(ctx, update.getUserId());
        UserModel current = (UserModel) em.find(UserModel.class, update.getId());
        update.setMemberType(current.getMemberType());
        update.setRegisteredDate(current.getRegisteredDate());
        em.merge(update);
        return 1;
    }
View Full Code Here

TOP

Related Classes of open.dolphin.infomodel.UserModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.