private void apppendDataRow(FormatterContext context, UpdateType updateType) {
   DataRowBuilder row = new DataRowBuilder(context.getWriter());
   row.begin();
   row.append(updateType.getTable().getSystemName());
   row.append(updateType.getSequence());
   row.append(updateType.getAttributes());
   row.append(updateType.getDefault());
   row.append(updateType.getValidationExpressions());
   row.append(updateType.getUpdateHelp());
   row.append(updateType.getValidationLookup());
   row.append(updateType.getValidationExternal());
   row.end();
 }
Пример #2
0
  public void doUpdateType(Session hSession) throws HibernateException {
    MetadataTable tUpdateTypes = getMetadataTable(MetadataTable.UPDATE_TYPE);

    Iterator i = mUpdates.values().iterator();
    while (i.hasNext()) {
      Update update = (Update) i.next();
      Set hUpdateTypes = new HashSet();
      List updateTypes = tUpdateTypes.getDataRows(update.getPath());
      if (updateTypes != null) {
        Iterator j = updateTypes.iterator();
        while (j.hasNext()) {
          Metadata md = (Metadata) j.next();
          UpdateType updateType = new UpdateType();

          updateType.setUpdate(update);
          String level = update.getLevel();
          String systemName = md.getAttribute("SystemName");
          String tablePath = level + ":" + systemName;
          Table table = (Table) mTables.get(tablePath);
          updateType.setTable(table);
          // Hack to get around metadata bug
          if (table == null) {
            LOG.error("null table for path: " + tablePath);
            System.exit(1);
          }

          updateType.setSequence(Integer.parseInt(md.getAttribute("Sequence")));

          String joinedAttributes = md.getAttribute("Attributes");
          String attributes[] = StringUtils.split(joinedAttributes, ",");
          Set attributeSet = new HashSet();
          for (int c = 0; c < attributes.length; c++) {
            attributeSet.add(UpdateTypeAttributeEnum.fromInt(Integer.parseInt(attributes[c])));
          }
          updateType.setAttributes(attributeSet);

          updateType.setDefault(md.getAttribute("Default"));

          String valExp[] = StringUtils.split(md.getAttribute("ValidationExpressionID"), ",");
          Set valExpSet = new HashSet();
          String resourcePath = update.getMClass().getResource().getPath();
          for (int c = 0; c < valExp.length; c++) {
            String vePath = resourcePath + ":" + valExp[c];
            ValidationExpression ve = (ValidationExpression) mValidationExpressions.get(vePath);
            valExpSet.add(ve);
          }
          updateType.setValidationExpressions(valExpSet);

          String updateHelpPath = resourcePath + ":" + md.getAttribute("UpdateHelpID");
          updateType.setUpdateHelp((UpdateHelp) mUpdateHelps.get(updateHelpPath));

          String vlPath = resourcePath + ":" + md.getAttribute("ValdiationLookupName");
          updateType.setValidationLookup((ValidationLookup) mValidationLookups.get(vlPath));

          String vePath = resourcePath + ":" + md.getAttribute("ValdationExternalName");
          updateType.setValidationExternal((ValidationExternal) mValidationExternals.get(vePath));

          hSession.save(updateType);
          hUpdateTypes.add(updateType);
        }
      }
      update.setUpdateTypes(hUpdateTypes);
      hSession.saveOrUpdate(update);
    }
  }