Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5254


Ignore:
Timestamp:
01/08/11 14:28:59 (14 years ago)
Author:
mholper
Message:

added createmissingAlgoParams Method #1218

Location:
branches/OKBJavaConnector/HLOKBWebClient/src/main/java/at/hl/okb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/OKBJavaConnector/HLOKBWebClient/src/main/java/at/hl/okb/impl/ECJ19ConnectorImpl.java

    r5252 r5254  
    66import java.util.List;
    77import java.util.Map;
     8import java.util.Set;
    89
    910import com.sun.codemodel.writer.PrologCodeWriter;
     
    4142    Long algorithmId = okbClient.getAlgorithmId(algorithmName, platformId);
    4243    if (algorithmId == null)
    43       throw new Exception("Algorithm " + algorithmName + " for Platform" + platformName + " not found!");
     44      throw new Exception("Algorithm " + algorithmName + " for Platform " + platformName + " not found!");
    4445
    4546    Long problemId = okbClient.getProblemId(problemName);
     
    5556    // TODO Auto-generated method stub
    5657   
     58    Set<String> missingParamSet = algoParams.keySet();
     59    missingParamSet.removeAll(okbClient.getAlgorithmParameterMap(state.getAlgorithmId()).keySet());
     60   
     61    //fehlende Param Anlegen
     62   
     63    okbClient.createMissingAlgoParams(state.getAlgorithmId(), missingParamSet);   
    5764
    5865    //create Experiment if algoparams not exists in HL and problemparams not exits (in HL)
  • branches/OKBJavaConnector/HLOKBWebClient/src/main/java/at/hl/okb/wsclient/OKBServiceClient.java

    r5249 r5254  
    88import java.util.List;
    99import java.util.Map;
     10import java.util.Set;
     11
     12import javax.xml.bind.JAXBElement;
    1013
    1114import at.hl.wsclient.okb.Algorithm;
    1215import at.hl.wsclient.okb.AlgorithmClass;
     16import at.hl.wsclient.okb.AlgorithmData;
    1317import at.hl.wsclient.okb.AlgorithmParameter;
    1418import at.hl.wsclient.okb.ArrayOfAlgorithmParameter;
     
    102106  }
    103107
    104   // public Map<String, ECJDataTypeEnum> getAlgorithParameter(Long
    105   // algorithmId) {
    106   // Map<String, AlgorithmParameter> returnMap = new HashMap<String,
    107   // AlgorithmParameter>();
    108   //
    109   // AlgorithmData algoData = port.getAlgorithmData(algorithmId);
    110   //
    111   // ArrayOfAlgorithmParameter algoParamList =
    112   // port.getAlgorithmParameters(algorithmId);
    113   //
    114   // for (AlgorithmParameter algoParam:algoParamList.getAlgorithmParameter())
    115   // {
    116   // mapOKBDataTypetoECJDataTypeEnum()
    117   // port.getDataType(algoParam.getDataTypeId()).getName().getValue()) {
    118   //
    119   // }
    120   // returnMap.put(algoParam.getName().getValue(),
    121   // port.getDataType(algoParam.getDataTypeId()).getName().getValue());
    122   // }
    123   //
    124   // return returnMap;
    125   // }
     108  public Map<String, Object> getAlgorithmParameterMap(Long algorithmId) {
     109    Map<String, Object> returnMap = new HashMap<String, Object>();
     110
     111    AlgorithmData algoData = port.getAlgorithmData(algorithmId);
     112
     113    ArrayOfAlgorithmParameter algoParamList = port
     114        .getAlgorithmParameters(algorithmId);
     115
     116    for (AlgorithmParameter algoParam : algoParamList
     117        .getAlgorithmParameter()) {
     118      returnMap.put(algoParam.getName().getValue(), null);
     119      // port.getDataType(algoParam.getDataTypeId()).getName().getValue());
     120    }
     121
     122    return returnMap;
     123  }
    126124
    127125  private <T extends NamedOKBItem> T createNamedOKBItem(Class<T> clazz,
     
    137135    }
    138136  }
    139  
     137
    140138  public Boolean areAlgoParamsEqual() {
    141139    Boolean retval = false;
    142    
    143    
     140
    144141    return retval;
    145142  }
    146143
    147144  public void createMissingAlgoParams(Long algorithmId,
    148       Map<String, Object> ecjAlgoParams) {
     145      Set<String> missingParamNames) {
    149146
    150     List<String> missingParams = new ArrayList<String>();
    151 
    152     ArrayOfAlgorithmParameter hlAlgoParams = port
    153         .getAlgorithmParameters(algorithmId);
    154     Map<String, Object> hlAlgoParamMap = new HashMap<String, Object>();
    155 
    156     for (AlgorithmParameter algoParam : hlAlgoParams
    157         .getAlgorithmParameter()) {
    158       hlAlgoParamMap.put(algoParam.getName().getValue(), null); // value
    159       // hangs
    160       // on
    161       // Experiments
     147    //falls Werte auch verglichen werdne sollen
     148    //Map<String, Object> ecjAlgoParams
     149    //Set<String> missingParamNames = ecjAlgoParams.keySet();
     150    for (String paramname : missingParamNames) {
     151      AlgorithmParameter newAlgoParam = new AlgorithmParameter();
     152      newAlgoParam.setAlgorithmId(algorithmId);
     153      newAlgoParam.setDataTypeId(null);// TODO insert DatatypeId if not
     154                        // exists (mapping first);
     155      newAlgoParam.setDescription(factory
     156          .createNamedOKBItemDescription("created from ECJ"));
     157      newAlgoParam.setName(factory
     158          .createNamedOKBItemDescription(paramname));
     159      port.addAlgorithmParameter(newAlgoParam);
    162160    }
    163 
    164     String[] ecjparamNames = (String[]) ecjAlgoParams.keySet().toArray();
    165 
    166     for (int i = 0; i < ecjparamNames.length; i++) {
    167       if (!hlAlgoParamMap.containsKey(ecjparamNames[i])) {
    168         missingParams.add(new String(ecjparamNames[i]));
    169       }
    170     }
    171 
    172161  }
    173162}
Note: See TracChangeset for help on using the changeset viewer.