Package open.dolphin.delegater

Source Code of open.dolphin.delegater.MasterDelegater

package open.dolphin.delegater;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import javax.naming.NamingException;
import open.dolphin.dto.MasterSearchSpec;
import open.dolphin.ejb.RemoteMasterService;
import open.dolphin.infomodel.AdminComentValue;
import open.dolphin.infomodel.AdminValue;
import open.dolphin.infomodel.RadiologyMethodValue;

/**
* MasterDelegater
*
* @author Kazushi Minagawa
*/
public final class MasterDelegater extends BusinessDelegater {

    public MasterDelegater() {
    }
   
    /**
     * select ... from administration where hiearchyCode1 is not null order by hierarchyCode1
     * valueObject: AdministrationEntry
     */
    public Object[] getAdminClass() {
     
      Collection ret = null;

        try {
            MasterSearchSpec spec = new MasterSearchSpec();
            spec.setCode(MasterSearchSpec.ADMIN_CLASS);
            spec.setFrom("0");
            ret = getService().getMaster(spec);

        } catch (NamingException e) {
          e.printStackTrace();
          processError(e);
        }

        return (ret != null && ret.size() >0) ?  ret.toArray() : null;
    }

    /**
     * select ... from administration where hierarchyCode2 like %h1 order by hierarchyCode2
     * valuObject: AdministrationEntry
     */
    public List<AdminValue> getAdministration(String h1) {
     
      List<AdminValue> collection = new ArrayList<AdminValue>();
       
        try {
            MasterSearchSpec spec = new MasterSearchSpec();
            spec.setCode(MasterSearchSpec.ADMINISTRATION);
            spec.setHierarchyCode1(h1 + "%");
            Collection result = getService().getMaster(spec);
           
            for (Iterator iter = result.iterator(); iter.hasNext(); ) {
              collection.add((AdminValue)iter.next());
            }
           
        } catch (NamingException e) {
          e.printStackTrace();
          processError(e);
        }

        return collection;
    }

    /**
     * select ... from admin_comment
     * valuObject: String
     */
    public Object[] getAdminComment() {

      ArrayList<String> list = null;
     
        try {
            MasterSearchSpec spec = new MasterSearchSpec();
            spec.setCode(MasterSearchSpec.ADMIN_COMENT);
            Collection result = getService().getMaster(spec);
            Iterator iter = result.iterator();
            AdminComentValue value = null;
            list = new ArrayList<String>();
           
            while (iter.hasNext()) {
              value = (AdminComentValue)iter.next();
                list.add(value.getAdminComent());
            }
           
        } catch (NamingException e) {
          e.printStackTrace();
          processError(e);
        }

        return list != null ? list.toArray() : null;
    }


    /**
     * select ... from radiology_method where hierarchyCode1 is not null order by hierarchyCode1
     * valuObject: RadiologyMethodEntry
     */
    public Object[] getRadiologyMethod() {                 //This was orginal

        Collection collection = null;

        try {
            MasterSearchSpec spec = new MasterSearchSpec();
            spec.setCode(MasterSearchSpec.RADIOLOGY_METHOD);
            spec.setFrom("0");
            collection  = getService().getMaster(spec);
           
        } catch (NamingException e) {
          e.printStackTrace();
          processError(e);
        }

        return collection != null ? collection.toArray() : null;
    }

    /**
     * select ... from radiology_method where hierarchyCode2 like h1% order by hierarchyCode2
     * valuObject: RadiologyMethodEntry
     */
    public List<RadiologyMethodValue> getRadiologyComments(String h1) {

        List<RadiologyMethodValue> collection = null;

        try {
            MasterSearchSpec spec = new MasterSearchSpec();
            spec.setCode(MasterSearchSpec.RADIOLOGY_COMENT);
            spec.setHierarchyCode1(h1+ "%");
            Collection result = getService().getMaster(spec);
            collection = new ArrayList<RadiologyMethodValue>();

            for (Iterator iter = result.iterator(); iter.hasNext(); ) {
              RadiologyMethodValue value = (RadiologyMethodValue)iter.next();
                collection.add(value);
            }

        } catch (NamingException e) {
          e.printStackTrace();
          processError(e);
        }
       
        return collection;
    }
   
    private RemoteMasterService getService() throws NamingException {
            return (RemoteMasterService) getService("RemoteMasterService");
    }
}
TOP

Related Classes of open.dolphin.delegater.MasterDelegater

TOP
Copyright © 2018 www.massapi.com. 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.