Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.jbundle.main.calendar.db.CalendarEntry Maven / Gradle / Ivy
package org.jbundle.main.calendar.db;
import java.util.*;
import org.jbundle.base.db.*;
import org.jbundle.thin.base.util.*;
import org.jbundle.thin.base.db.*;
import org.jbundle.base.db.event.*;
import org.jbundle.base.db.filter.*;
import org.jbundle.base.field.*;
import org.jbundle.base.field.convert.*;
import org.jbundle.base.field.event.*;
import org.jbundle.base.model.*;
import org.jbundle.base.util.*;
import org.jbundle.model.*;
import org.jbundle.model.db.*;
import org.jbundle.model.screen.*;
import javax.swing.*;
import org.jbundle.thin.base.screen.*;
import org.jbundle.thin.base.message.*;
import org.jbundle.model.message.*;
import org.jbundle.model.main.calendar.db.*;
public class CalendarEntry extends VirtualRecord
implements CalendarEntryModel
{
private static final long serialVersionUID = 1L ;
public static final String JOB_PROCESS_NAME = "org.jbundle.main.schedule.app.JobSchedulerProcess" ;
public CalendarEntry ()
{
super ();
}
public CalendarEntry (RecordOwner screen)
{
this ();
this .init(screen);
}
public void init (RecordOwner screen)
{
super .init(screen);
}
public String getTableNames (boolean bAddQuotes)
{
return (m_tableName == null ) ? Record.formatTableNames(CALENDAR_ENTRY_FILE, bAddQuotes) : super .getTableNames(bAddQuotes);
}
public String getRecordName ()
{
return "Entry" ;
}
public String getDatabaseName ()
{
return "main" ;
}
public int getDatabaseType ()
{
return DBConstants.REMOTE | DBConstants.BASE_TABLE_CLASS | DBConstants.SHARED_TABLE | DBConstants.USER_DATA;
}
public BaseField setupField (int iFieldSeq)
{
BaseField field = null ;
if (iFieldSeq == 3 )
{
field = new CalendarEntryTypeField(this , CALENDAR_ENTRY_TYPE_ID, Constants.DEFAULT_FIELD_LENGTH, null , null );
field.setHidden(true );
}
if (iFieldSeq == 4 )
field = new DateTimeField(this , START_DATE_TIME, Constants.DEFAULT_FIELD_LENGTH, null , null );
if (iFieldSeq == 5 )
field = new DateTimeField(this , END_DATE_TIME, Constants.DEFAULT_FIELD_LENGTH, null , null );
if (iFieldSeq == 6 )
field = new StringField(this , DESCRIPTION, 60 , null , null );
if (iFieldSeq == 7 )
{
field = new CalendarCategoryField(this , CALENDAR_CATEGORY_ID, Constants.DEFAULT_FIELD_LENGTH, null , null );
field.addListener(new InitOnceFieldHandler(null ));
}
if (iFieldSeq == 8 )
field = new BooleanField(this , HIDDEN, Constants.DEFAULT_FIELD_LENGTH, null , new Boolean(false ));
if (iFieldSeq == 9 )
field = new PropertiesField(this , PROPERTIES, Constants.DEFAULT_FIELD_LENGTH, null , null );
if (iFieldSeq == 10 )
field = new AnnivMasterField(this , ANNIV_MASTER_ID, Constants.DEFAULT_FIELD_LENGTH, null , null );
if (field == null )
field = super .setupField(iFieldSeq);
return field;
}
public KeyArea setupKey (int iKeyArea)
{
KeyArea keyArea = null ;
if (iKeyArea == 0 )
{
keyArea = this .makeIndex(DBConstants.UNIQUE, ID_KEY);
keyArea.addKeyField(ID, DBConstants.ASCENDING);
}
if (iKeyArea == 1 )
{
keyArea = this .makeIndex(DBConstants.NOT_UNIQUE, START_DATE_TIME_KEY);
keyArea.addKeyField(START_DATE_TIME, DBConstants.ASCENDING);
}
if (iKeyArea == 2 )
{
keyArea = this .makeIndex(DBConstants.NOT_UNIQUE, ANNIV_MASTER_ID_KEY);
keyArea.addKeyField(ANNIV_MASTER_ID, DBConstants.ASCENDING);
keyArea.addKeyField(START_DATE_TIME, DBConstants.ASCENDING);
}
if (iKeyArea == 3 )
{
keyArea = this .makeIndex(DBConstants.NOT_UNIQUE, CALENDAR_CATEGORY_ID_KEY);
keyArea.addKeyField(CALENDAR_CATEGORY_ID, DBConstants.ASCENDING);
keyArea.addKeyField(START_DATE_TIME, DBConstants.ASCENDING);
}
if (keyArea == null )
keyArea = super .setupKey(iKeyArea);
return keyArea;
}
public void addMasterListeners ()
{
super .addMasterListeners();
this .addListener(new FileListener(null )
{
public int doRecordChange (FieldInfo field, int iChangeType, boolean bDisplayOption)
{
int iErrorCode = super .doRecordChange(field, iChangeType, bDisplayOption);
if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
if (getSharedRecordTypeKey().getValue() == CalendarEntry.APPOINTMENT_ID)
if (!getField(CalendarEntry.PROPERTIES).isNull())
{
MessageManager messageManager = ((Application)getTask().getApplication()).getMessageManager();
Map properties = new Hashtable();
properties.put(DBParams.PROCESS, JOB_PROCESS_NAME);
if (messageManager != null )
messageManager.sendMessage(new MapMessage(new BaseMessageHeader(JOB_QUEUE_NAME, MessageConstants.INTRANET_QUEUE, this , null ), properties));
}
return iErrorCode;
}
});
}
public Map getProperties ()
{
Map properties = ((PropertiesField)this .getField(CalendarEntry.PROPERTIES)).getProperties();
if (!this .getField(Anniversary.ANNIV_MASTER_ID).isNull())
if (this .getField(Anniversary.ANNIV_MASTER_ID) instanceof ReferenceField)
{
Record recAnnivMaster = ((ReferenceField)this .getField(Anniversary.ANNIV_MASTER_ID)).getReference();
if ((recAnnivMaster != null ) && ((recAnnivMaster.getEditMode() == DBConstants.EDIT_CURRENT) || (recAnnivMaster.getEditMode() == DBConstants.EDIT_IN_PROGRESS)))
{
Map propMaster = ((PropertiesField)recAnnivMaster.getField(AnnivMaster.PROPERTIES)).getProperties();
if (propMaster != null )
{
if (properties != null )
propMaster.putAll(properties);
properties = propMaster;
}
}
}
return properties;
}
public Object getStartIcon ()
{
Object iconStart = null ;
Record recCalendarCategory = ((ReferenceField)this .getField(CalendarEntry.CALENDAR_CATEGORY_ID)).getReference();
if ((recCalendarCategory == null ) || (recCalendarCategory.getEditMode() != DBConstants.EDIT_CURRENT))
if (this .getField(Anniversary.ANNIV_MASTER_ID) instanceof ReferenceField)
{
}
if ((recCalendarCategory != null ) && (recCalendarCategory.getEditMode() == DBConstants.EDIT_CURRENT))
iconStart = ((ImageField)recCalendarCategory.getField(CalendarCategory.ICON)).getImage().getImage();
if (iconStart == null )
{
if (this .getTask() instanceof BaseApplet)
iconStart = ((BaseApplet)this .getTask()).loadImageIcon("Calendar" );
}
return iconStart;
}
public BaseField getSharedRecordTypeKey ()
{
return this .getField(CalendarEntry.CALENDAR_ENTRY_TYPE_ID);
}
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 ;
}
}