Create and initialize the record that has this class name.
@param strClassName Full class name.
@param recordOwner The recordowner to add this record to.
@return The new record.
775100
public static Record makeRecordFromClassName(String strClassName, RecordOwner recordOwner)
    {
        return Record.makeRecordFromClassName(strClassName, recordOwner, true, true);
    }
725988
public void init(Rec record, PTable tableRemote, PhysicalDatabaseParent dbOwner)
    {
        super.init(record);
        this.setPTableRef(tableRemote, dbOwner);
    }
1334862
public void setProperty(String strProperty, String strValue)
    {
        Record record = this.getMainRecord();
        BaseTable table = record.getTable();
        table.setProperty(strProperty, strValue);
    }
1288591
public Record makeRecordFromRecordName(String strRecordName, RecordOwner recordOwner)
    {
        int iOldKeyArea = this.getDefaultOrder();
        try {
            this.addNew();
            this.setKeyArea(ContactType.CODE_KEY);
            this.getField(ContactType.CODE).setString(strRecordName);
            if (this.seek(DBConstants.EQUALS))
                return this.makeContactRecord(recordOwner);
        } catch (DBException ex) {
            this.setKeyArea(iOldKeyArea);
        }
        return null;
    }
872607
public <RET extends Object> RET newInstance(final String iClassName) {
		checkSecurity(ODatabaseSecurityResources.CLASS, ORole.PERMISSION_CREATE, iClassName);

		try {
			return (RET) entityManager.createPojo(iClassName);
		} catch (Exception e) {
			OLogManager.instance().error(this, "Error on creating object of class " + iClassName, e, ODatabaseException.class);
		}
		return null;
	}
297471
public Record createSharedRecord(Object objKey, RecordOwner recordOwner)
    {
        if (objKey instanceof Integer)
        {
            int iCalendarType = ((Integer)objKey).intValue();
            if (iCalendarType == CalendarEntry.APPOINTMENT_ID)
                return new Appointment(recordOwner);
            if (iCalendarType == CalendarEntry.ANNIVERSARY_ID)
                return new Anniversary(recordOwner);
        }
        return null;
    }
232745
public static Record
newRecord(Name name, int type, int dclass, long ttl) {
	if (!name.isAbsolute())
		throw new RelativeNameException(name);
	Type.check(type);
	DClass.check(dclass);
	TTL.check(ttl);

	return getEmptyRecord(name, type, dclass, ttl, false);
}
472127
public void init(RecordOwnerParent parent, Rec recordMain, Map<String, Object> properties)
    {
        m_sessionObjectParent = parent;
        if (m_sessionObjectParent != null)
        	m_sessionObjectParent.addRecordOwner(this);
        else if (!this.getClass().getName().endsWith("TaskSession"))
        	Utility.getLogger().warning("Remote Session does not have parent");

        if (recordMain == null)
            recordMain = this.openMainRecord(); // No, open it!
        // Now look through the list and see if this query was added, it not, add it!
        boolean bQueryInTable = false;
        if (m_vRecordList != null)
        {
            for (Enumeration<Rec> e = m_vRecordList.elements() ; e.hasMoreElements() ;)
            {   // This should only be called for Imaged GridScreens (Child windows would be deleted by now if Component)
                Record cQueryInTable = (Record)e.nextElement();
                if (cQueryInTable == recordMain)
                    bQueryInTable = true;
            }
        }
        if (recordMain != null)
            if (!bQueryInTable)
                this.addRecord((Record)recordMain, false);
        this.openOtherRecords();    // Open the other files
        if (this.getScreenRecord() == null)
            this.setScreenRecord(this.addScreenRecord());

        this.addListeners();        // Add the session behaviors
    }
315612
public boolean addRecordOwner(RecordOwnerParent recordOwner)
    {
    	if (recordOwner instanceof RemoteRecordOwner)
    		return false;		// Sessions have their own owner hierarchy - Don't need to manage them
    	if (m_recordOwnerCollection == null)
    		m_recordOwnerCollection = new RecordOwnerCollection(this);
    	return m_recordOwnerCollection.addRecordOwner(recordOwner);
    }
225051
public Record makeContactRecord(RecordOwner recordOwner)
    {
        String strRecordClass = this.getField(ContactType.RECORD_CLASS).toString();
        return Record.makeRecordFromClassName(strRecordClass, recordOwner, true, false);
    }
1291048
public Record openMainRecord()
    {
        if (this.getProperty("recordClass") != null)
        {
                String strClassName = this.getProperty("recordClass");
                if (strClassName != null)
                    return Record.makeRecordFromClassName(strClassName, this);
        }
        return super.openMainRecord();
    }
768401
@SuppressWarnings("unchecked")
	public long addRecord(T record) throws IOException {

		if (recordsOutFile == null) {
			
			if (closed) {
				throw new IllegalStateException("The large record handler has been closed.");
			}
			if (recordsReader != null) {
				throw new IllegalStateException("The handler has already switched to sorting.");
			}
			
			LOG.debug("Initializing the large record spilling...");
			
			// initialize the utilities
			{
				final TypeComparator<?>[] keyComps = comparator.getFlatComparators();
				numKeyFields = keyComps.length;
				Object[] keyHolder = new Object[numKeyFields];
				
				comparator.extractKeys(record, keyHolder, 0);
				
				TypeSerializer<?>[] keySers = new TypeSerializer<?>[numKeyFields];
				TypeSerializer<?>[] tupleSers = new TypeSerializer<?>[numKeyFields + 1];
				
				int[] keyPos = new int[numKeyFields];
				
				for (int i = 0; i < numKeyFields; i++) {
					keyPos[i] = i;
					keySers[i] = createSerializer(keyHolder[i], i);
					tupleSers[i] = keySers[i];
				}
				// add the long serializer for the offset
				tupleSers[numKeyFields] = LongSerializer.INSTANCE;
				
				keySerializer = new TupleSerializer<Tuple>((Class<Tuple>) Tuple.getTupleClass(numKeyFields+1), tupleSers);
				keyComparator = new TupleComparator<Tuple>(keyPos, keyComps, keySers);
				
				keySerializerFactory = new RuntimeSerializerFactory<Tuple>(keySerializer, keySerializer.getTupleClass());

				keyTuple = keySerializer.createInstance();
			}
			
			// initialize the spilling
			final int totalNumSegments = memory.size();
			final int segmentsForKeys = (totalNumSegments >= 2*MAX_SEGMENTS_FOR_KEY_SPILLING) ? MAX_SEGMENTS_FOR_KEY_SPILLING : 
				Math.max(MIN_SEGMENTS_FOR_KEY_SPILLING, totalNumSegments - MAX_SEGMENTS_FOR_KEY_SPILLING);
				
			List<MemorySegment> recordsMemory = new ArrayList<MemorySegment>();
			List<MemorySegment> keysMemory = new ArrayList<MemorySegment>();
			
			for (int i = 0; i < segmentsForKeys; i++) {
				keysMemory.add(memory.get(i));
			}
			for (int i = segmentsForKeys; i < totalNumSegments; i++) {
				recordsMemory.add(memory.get(i));
			}
			
			recordsChannel = ioManager.createChannel();
			keysChannel = ioManager.createChannel();
			
			recordsOutFile = new FileChannelOutputView(
					ioManager.createBlockChannelWriter(recordsChannel), memManager,
					recordsMemory, memManager.getPageSize());
			
			keysOutFile = new FileChannelOutputView(
					ioManager.createBlockChannelWriter(keysChannel), memManager,
					keysMemory, memManager.getPageSize());
		}
		
		final long offset = recordsOutFile.getWriteOffset();
		if (offset < 0) {
			throw new RuntimeException("wrong offset");
		}
		
		Object[] keyHolder = new Object[numKeyFields];
		
		comparator.extractKeys(record, keyHolder, 0);
		for (int i = 0; i < numKeyFields; i++) {
			keyTuple.setField(keyHolder[i], i);
		}
		keyTuple.setField(offset, numKeyFields);
		
		keySerializer.serialize(keyTuple, keysOutFile);
		serializer.serialize(record, recordsOutFile);
		
		recordCounter++;
		
		return offset;
	}
880347
public void init(RecordOwner recordOwner)
    {
        m_dbEditMode = Constants.EDIT_NONE;
        m_listener = null;
        m_bDisplayOption = true;

        m_depScreens = null;        // List of all Dependent screens (doesn't include m_recordOwner)
        m_recordOwner = recordOwner;
        this.getTable();    // This will set up a table using the recordowner if it exists.

        if (recordOwner != null)
            recordOwner.addRecord(this, false);

        super.init(recordOwner);    // Set up the fields.
        this.selectFields();
        if ((this.getDatabaseType() & DBConstants.BASE_TABLE_CLASS) != 0)
        {
            if ((this.getDatabaseType() & DBConstants.SHARED_TABLE) != 0)  // But not shared (don't need multitable).
            {
                if ((this.getMasterSlave() & RecordOwner.MASTER) != 0)   // Slaves don't need this helper class.
                {
                    if ((this.getRecordOwner() == null)
                        || ((this.getRecordOwner().getMasterSlave() & RecordOwner.MASTER) != 0))
                            new org.jbundle.base.db.shared.SharedBaseRecordTable(null, this);    // Special - base class of a shared table
                }
            }
            else
                new org.jbundle.base.db.shared.MultiTable(null, this);     // Special - base class - Add the overriding classes.
        }
        if (this.getTable() != null)
            if (this.getTable().getDatabase() != null)
                if (this.getTable().getDatabase().getDatabaseOwner() != null)
                if (this.getTable().getDatabase().getDatabaseOwner().getEnvironment() != null)
                if ((DBConstants.YES.equalsIgnoreCase(((Environment)this.getTable().getDatabase().getDatabaseOwner().getEnvironment()).getProperty(DBParams.LOG_TRXS))) || (DBConstants.TRUE.equalsIgnoreCase(((Environment)this.getTable().getDatabase().getDatabaseOwner().getEnvironment()).getProperty(DBParams.LOG_TRXS))))
            if ((this.getMasterSlave() & RecordOwner.SLAVE) != 0)   // Slaves do the logging.
                if ((this.getDatabaseType() & DBConstants.DONT_LOG_TRX) == 0)
        {
            if ((this.getRecordOwner() == null)
                || ((this.getRecordOwner().getMasterSlave() & RecordOwner.SLAVE) != 0))
                    new org.jbundle.base.db.util.log.MessageLogTable(null, this);    // Special - base class of a shared table
        }
        m_iDefaultOrder = Constants.MAIN_KEY_AREA;      // Key Area to use on next operation
        this.addListeners();
    }
335933
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() != null)
            this.syncBehaviorToRecord(this.getOwner().getRecord().getField(m_iMainFilesFieldSeq));  // Init now
    }
725371
public void init(Record record, String strToCompare, String strSeekSign, Converter pconvFlag, boolean bDontFilterIfNullCompare, BaseField fldToCheck, BaseField fldToCompare)
    {
        m_fldFakeDate = null;
        super.init(record, null, strToCompare, null, pconvFlag, bDontFilterIfNullCompare, fldToCheck, fldToCompare);
        if (strSeekSign == null)
            m_strSeekSign = DBConstants.BLANK;    // I Must do this here because I don't want the default value
    }
650101
public void writeClass(String strClassName, CodeType codeType)
    {
        String strFieldClass;
        Record recClassInfo = this.getMainRecord();

        String strFieldDataHandle = this.getProperty(FieldData.FIELD_DATA_FILE);
        if (strFieldDataHandle != null)
        {
            FieldData recFieldData = (FieldData)this.getRecord(FieldData.FIELD_DATA_FILE);
            try {
                recFieldData.setHandle(strFieldDataHandle, DBConstants.OBJECT_ID_HANDLE);  // Get the record
                String strRecordClass = recFieldData.getField(FieldData.FIELD_FILE_NAME).toString();
                String strFieldName = recFieldData.getField(FieldData.FIELD_NAME).toString();
                String strBaseFieldName = recFieldData.getField(FieldData.BASE_FIELD_NAME).toString();
                m_BasedFieldHelper.getBasedField(recFieldData, strRecordClass, strFieldName, strBaseFieldName);  // Get the field this is based on
        
                String strClassInfoHandle = this.getProperty(ClassInfo.CLASS_INFO_FILE);
                if (strClassInfoHandle != null)
                    recClassInfo.setHandle(strClassInfoHandle, DBConstants.OBJECT_ID_HANDLE);  // Get the record
                else
                {   // Had to fake a class for this field
                    recClassInfo.addNew();
                    recClassInfo.getField(ClassInfo.CLASS_NAME).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_NAME).getFieldName()));
                    recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).setString(this.getProperty(recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getFieldName()));
                    recClassInfo.getField(ClassInfo.CLASS_PACKAGE).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_PACKAGE).getFieldName()));
                    recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).getFieldName()));
                }
            } catch (DBException ex)    {
                ex.printStackTrace();
            }
        }
        strFieldClass = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();

        this.writeHeading(strFieldClass, this.getPackage(codeType), CodeType.THICK);   // Write the first few lines of the files
        this.writeIncludes(CodeType.THICK);

        if (m_MethodNameList.size() != 0)
            m_MethodNameList.removeAllElements();
    
        this.writeClassInterface();
    
        this.writeClassFields(CodeType.THICK);        // Write the C++ fields for this class
        this.writeDefaultConstructor(strFieldClass);
        this.writeFieldInit();
        this.writeInit();               // Special case... zero all class fields!
    
        this.writeInitField();
    
        this.writeClassMethods(CodeType.THICK);   // Write the remaining methods for this class
        this.writeEndCode(true);
    }
865129
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() == null)
            return;
        if (m_recordSub != null)    // If field is not in this file, remember to remove it
            m_recordSub.addListener(new FileRemoveBOnCloseHandler(this));
    }