Package com.luxoft.dnepr.courses.regular.unit3

Examples of com.luxoft.dnepr.courses.regular.unit3.User


      // Get the UserService.
      UserServiceInterface userService = user.getService(DfpService.V201308.USER_SERVICE);

      // Get the current user.
      User usr = userService.getCurrentUser();

      System.out.println("User with ID \"" + usr.getId()
          + "\", email \"" + usr.getEmail()
          + "\", and role \"" + usr.getRoleName() + "\" is the current user.");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here


      // Create an array to store local user objects.
      User[] users = new User[emailAndNames.size()];

      for (int i = 0; i < users.length; i++) {
        // Create the new user structure.
        User newUser = new User();
        newUser.setEmail(emailAndNames.get(i)[0]);
        newUser.setName(emailAndNames.get(i)[1]);
        newUser.setRoleId(roleId);
        newUser.setPreferredLocale("en_US");

        users[i] = newUser;
      }

      // Create the users.
      users = userService.createUsers(users);

      if (users != null) {
        for (User newUser : users) {
          System.out.println("A user with ID \"" + newUser.getId()
              + "\", email \"" + newUser.getEmail()
              + "\", and role \"" + newUser.getRoleName() + "\" was created.");
        }
      } else {
        System.out.println("No users created.");
      }
    } catch (Exception e) {
View Full Code Here

      // Set the ID of the user to get.
      Long userId = Long.parseLong("INSERT_USER_ID_HERE");

      // Get the user.
      User usr = userService.getUser(userId);

      if (usr != null) {
        System.out.println("User with ID \"" + usr.getId()
            + "\" email \"" + usr.getEmail()
            + "\", and role \"" + usr.getRoleName() + "\" was found.");
      } else {
        System.out.println("No user found for this ID.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

      // Get the UserService.
      UserServiceInterface userService = user.getService(DfpService.V201311.USER_SERVICE);

      // Get the current user.
      User usr = userService.getCurrentUser();

      System.out.println("User with ID \"" + usr.getId()
          + "\", email \"" + usr.getEmail()
          + "\", and role \"" + usr.getRoleName() + "\" is the current user.");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

     * @throws IllegalJavaVersionError if current JVM version not equal to excepted
     */
    public Bank(String expectedJavaVersion) {
        String actualJavaVersion = System.getProperty(JAVA_VERSION_KEY);
        if (!actualJavaVersion.equals(expectedJavaVersion)) {
            throw new IllegalJavaVersionError(actualJavaVersion, expectedJavaVersion,
                    String.format(ILLEGAL_JAVA_VERSION_MESSAGE, actualJavaVersion, expectedJavaVersion)
            );
        }
    }
View Full Code Here

    public Bank(String expectedJavaVersion) {

        String actualJavaVersion = System.getProperty("java.version");
        if (!actualJavaVersion.equals(expectedJavaVersion)) {
            throw new IllegalJavaVersionError(actualJavaVersion, expectedJavaVersion,
                    "Java version is incorrect (" + actualJavaVersion + " != " + expectedJavaVersion + ").");
        }
    }
View Full Code Here

    public void checkWithdrawal(BigDecimal amountToWithdraw) throws WalletIsBlockedException, InsufficientWalletAmountException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, WALLET_IS_BLOCKED_MESSAGE);
        }
        if (amountToWithdraw.compareTo(amount) > 0) {
            throw new InsufficientWalletAmountException(id, amountToWithdraw, amount,
                    INSUFFICIENT_WALLET_AMOUNT_MESSAGE
            );
        }
    }
View Full Code Here

    public void checkWithdrawal(BigDecimal amountToWithdraw) throws WalletIsBlockedException, InsufficientWalletAmountException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, "Wallet " + id + " is blocked.");
        }
        if (amount.compareTo(amountToWithdraw) < 0) {
            throw new InsufficientWalletAmountException(id, amountToWithdraw, amount, "Insufficient funds (" +
                    MoneyFormatter.format(amount) + " < " + MoneyFormatter.format(amountToWithdraw) + ")");
        }
    }
View Full Code Here

    public void checkTransfer(BigDecimal amountToTransfer) throws WalletIsBlockedException, LimitExceededException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, WALLET_IS_BLOCKED_MESSAGE);
        }
        if (amount.add(amountToTransfer).compareTo(maxAmount) > 1) {
            throw new LimitExceededException(id, amountToTransfer, amount, LIMIT_EXCEEDED_MESSAGE);
        }
    }
View Full Code Here

    public void checkTransfer(BigDecimal amountToTransfer) throws WalletIsBlockedException, LimitExceededException {
        if (status == WalletStatus.BLOCKED) {
            throw new WalletIsBlockedException(id, "Wallet " + id + " is blocked.");
        }
        if (maxAmount.compareTo(amount.add(amountToTransfer)) < 0) {
            throw new LimitExceededException(id, amountToTransfer, amount, "Limit exceeded (" +
                    MoneyFormatter.format(amount) + " + " + MoneyFormatter.format(amountToTransfer) +
                    " > " + MoneyFormatter.format(maxAmount) + ")");
        }
    }
View Full Code Here

TOP

Related Classes of com.luxoft.dnepr.courses.regular.unit3.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.