Search in sources :

Example 1 with XMLStorage

use of com.github.drbookings.ser.XMLStorage in project drbookings by DrBookings.

the class CleaningCostsAdder method main.

public static void main(final String[] args) throws Exception {
    final File file = new File("/home/alex/bookings.xml");
    final float cleaningCosts = 30;
    final DataStore ds = new XMLStorage().load(file);
    for (final CleaningBeanSer bs : ds.getCleaningsSer()) {
        if (bs.name.equalsIgnoreCase("Natalia")) {
            bs.cleaningCosts = cleaningCosts;
        }
    }
    new XMLStorage().save(ds, file);
}
Also used : XMLStorage(com.github.drbookings.ser.XMLStorage) CleaningBeanSer(com.github.drbookings.model.ser.CleaningBeanSer) DataStore(com.github.drbookings.ser.DataStore) File(java.io.File)

Example 2 with XMLStorage

use of com.github.drbookings.ser.XMLStorage in project drbookings by DrBookings.

the class CleaningFeesAdder method main.

public static void main(final String[] args) throws Exception {
    final File file = new File("/home/alex/bookings.xml");
    final float cleaningFees = 60;
    final DataStore ds = new XMLStorage().load(file);
    for (final BookingBeanSer bs : ds.getBookingsSer()) {
        if (bs.cleaningFees == 0) {
            bs.cleaningFees = cleaningFees;
        }
    }
    new XMLStorage().save(ds, file);
}
Also used : XMLStorage(com.github.drbookings.ser.XMLStorage) DataStore(com.github.drbookings.ser.DataStore) File(java.io.File) BookingBeanSer(com.github.drbookings.model.ser.BookingBeanSer)

Example 3 with XMLStorage

use of com.github.drbookings.ser.XMLStorage in project drbookings by DrBookings.

the class ServicePercentAdder method main.

public static void main(final String[] args) throws Exception {
    final File file = new File("/home/alex/bookings.xml");
    final DataStore ds = new XMLStorage().load(file);
    for (final BookingBeanSer bs : ds.getBookingsSer()) {
        if (bs.source.equalsIgnoreCase("booking")) {
            bs.serviceFeePercent = 0.12f;
        }
    }
    new XMLStorage().save(ds, file);
}
Also used : XMLStorage(com.github.drbookings.ser.XMLStorage) DataStore(com.github.drbookings.ser.DataStore) File(java.io.File) BookingBeanSer(com.github.drbookings.model.ser.BookingBeanSer)

Example 4 with XMLStorage

use of com.github.drbookings.ser.XMLStorage in project drbookings by DrBookings.

the class Anonymiser method main.

public static void main(final String[] args) throws Exception {
    final File file = new File("/home/alex/bookings-anonym.xml");
    new BackupCreator().makeBackup(file);
    final DataStore ds = new XMLStorage().load(file);
    for (final Iterator<BookingBeanSer> it = ds.getBookingsSer().iterator(); it.hasNext(); ) {
        final BookingBeanSer bs = it.next();
        bs.guestName = new RandomString().ofLength(bs.guestName.length()).toString();
    }
    for (final Iterator<CleaningBeanSer> it = ds.getCleaningsSer().iterator(); it.hasNext(); ) {
        final CleaningBeanSer bs = it.next();
        bs.name = new RandomString().ofLength(bs.name.length()).toString();
    }
    new XMLStorage().save(ds, file);
}
Also used : XMLStorage(com.github.drbookings.ser.XMLStorage) CleaningBeanSer(com.github.drbookings.model.ser.CleaningBeanSer) BackupCreator(com.github.ktools1000.io.BackupCreator) DataStore(com.github.drbookings.ser.DataStore) RandomString(com.github.ktools1000.RandomString) File(java.io.File) BookingBeanSer(com.github.drbookings.model.ser.BookingBeanSer)

Aggregations

DataStore (com.github.drbookings.ser.DataStore)4 XMLStorage (com.github.drbookings.ser.XMLStorage)4 File (java.io.File)4 BookingBeanSer (com.github.drbookings.model.ser.BookingBeanSer)3 CleaningBeanSer (com.github.drbookings.model.ser.CleaningBeanSer)2 RandomString (com.github.ktools1000.RandomString)1 BackupCreator (com.github.ktools1000.io.BackupCreator)1