⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jivexml.java

📁 解觖java技术中后台无法上传数给的情况
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                              MVNForumPermission.PERMISSION_ADD_THREAD};
        } else if (jivePermission.equalsIgnoreCase("CREATE_THREAD")) {
            return new int[] {MVNForumPermission.PERMISSION_ADD_THREAD};
        } else if (jivePermission.equalsIgnoreCase("MODERATE_MESSAGES")) {
            return new int[] {MVNForumPermission.PERMISSION_READ_POST,
                              MVNForumPermission.PERMISSION_ADD_POST,
                              MVNForumPermission.PERMISSION_EDIT_POST,
                              MVNForumPermission.PERMISSION_DELETE_POST};
        } else if (jivePermission.equalsIgnoreCase("CREATE_MESSAGE")) {
            return new int[] {MVNForumPermission.PERMISSION_ADD_POST};
        } else if (jivePermission.equalsIgnoreCase("CREATE_ATTACHMENT")) {
            return new int[] {MVNForumPermission.PERMISSION_ADD_ATTACHMENT};
        } else if (jivePermission.equalsIgnoreCase("READ_FORUM")) {
            return new int[] {MVNForumPermission.PERMISSION_READ_POST};
        } else if (jivePermission.equalsIgnoreCase("READ")) {
            return new int[] {MVNForumPermission.PERMISSION_READ_POST};
        } else {
            return new int[] {MVNForumPermission.PERMISSION_NO_PERMISSIONS};
        }
    }


// ================================================================================
// ==================== METHODS TO BE CALLED FROM THE DIGESTER ====================
// ================================================================================
    public void setJiveXmlVersion(String value) {
        ImportJive.addMessage("Jive XML version = \""+value+"\"");
    }

    public void setJiveExportDate(String value) {
        ImportJive.addMessage("Jive XML export date = \""+value+"\"");
    }

    public void addJiveUserPermission(String usertype, String username, String jivePermission)
    throws CreateException, DatabaseException, ObjectNotFoundException,
    ForeignKeyNotFoundException {
        if (usertype==null) {
            throw new CreateException("Not enough data to create a member global permission.");

        } else if (usertype.equalsIgnoreCase("ANONYMOUS")) {
            int[] perms = JiveXML.convertMemberPermission(jivePermission);
            for (int j=0; j<perms.length; j++) {
                try {
                    JiveXML.addGuestMemberPermission(Integer.toString(perms[j]));
                } catch (DuplicateKeyException e) {
                    /* Ignore if we doubled some permissions.
                     * Because we convert each Jive permission into the list of
                     * MVN Forum permissions (can be more than one), some permissions
                     * could be generated twice, or more times.
                     */
                }
            }

        } else if (usertype.equalsIgnoreCase("REGISTERED_USERS")) {
            int[] perms = JiveXML.convertGroupPermission(jivePermission);
            for (int j=0; j<perms.length; j++) {
                try {
                    JiveXML.addRegisteredMembersGroupPermission(Integer.toString(perms[j]));
                } catch (DuplicateKeyException e) {
                   /* Ignore if we doubled some permissions.
                    * Because we convert each Jive permission into the list of
                    * MVN Forum permissions (can be more than one), some permissions
                    * could be generated twice, or more times.
                    */
                }
            }

        } else if (usertype.equalsIgnoreCase("USER")) {
            int[] perms = JiveXML.convertMemberPermission(jivePermission);
            for (int j=0; j<perms.length; j++) {
                try {
                    JiveXML.addMemberPermission(username, Integer.toString(perms[j]));
                } catch (DuplicateKeyException e) {
                    /* Ignore if we doubled some permissions.
                     * Because we convert each Jive permission into the list of
                     * MVN Forum permissions (can be more than one), some permissions
                     * could be generated twice, or more times.
                     */
                }
            }

        } else {
            throw new CreateException("Invalid usertype. This Jive user global permission is ignored.");
        }
    }

    public void addJiveGroupPermission(String groupname, String jivePermission)
    throws CreateException, DatabaseException, ObjectNotFoundException,
    ForeignKeyNotFoundException {
        if ( (groupname==null) || (groupname.equals("")) ) {
            throw new CreateException("Not enough data to create a group global permission.");
        } else {
            int[] perms = JiveXML.convertGroupPermission(jivePermission);
            for (int j=0; j<perms.length; j++) {
                try {
                    JiveXML.addGroupPermission(groupname, Integer.toString(perms[j]));
                } catch (DuplicateKeyException e) {
                   /* Ignore if we doubled some permissions.
                    * Because we convert each Jive permission into the list of
                    * MVN Forum permissions (can be more than one), some permissions
                    * could be generated twice, or more times.
                    */
                }
            }
        }
    }


//  ================================================================================
//  ====================== UTILITY METHODS ABOUT PERMISSIONS =======================
//  ================================================================================
     public static int[] addDefaultPermissionsToGuests = new int[]{
         //MVNForumPermission.PERMISSION_SEND_MAIL,
         //MVNForumPermission.PERMISSION_USE_MESSAGE,
         //MVNForumPermission.PERMISSION_USE_AVATAR,
         //MVNForumPermission.PERMISSION_ADD_POLL,
         //MVNForumPermission.PERMISSION_EDIT_POLL,
         //MVNForumPermission.PERMISSION_DELETE_POLL,
         //MVNForumPermission.PERMISSION_GET_ATTACHMENT
     };
     public static int[] addDefaultPermissionsToMembers = new int[]{
         //MVNForumPermission.PERMISSION_SEND_MAIL,
         MVNForumPermission.PERMISSION_USE_MESSAGE,
         MVNForumPermission.PERMISSION_USE_AVATAR,
         //MVNForumPermission.PERMISSION_ADD_POLL,
         //MVNForumPermission.PERMISSION_EDIT_POLL,
         //MVNForumPermission.PERMISSION_DELETE_POLL,
         MVNForumPermission.PERMISSION_GET_ATTACHMENT
     };

     /**
      * TODO Igor: enter description
      *
      * @param username
      * @param permission
      */
     public static void addMemberPermission(String username, String permission)
     throws ObjectNotFoundException, CreateException, DatabaseException,
     ForeignKeyNotFoundException, DuplicateKeyException {
         MemberXML.addMemberPermission(username, permission);
     }

     /**
      * TODO Igor: enter description
      *
      * @param permission
      */
     public static void addRegisteredMembersGroupPermission(String permission)
     throws CreateException, DatabaseException, DuplicateKeyException,
     ForeignKeyNotFoundException {
         GroupXML.addRegisteredMembersGroupPermission(permission);
     }

     /**
      * TODO Igor: enter description
      *
      * @param permission
      */
     public static void addGuestMemberPermission(String permission)
     throws CreateException, DatabaseException, DuplicateKeyException,
     ForeignKeyNotFoundException {
         MemberXML.addGuestMemberPermission(permission);
     }

     /**
      * TODO Igor: enter description
      *
      * @param groupname
      * @param permission
      */
     public static void addGroupPermission(String groupname, String permission)
     throws CreateException, DatabaseException, DuplicateKeyException,
     ForeignKeyNotFoundException, ObjectNotFoundException {
         GroupXML.addGroupPermission(groupname, permission);
     }


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -