private void makeMaregdRecord(
      int databaseType, Record record, String controlNumber, CustomStorageRecord storageRecord) {
    // making latin record
    String entryTag = StorageUtils.findEntryTagForAuthority((AuthorityRecord) storageRecord);
    String entryRelatedTag = "7" + entryTag.substring(1);
    record = storageRecord.getRecord();
    Record engRecord = MarcUtils.parseContent(storageRecord.getContent());
    engRecord.getControlField(Tags.ID).setData("0");

    // exchanging fields
    DataField df200 = engRecord.getDataField(entryTag);
    DataField df700 = engRecord.getDataField(entryRelatedTag);
    if (df700 != null) {
      df700.setTag(entryTag);
      if (df200 != null) {
        df200.setTag(entryRelatedTag);
        df200.add(new Subfield('3', String.valueOf(storageRecord.getId())));
      }
      CustomStorageRecord engStorageRecord =
          StorageUtils.createNewStorageRecord(
              StorageUtils.getStorageClassByClassType(databaseType));
      engStorageRecord.setId(0);
      engStorageRecord.setContent(MarcUtils.marshalContent(engRecord));
      engStorageRecord.setLanguageOfCataloging(MarcConsts.LANG_ENGLISH);
      engStorageRecord.setCharacterSets("50");
      engStorageRecord.setSubfieldRangeData(Tags.GENERAL_PROCESSING_DATA, 'a', "ba", 21, 22);
      engStorageRecord.setSubfieldRangeData(Tags.GENERAL_PROCESSING_DATA, 'a', "0", 23, 23);
      engStorageRecord.setSubfieldData(Tags.LANGUAGE_OF_THE_ITEM, 'a', MarcConsts.LANG_PERSIAN);

      try {
        engStorageRecord = save(engStorageRecord);
        logger.info("      ^^ english record added.", null);
        df700 = record.getDataField(entryRelatedTag);
        if (df700 != null) {
          df700.add(new Subfield('3', String.valueOf(engStorageRecord.getId())));
          storageRecord.setContent(MarcUtils.marshalContent(record));
          storageRecord = save(storageRecord);
          logger.info("      ^^ farsi record changed.", null);
        }

      } catch (Exception ex) {
        logger.error("error: RecordNo = " + controlNumber + "  english making error!! **", ex);
      }
    }
  }
  public boolean importRecord(
      AbstractWorkGroup workGroup,
      Class<CustomStorageRecord> persistentClass,
      TempDatabankDefinition storageDatabak,
      Record record,
      boolean isFromDos,
      boolean addToNews,
      int NewsDuration) {
    String controlNumber = "";

    ControlField cf = record.getControlField(Tags.ID);
    if (cf == null) {
      cf = new ControlField(Tags.ID, "0");
      record.getControlFieldList().add(0, cf);
    }
    controlNumber = String.copyValueOf(cf.getData());
    if (controlNumber == null || controlNumber.length() == 0) {
      controlNumber = "0";
    }
    //		CustomStorageRecord storageRecord = StorageUtils
    //				.createNewStorageRecord(StorageUtils
    //						.getStorageClassByClassType(databaseType));
    //		storageRecord.setContent(MarcUtils.marshalContent(record));

    //		if (isFromDos) {
    UniBibUtils.setCharacterSets(record, "50");
    //			storageRecord.setCharacterSets("50");
    //        String docType = UniBibUtils.getLocalDocType(record);
    //        if ("AF".equals(docType)) {
    //            String file = MarcUtils.getSubfieldData(record, Tags.BIB_ELECTRONICAL_LOCATION, 0,
    // 'd', 0);
    //            if (file != null && file.length() != 0)
    //                MarcUtils.setSubfieldData(record, Tags.CUSTOM_CATEGORY, 'a', "G");
    //        }
    //		}
    /** @todo move to server */
    //		storageRecord.setDateEnterdOnFile(insertDate);

    //		storageRecord.setId(0);

    try {
      List holdings = generateHoldings(record);
      CustomStorageRecord storageRecord =
          (CustomStorageRecord) StorageUtils.createNewStorageRecord(persistentClass);
      if (storageRecord instanceof TempDatabankRecord) {
        ((TempDatabankRecord) storageRecord).setDatabank(storageDatabak);
      }
      if (storageRecord instanceof BaseBibliographicRecord) {
        storageRecord.setWorkGroup(workGroup);
      }

      storageRecord.setContent(MarcUtils.marshalContent(record));
      long id = saveFast(storageRecord, holdings);
      logger.info("Saved: New record no. = " + id, null);
      if (holdings.size() > 0)
        logger.info(holdings.size() + " holding(s) has been attached to record no. " + id, null);

    } catch (Exception ex) {
      logger.error("Not saved!: Old recordNo = " + controlNumber, ex);
    }

    return true;
  }
 public RecordPersisterImpFast(Logger logger) {
   this.logger = logger;
   insertDate = StorageUtils.formatDate(new Date(), NliConstants.CREATE_RECORD_DATE);
   initHoldingService();
 }
 public void initModel() {
   super.initModel();
   if (TempGiftExchangeRecord.class.isAssignableFrom(persistentClass))
     profilePanel.init(Sections.EXCHANGE_SECTION, WorkflowConstants.RECEIVE, null);
   else profilePanel.init(StorageUtils.extractSection(persistentClass), NliConstants.SENDER, null);
 }