I went and tried to learn how to use Enum So I apologize for the lack of logical construction but I had
to start somewhere I have code that I am not sure how to use it because I don't know
how to call it so all the logic went down the tubes.
Can someone look at this and tell me if it is even possible?
If you have any clue what I am tring to do any feed back would be most usefull to say the least.
Thanks for your time.
I am tring to send the AvailablilityRecordEnum each of the processDates elements with its unique data to be
kept with it all the way to the insert.
private boolean prepareRecord(DateTime[] processDates) throws ... {
//set everything in one location
DateTime startTimeField =
LocationAvailableFormController.locationAvailableDataModel.locationAvailableBean.startTimeValue;
DateTime endTimeField =
LocationAvailableFormController.locationAvailableDataModel.locationAvailableBean.endTimeValue;
LocationAvailableFormController.setStartTimeField(startTimeField);
LocationAvailableFormController.setEndTimeField(endTimeField);
LocationAvailableFormController.setLocationDesc(thisLocation);
LocationAvailableFormController.setTableName(tableName);
//some how call the enum so it can throw my firs error...
for (int i = 0; i < processDates.length; i++) {
DateTime element = processDates[i];
AvailabilityRecordEnum.LocationAvailableEnum();
}
return bDone;
}
I just copied a structure that seemed logical and that I am done it makes no sense :
public enum AvailabilityRecordEnum {
LocationAvailableEnum(LocationAvailableFormController.getAvailableDate(),
LocationAvailableFormController.getStartTimeField(),
LocationAvailableFormController.getEndTimeField(),
LocationAvailableFormController.getEndDate(),
LocationAvailableFormController.getLocationDesc(),
LocationAvailableFormController.tableName);
public DateTime dt; // each record
public static DateTime startDate;
public DateTime startHour;
public DateTime endHour;
public DateTime endDate;
public String locationDesc;
public int timeSlots;
public String tableName;
// Constructor
AvailabilityRecordEnum(DateTime startDate,
DateTime startHourField,
DateTime endHourField,
DateTime endDateConstant,
String thisLocation,
String thisTableName) {
dt = startDate;
startHour = startHourField;
endHour = endHourField;
endDate=endDateConstant;
locationDesc=thisLocation;
tableName=thisTableName;
startHourToEndHourtimeSlots();
/*
* deriveEndHourFromStartHour();
deriveNewStartHour();
*/
}
private void startHourToEndHourtimeSlots() {
int diff = JodaTimeUtil.differenceInHours(startHour, endHour);
timeSlots = diff;
setTimeSlots(timeSlots);
}
private void deriveNewStartHour() {
}
private void deriveEndHourFromStartHour() {
}
//_____________setters
public DateTime getDt() {
return dt;
}
public void setDt(DateTime dt) {
this.dt = dt;
}
.......
..........
a class to make a record and insert it: the insert is not even close because I do not even know how to call an Enumeration
public class LocationAvailabilityRecordData {
public AvailabilityRecordEnum availabilityRecordEnun;
/*
* <entry key="insertLocationAvailable">INSERT INTO location_Available(
loc_desc,
available_start_date,
available_end_date,
available_start_time,
available_end_time)
VALUES (?, ?, ?, ?, ?)
</entry>
*/
public String locationDesc;
public String availableStartDate;
public String availableEndDate;
public String availableStartTime;
public String availableEndTime;
public String tableName;
public LocationAvailabilityRecordData() throws SQLException, ...{
////////////////////////// submit this //////////////////////////////////////
locationDesc = availabilityRecordEnun.LocationAvailableEnum.locationDesc;
availableStartDate = JodaTimeUtil.dateToString(availabilityRecordEnun.LocationAvailableEnum.getStartDate());
availableEndDate = JodaTimeUtil.dateToString(availabilityRecordEnun.LocationAvailableEnum.getEndDate());
availableStartTime = JodaTimeUtil.timeToString(availabilityRecordEnun.LocationAvailableEnum.getStartHour());
DateTime inputEndDate = availabilityRecordEnun.LocationAvailableEnum.getEndDate();
DateTime inclusiveEndTime = inputEndDate.plusHours(1);
availableEndTime = JodaTimeUtil.timeToString(inclusiveEndTime);//end time is a product of time slots
tableName = availabilityRecordEnun.LocationAvailableEnum.tableName;
//_________on submit
ConnectLocationAvailableDAO clad = new ConnectLocationAvailableDAO();
ArrayList<String> columns = clad.countColumns(tableName);
int columnCount = columns.size();
String[] fillColumns = new String[columnCount];
fillColumns[0] = locationDesc;
fillColumns[1] = availableStartDate;
fillColumns[2] = availableEndDate;
fillColumns[3] = availableStartTime;
fillColumns[4] = availableEndTime;
//____________on submit
AvailabilityFormActions rfa = new AvailabilityFormActions();
rfa.locationAvailableRegisterAction(fillColumns);
}
public AvailabilityRecordEnum getAvailabilityRecordEnun() {
return availabilityRecordEnun;
}
public void setAvailabilityRecordEnun(AvailabilityRecordEnum availabilityRecordEnun) {
this.availabilityRecordEnun = availabilityRecordEnun;
}
public String getAvailableEndDate() {
return availableEndDate;
}
public void setAvailableEndDate(String availableEndDate) {
this.availableEndDate = availableEndDate;
}
more setters ....
....................