本文整理汇总了Java中ch.rgw.tools.TimeTool.get方法的典型用法代码示例。如果您正苦于以下问题:Java TimeTool.get方法的具体用法?Java TimeTool.get怎么用?Java TimeTool.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.rgw.tools.TimeTool
的用法示例。
在下文中一共展示了TimeTool.get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TerminDialog
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
/**
* Use this constructor for creating a new {@link Termin} from a date and for a resource.
*
* @param date
* @param resource
* @param patient
*/
public TerminDialog(@NonNull TimeTool date, @NonNull String resource, Patient patient){
super(UiDesk.getTopShell());
Free act = new Termin.Free(date.toString(TimeTool.DATE_COMPACT),
date.get(TimeTool.HOUR_OF_DAY) * 60 + date.get(TimeTool.MINUTE), 30);
actKontakt = patient;
Color green = UiDesk.getColor(UiDesk.COL_GREEN);
if (green == null) {
UiDesk.getColorRegistry().put(UiDesk.COL_GREEN, new RGB(0, 255, 0));
}
actPlannable = act;
agenda.setActResource(resource);
tMap = Plannables.getTimePrefFor(agenda.getActResource());
tMap.put(Termin.typFrei(), "0"); //$NON-NLS-1$
tMap.put(Termin.typReserviert(), "0"); //$NON-NLS-1$
}
示例2: Person
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
/**
* This constructor is more critical than the previous one
*
* @param name
* will be checked for non-alphabetic characters and may not be empty
* @param vorname
* will be checked for non alphabetic characters but may be empty
* @param gebDat
* will be checked for unplausible values but may be null
* @param s
* will be checked for undefined values and may not be empty
* @throws PersonDataException
*/
public Person(String name, String vorname, TimeTool gebDat, String s)
throws PersonDataException{
name = name.trim();
vorname = vorname.trim();
if ((StringTool.isNothing(name)) || (!name.matches("[" + StringTool.wordChars + "\\s-]+"))) { //$NON-NLS-1$ //$NON-NLS-2$
throw new PersonDataException(PersonDataException.CAUSE.LASTNAME);
}
if ((!StringTool.isNothing(vorname))
&& (!vorname.matches("[" + StringTool.wordChars + "\\s-]+"))) { //$NON-NLS-1$ //$NON-NLS-2$
throw new PersonDataException(PersonDataException.CAUSE.FIRSTNAME);
}
String dat = StringTool.leer;
if (gebDat != null) {
TimeTool now = new TimeTool();
int myYear = now.get(TimeTool.YEAR);
int oYear = gebDat.get(TimeTool.YEAR);
if (oYear > myYear || oYear < myYear - 120) {
throw new PersonDataException(PersonDataException.CAUSE.BIRTHDATE);
}
dat = gebDat.toString(TimeTool.DATE_COMPACT);
}
if (!s.equalsIgnoreCase(Person.MALE) && !s.equalsIgnoreCase(Person.FEMALE)) {
throw new PersonDataException(PersonDataException.CAUSE.SEX);
}
create(null);
String[] fields = new String[] {
NAME, FIRSTNAME, BIRTHDATE, SEX
};
String[] vals = new String[] {
name, vorname, dat, s
};
set(fields, vals);
}
示例3: getVersionFromValid
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
public int getVersionFromValid(TimeTool validFrom){
int year = validFrom.get(TimeTool.YEAR);
int month = validFrom.get(TimeTool.MONTH) + 1;
int day = validFrom.get(TimeTool.DAY_OF_MONTH);
return day + (month * 100) + ((year - 2000) * 10000);
}
示例4: updateBoundaries
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
public static void updateBoundaries(String resource, TimeTool date){
String day = date.toString(TimeTool.DATE_COMPACT);
Query<Termin> qbe = new Query<Termin>(Termin.class);
qbe.add(Termin.FLD_TAG, Query.EQUALS, day);
qbe.add(Termin.FLD_BEREICH, Query.EQUALS, resource);
List<Termin> resList = qbe.execute();
// check whether the only entries are appointments if yes also check
// whether some "Tagesgrenzen" are missing
for (Termin termin : resList) {
if (termin.getType().equals(Termin.typReserviert())) {
return;
}
}
Hashtable<String, String> map = Plannables.getDayPrefFor(resource);
int d = date.get(Calendar.DAY_OF_WEEK);
String ds = map.get(TimeTool.wdays[d - 1]);
if (StringTool.isNothing(ds)) {
// default für Tagesgrenzen falls nicht definiert
ds = "0000-0800\n1800-2359"; //$NON-NLS-1$
}
String[] flds = ds.split("\r*\n\r*"); //$NON-NLS-1$
for (String fld : flds) {
String from = fld.substring(0, 4);
String until = fld.replaceAll("-", "").substring(4); //$NON-NLS-1$ //$NON-NLS-2$
// Lege Termine für die Tagesgrenzen an
new Termin(resource, day, TimeTool.getMinutesFromTimeString(from),
TimeTool.getMinutesFromTimeString(until), Termin.typReserviert(),
Termin.statusLeer());
}
}
示例5: set
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
public void set(final String bereich, final TimeTool wann, final int dauer, final String typ,
final String status, final Patient pat, final String Grund){
String Tag = wann.toString(TimeTool.DATE_COMPACT);
int Beginn = wann.get(TimeTool.HOUR_OF_DAY) * 60 + wann.get(TimeTool.MINUTE);
set(new String[] {
FLD_BEREICH, FLD_TAG, FLD_BEGINN, FLD_DAUER, FLD_TERMINTYP, FLD_PATIENT, FLD_GRUND,
FLD_LASTEDIT
}, bereich, Tag, Integer.toString(Beginn), Integer.toString(dauer), typ, status,
pat.getId(), Grund, createTimeStamp());
setStatus(status);
}
示例6: setStartTime
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
public void setStartTime(final TimeTool t){
if (checkLock()) {
return;
}
String Tag = t.toString(TimeTool.DATE_COMPACT);
int Beginn = (t.get(TimeTool.HOUR_OF_DAY) * 60) + t.get(TimeTool.MINUTE);
if (Beginn > 0) {
set(new String[] {
FLD_TAG, FLD_BEGINN, FLD_LASTEDIT
}, Tag, Integer.toString(Beginn), createTimeStamp());
}
}
示例7: TimeInMinutes
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
static int TimeInMinutes(final TimeTool t){
return (t.get(TimeTool.HOUR_OF_DAY) * 60) + t.get(TimeTool.MINUTE);
}
示例8: getRootTerminStartTime
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
private TimeTool getRootTerminStartTime(Calendar cal){
TimeTool tt = new TimeTool(cal.getTime());
switch (seriesType) {
case DAILY:
return tt;
case WEEKLY:
Calendar cal2 = Calendar.getInstance();
cal2.setTime(cal.getTime());
int firstDay = Integer.parseInt(getSeriesPatternString().split(",")[1].charAt(0) + "");
cal2.set(Calendar.DAY_OF_WEEK, firstDay);
TimeTool ret = new TimeTool(cal2.getTime());
return ret;
case MONTHLY:
int monthDay = Integer.parseInt(seriesPatternString);
Calendar calendarMonth = Calendar.getInstance();
calendarMonth.clear();
calendarMonth.set(Calendar.YEAR, tt.get(TimeTool.YEAR));
if (tt.get(Calendar.DAY_OF_MONTH) <= monthDay) {
calendarMonth.set(Calendar.MONTH, tt.get(Calendar.MONTH));
} else {
calendarMonth.set(Calendar.MONTH, tt.get(Calendar.MONTH));
calendarMonth.add(Calendar.MONTH, 1);
}
calendarMonth.set(Calendar.DAY_OF_MONTH, monthDay);
return new TimeTool(calendarMonth.getTime());
case YEARLY:
Calendar targetCal = Calendar.getInstance();
targetCal.clear();
targetCal.set(Calendar.YEAR, tt.get(TimeTool.YEAR));
int day = Integer.parseInt(seriesPatternString.substring(0, 2));
int month = Integer.parseInt(seriesPatternString.substring(2, 4));
targetCal.set(Calendar.DAY_OF_MONTH, day);
targetCal.set(Calendar.MONTH, month - 1);
TimeTool target = new TimeTool(targetCal.getTime());
if (tt.isBefore(target))
return target;
target.add(TimeTool.YEAR, 1);
return target;
}
return tt;
}
示例9: loadTermine
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
/**
* Alle Termine eines Tages sortiert einlesen. Freiräume belassen.
*
* @param mandant
* @param date
* @return
*/
@SuppressWarnings("unchecked")
public static List<IPlannable> loadTermine(String bereich, TimeTool date){
if (StringTool.isNothing(bereich)) {
return new ArrayList<IPlannable>();
}
Query<Termin> qbe = new Query<Termin>(Termin.class);
String day = date.toString(TimeTool.DATE_COMPACT);
qbe.add("Tag", "=", day);
qbe.and();
qbe.add("BeiWem", "=", bereich);
if (CoreHub.userCfg.get(PreferenceConstants.AG_SHOWDELETED, "0").equals("0")) {
qbe.and();
qbe.add("deleted", "=", "0");
}
List list = qbe.execute();
if (list == null) {
log.error(Messages.Plannables_databaseError);
return new ArrayList<IPlannable>();
}
if (list.isEmpty()) {
Hashtable<String, String> map = getDayPrefFor(bereich);
int d = date.get(Calendar.DAY_OF_WEEK);
String ds = map.get(TimeTool.wdays[d - 1]);
if (StringTool.isNothing(ds)) {
ds = "0000-0800\n1800-2359"; //$NON-NLS-1$
}
String[] flds = ds.split("\r*\n\r*"); //$NON-NLS-1$
for (String fld : flds) {
String from = fld.substring(0, 4);
String until = fld.replaceAll("-", "").substring(4); //$NON-NLS-1$ //$NON-NLS-2$
list.add(new Termin(bereich, date.toString(TimeTool.DATE_COMPACT), TimeTool
.getMinutesFromTimeString(from), TimeTool.getMinutesFromTimeString(until),
Termin.typReserviert(), Termin.statusLeer()));
}
}
Collections.sort(list);
return list;
}
示例10: checkAppointmentCollision
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
/**
* check whether any appointments collide with the lock time changes
*
* @param appointments
* @param monitor
* @return list of days to skip when deleting the old boundaries
*/
private List<String> checkAppointmentCollision(List<Termin> appointments,
IProgressMonitor monitor){
List<String> skipUpdate = new ArrayList<String>();
String[] closedTimes = _newValues.split(StringConstants.LF);
TimeTool day = new TimeTool();
for (Termin t : appointments) {
if (t.getId().equals(StringConstants.ONE))
continue;
if (t.getDay() == null || t.getDay().length() < 3)
continue;
day.set(t.getDay());
if (_startDate.isBeforeOrEqual(day)) {
if (day.get(Calendar.DAY_OF_WEEK) == _applyForDay.numericDayValue) {
// ignore locktimes
if (!t.getType().equals(Termin.typReserviert())) {
for (String s : closedTimes) {
int von = TimeTool.minutesStringToInt(s.split("-")[0]); //$NON-NLS-1$
int bis = TimeTool.minutesStringToInt(s.split("-")[1]); //$NON-NLS-1$
//check for collision
if (t.crossesTimeFrame(von, bis - von)) {
boolean keepOldLocktimes =
MessageDialog.openQuestion(PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell(),
Messages.TermineLockedTimesUpdater_4,
Messages.TermineLockedTimesUpdater_5 + t.getLabel()
+ Messages.TermineLockedTimesUpdater_6 + s + ". "
+ Messages.TermineLockedTimesUpdater_7);
//update anyway -> add appointment to delete list
if (keepOldLocktimes)
skipUpdate.add(t.getDay());
}
}
}
}
}
monitor.worked(1);
}
return skipUpdate;
}