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

📄 wrapperutil.java

📁 客户管理系统,很强大的功能,能完成日常生活中的大部分事务
💻 JAVA
字号:


package custom_management;

import java.util.*;

public final class WrapperUtil {
  //返回包装成RoleObject对象的Collection
 public static final Collection wrapperToRoleObject(Collection old )
 {
     Collection result = new ArrayList();
    old = Collections.unmodifiableCollection(old);
    for (Iterator iter = old.iterator(); iter.hasNext(); ) {
        WbRole item = (WbRole) iter.next();
        result.add(new RoleObject(item.getObjUid().longValue(),item.getName(),item.getDescription()));
    }
    return result;
 }
 //返回包装成EmployeeObject对象的Collection
 public static final Collection wrapperToEmployeeObject(Collection old)
 {
   Collection result = new ArrayList();
   old = Collections.unmodifiableCollection(old);
   for (Iterator iter = old.iterator(); iter.hasNext(); ) {
     WbEmployee item = (WbEmployee) iter.next();
     result.add(new EmployeeObject(item.getSn().toString(),item.getName(),item.getSex(),item.getAge().intValue(),item.getAddress(),item.getPw(),item.getNote()));
   }
   return result;
 }
 //返回未映射的角色
 public static final Collection wrapperRoleNotMapped(Collection roleMapped ,Collection roleAll)
 {
    Collection result = new ArrayList();
    if (roleMapped == null || roleMapped.size() == 0)
    {
     // System.out.println("roleMapped is null or size = 0 ");
      return wrapperToRoleObject(roleAll);
    }
     WbRole item = null;
     WbRole item1 = null;
    for (Iterator iter = roleAll.iterator(); iter.hasNext(); ) {
      item = (WbRole) iter.next();
      boolean find = false;

      for (Iterator iiter1 = roleMapped.iterator(); iiter1.hasNext(); ) {
        item1 = (WbRole) iiter1.next();
        if ((item.getObjUid().longValue() == item1.getObjUid().longValue())) {
          find = true;
          break;
        }
      }
      if (!find)
        result.add(new RoleObject(item.getObjUid().longValue(), item.getName(),
                                  item.getDescription()));
      //System.out.println("not find, added one Object !");

    }
    return result;
 }
 //返回未映射的用户
 public static final Collection wrapperEmployeeNotMapped(Collection empMapped ,Collection empAll)
{
   Collection result = new ArrayList();
   if (empMapped == null || empMapped.size() == 0)
     return wrapperToRoleObject(empAll);
    WbEmployee item = null;
    WbEmployee item1 = null;
   for (Iterator iter = empAll.iterator(); iter.hasNext(); ) {
     item = (WbEmployee) iter.next();
     boolean find = false;

     for (Iterator iiter1 = empMapped.iterator(); iiter1.hasNext(); ) {
       item1 = (WbEmployee) iiter1.next();
       if  (item.getSn().longValue() == item1.getSn().longValue()) {
         find = true;
         break;
       }
     }
     if (!find)
       result.add(new EmployeeObject(item.getSn().toString(), item.getName(),
                                     item.getSex(), item.getAge().intValue(),
                                     item.getAddress(), item.getPw(),
                                     item.getNote()));

   }
   return result;
}

}

⌨️ 快捷键说明

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