You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
package core.operation.utils;
|
|
|
|
import error.GExcptFormat;
|
|
import gdms.Configuration;
|
|
import gdms.Mode;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
public interface Utils {
|
|
Map<String,String> fileTableField = new HashMap<>() {
|
|
{
|
|
put("announcement","annex_url");
|
|
put("graduation_design_finished_product","graduation_design_url");
|
|
put("graduation_design_opening_report","report_url");
|
|
}};
|
|
static String stringOptionsFormat(String options){
|
|
return options.replaceAll(" {2,}", " ") ;
|
|
}
|
|
static Map<String, Object> string2MapOptions(String sOptions) throws GExcptFormat {
|
|
sOptions = stringOptionsFormat(sOptions);
|
|
Map<String, Object> options = new HashMap<>();
|
|
String[] sOpts = sOptions.split(" ");
|
|
for(int i=0;i<sOpts.length;i++){
|
|
if(Mode.strict==1){
|
|
if(sOpts[i].indexOf(0)=='-')
|
|
throw new GExcptFormat("options format error");
|
|
}
|
|
options.put(sOpts[i].substring(1),sOpts[++i]);
|
|
}
|
|
return options;
|
|
}
|
|
static String getFileField(String table){
|
|
return fileTableField.get(table);
|
|
}
|
|
}
|