public void run(
      Class object,
      Resource resource,
      IProgressMonitor monitor,
      Map<String, VCObject> seenObjects,
      List<Option> options)
      throws JCoException {
    beginTransaction();
    JCoFunction function = getJCoFunction(getBAPI(), monitor);
    JCoParameterList ipl = function.getImportParameterList();
    String classSpec = object.getName();
    String className = VcmlUtils.getClassName(classSpec);
    int classType = VcmlUtils.getClassType(classSpec);

    // handleOptions(options, ipl, "???", "???");

    ipl.setValue(getCLASSNUM(), className);
    ipl.setValue(getCLASSTYPE(), classType);
    JCoStructure classBasicDataNew = ipl.getStructure(getCLASSBASICDATA());
    classBasicDataNew.setValue("STATUS", VcmlUtils.createIntFromStatus(object.getStatus()));
    classBasicDataNew.setValue("CLASSGROUP", nullIfEmpty(object.getGroup()));
    classBasicDataNew.setValue("VALID_FROM", getToday()); // TODO set VALID_FROM for classes?
    classBasicDataNew.setValue("VALID_TO", "9999-12-31"); // TODO set VALID_TO for classes?
    JCoParameterList tpl = function.getTableParameterList();
    final JCoTable classDescriptionsNew = tpl.getTable(getCLASSDESCRIPTIONS());
    new DescriptionHandler() {
      @Override
      public void handleSingleDescription(Language language, String value) {
        classDescriptionsNew.appendRow();
        classDescriptionsNew.setValue("CATCHWORD", value);
        classDescriptionsNew.setValue("LANGU", VcmlUtils.getLanguageCharacter(language));
        classDescriptionsNew.setValue("LANGU_ISO", language.toString());
      }
    }.handleDescription(object.getDescription());
    JCoTable classCharacteristicsNew = tpl.getTable(getCLASSCHARACTERISTICS());
    List<Characteristic> cstics = object.getCharacteristics();
    classCharacteristicsNew.appendRows(cstics.size());
    for (Characteristic cstic : cstics) {
      classCharacteristicsNew.setValue("NAME_CHAR", cstic.getName());
      classCharacteristicsNew.nextRow();
    }
    execute(function, monitor, object.getName());
    if (processReturnTable(function)) {
      commit(monitor);
    }
    endTransaction();
  }
예제 #2
0
 public static Class mkClass(final String name, final Description description) {
   final Class clazz = VCML.createClass();
   clazz.setName(name);
   clazz.setDescription(description);
   return clazz;
 }