Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Changeset 3446

Show
Ignore:
Timestamp:
02/21/08 17:46:14 (11 months ago)
Author:
tmdugan
Message:

-- dss

* added a utility method to process a file directory name
* changed DssManager to store a HashMap of maxDssElements for a given dss type

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/dss/metadata/config.xml

    r3397 r3446  
    77        <id>dss</id> 
    88        <name>Dss</name> 
    9         <version>2.05</version> 
     9        <version>2.06</version> 
    1010        <package>org.openmrs.module.@MODULE_ID@</package> 
    1111        <author>Vibha Anand and Tammy Dugan</author> 
  • openmrs-modules/dss/src/org/openmrs/module/dss/DssManager.java

    r3401 r3446  
    2525        private HashMap<String,ArrayList<DssElement>> dssElementsByType = null; 
    2626        private Patient patient = null; 
     27        private HashMap<String, Integer> maxDssElementsByType = null; 
    2728 
    2829        public DssManager(Patient patient) 
     
    3132        } 
    3233         
    33         public void populateDssElements(int numDssElements,String type, boolean override) 
     34        public void populateDssElements(String type, boolean override) 
    3435        { 
    3536                if(this.dssElementsByType == null) 
     
    6263                ArrayList<Rule> processedRules = null; 
    6364                Result currResult = null; 
    64                 int batchSize = numDssElements; 
     65                int maxDssElements = getMaxDssElementsByType(type); 
     66                int batchSize = maxDssElements; 
    6567                AdministrationService adminService = Context.getAdministrationService(); 
    6668                final int BATCH_SIZE = Integer.parseInt(adminService 
    6769                                .getGlobalProperty("dss.batchSizeRunRules")); 
    6870 
    69                 while (dssElements.size() < numDssElements && iter.hasNext()) 
     71                while (dssElements.size() < maxDssElements && iter.hasNext()) 
    7072                { 
    7173                        ruleList = new ArrayList<Rule>(); 
     
    129131                return this.dssElementsByType; 
    130132        } 
     133 
     134        public void setMaxDssElementsByType(String type, int maxDssElements) 
     135        { 
     136                if(this.maxDssElementsByType == null) 
     137                { 
     138                        this.maxDssElementsByType = new HashMap<String,Integer>(); 
     139                } 
     140                 
     141                this.maxDssElementsByType.put(type, new Integer(maxDssElements)); 
     142        } 
     143         
     144        public int getMaxDssElementsByType(String type) 
     145        { 
     146                Integer lookup = null; 
     147                 
     148                if (this.maxDssElementsByType != null) 
     149                { 
     150                        lookup = this.maxDssElementsByType.get(type); 
     151                } 
     152                 
     153                if(lookup != null) 
     154                { 
     155                        return lookup.intValue(); 
     156                } 
     157                return 0; 
     158        } 
    131159} 
  • openmrs-modules/dss/src/org/openmrs/module/dss/util/Util.java

    r3411 r3446  
    298298        } 
    299299         
     300        public static String processFileDirectory(String fileDirectory) 
     301        { 
     302                if(!(fileDirectory.endsWith("/")||fileDirectory.endsWith("\\"))) 
     303                { 
     304                        fileDirectory+="/"; 
     305                } 
     306                return fileDirectory; 
     307        } 
     308         
    300309        public static String processFileDirectoryGlobalProperty(String property) 
    301310        { 
    302311                AdministrationService adminService = Context.getAdministrationService(); 
    303312                String fileDirectory = adminService.getGlobalProperty(property); 
    304                 if(!(fileDirectory.endsWith("/")||fileDirectory.endsWith("\\"))) 
    305                 { 
    306                         fileDirectory+="/"; 
    307                 } 
    308                 return fileDirectory; 
     313                return processFileDirectory(fileDirectory); 
    309314        } 
    310315}