private static void createOverdueLoanForCopy(Library library, Copy copy, int position)
     throws IllegalLoanOperationException {
   Loan l = library.createAndAddLoan(getCustomer(library, position), copy);
   GregorianCalendar pickup = l.getPickupDate();
   pickup.add(GregorianCalendar.MONTH, -1);
   pickup.add(GregorianCalendar.DAY_OF_MONTH, -position % 15);
   l.setPickupDate(pickup);
 }
 private static void createLoansForCopy(Library library, Copy copy, int position, int count)
     throws IllegalLoanOperationException {
   // Create Loans in the past
   for (int i = count; i > 1; i--) {
     Loan l = library.createAndAddLoan(getCustomer(library, position + i), copy);
     GregorianCalendar pickup = l.getPickupDate();
     pickup.add(GregorianCalendar.MONTH, -i);
     pickup.add(GregorianCalendar.DAY_OF_MONTH, position % 10);
     l.setPickupDate(pickup);
     GregorianCalendar ret = (GregorianCalendar) pickup.clone();
     ret.add(GregorianCalendar.DAY_OF_YEAR, position % 10 + i * 2);
     l.returnCopy(ret);
   }
   // Create actual open loans
   if (position % 2 == 0) {
     Loan l = library.createAndAddLoan(getCustomer(library, position), copy);
     GregorianCalendar pickup = l.getPickupDate();
     pickup.add(GregorianCalendar.DAY_OF_MONTH, -position % 10);
     l.setPickupDate(pickup);
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View root = inflater.inflate(R.layout.ausleihen_fragment_details, container, false);
    TextView priceContent = (TextView) root.findViewById(R.id.priceLarge);
    ;
    TextView manufacturerContent = (TextView) root.findViewById(R.id.manufacturerText);
    TextView stateContent = (TextView) root.findViewById(R.id.stateText);
    final TextView availabilityContent = (TextView) root.findViewById(R.id.availabilityText);

    Bundle args = getArguments();
    final Loan thisLoan = (Loan) args.getSerializable("ausleihen");
    priceContent.setText(thisLoan.getGadget().getPrice() + ".-");
    IToolbarSetter toolbar = (IToolbarSetter) getActivity();
    toolbar.setTitle(thisLoan.getGadget().getName());
    manufacturerContent.setText(thisLoan.getGadget().getManufacturer());
    stateContent.setText(thisLoan.getGadget().getCondition().name());
    DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
    availabilityContent.setText(
        dateFormat.format(thisLoan.getPickupDate().getTime() + 7 * 24 * 60 * 60 * 1000));

    return root;
  }