Package edu.wpi.cs.wpisuitetng.exceptions

Examples of edu.wpi.cs.wpisuitetng.exceptions.WPISuiteException


        }
      }
      final Method theSetter = methodToBeSaved;
      if(theSetter == null){
        logger.log(Level.WARNING, "Setter method was null during retrieve attempt");
        throw new WPISuiteException("Null setter method.");
      }

      try {
        theObject = (Object) theSetter.invoke(objectsToUpdate.get(i), changeValue);
        save(theObject);
View Full Code Here


      }
    }
    final Method theGetter = methodToBeSaved;
    if(theGetter == null){
      logger.log(Level.WARNING, "Getter method was null during retrieve attempt");
      throw new WPISuiteException("Null getter method.");
    }

    List<Model> result = theDB.query(new Predicate<Model>(){
      public boolean match(Model anObject){
        try {
View Full Code Here

    final int aFieldNameListSize = aFieldNameList.length;
    final int theGivenValueListSize = theGivenValueList.size();
    if(aFieldNameListSize != theGivenValueListSize)
    {
      throw new WPISuiteException("Gave too few Fields or Values");
    }
    Method[] allMethods = anObjectQueried.getMethods();
    int i=0;
    List<Method> methodsToBeSaved = new ArrayList<Method>();
    while(i < aFieldNameListSize){
      for(Method m: allMethods){//Cycles through all of the methods in the class anObjectQueried
        if(i == aFieldNameListSize){
          //do nothing
        }
        else if(m.getName().equalsIgnoreCase("get" + aFieldNameList[i])){
          methodsToBeSaved.add(m); //saves the method called "get" + aFieldName
          i++;
        }
      }
    }
    final List<Method> theGetter = methodsToBeSaved;
    if(theGetter.size() == 0){
      logger.log(Level.WARNING, "Getter method was null during retrieve attempt");
      throw new WPISuiteException("Null getter method.");
    }
    final int theGettersSize = theGetter.size();
    int j = 0;
    List<Model> fullresult = new ArrayList<Model>();
    List<Model> result = new ArrayList<Model>();
View Full Code Here

    final int aFieldNameListSize = aFieldNameList.length;
    final int theGivenValueListSize = theGivenValueList.size();
    if(aFieldNameListSize != theGivenValueListSize)
    {
      throw new WPISuiteException("Gave too few fields or values");
    }
    Method[] allMethods = anObjectQueried.getMethods();
    int i=0;
    List<Method> methodsToBeSaved = new ArrayList<Method>();
    while(i < aFieldNameListSize){
      for(Method m: allMethods){//Cycles through all of the methods in the class anObjectQueried
        if(i == aFieldNameListSize){
          //do nothing
        }
        else if(m.getName().equalsIgnoreCase("get" + aFieldNameList[i])){
          methodsToBeSaved.add(m); //saves the method called "get" + aFieldName
          i++;
        }
      }
    }
    final List<Method> theGetter = methodsToBeSaved;
    if(theGetter.size() == 0){
      logger.log(Level.WARNING, "Getter method was null during retrieve attempt");
      throw new WPISuiteException("Null getter method.");
    }
    final int theGettersSize = theGetter.size();
    int j = 0;
    List<Model> fullresult = new ArrayList<Model>();
    List<Model> result = new ArrayList<Model>();
View Full Code Here

  }

  @Override
  public void save(Session s, Project model) throws WPISuiteException {
    if(s == null){
      throw new WPISuiteException("Null Session.");
    }
    //permissions checking happens in update, create, and delete methods only
    /*User theUser = s.getUser();
    if(Role.ADMIN.equals(theUser.getRole()) ||
        Permission.WRITE.equals(model.getPermission(theUser))){*/
 
View Full Code Here

  @Override
  public boolean deleteEntity(Session s1, String id) throws WPISuiteException
  {
    if(s1==null){
      throw new WPISuiteException("Null Session.");
    }
    User theUser = s1.getUser();
    Project[] model = this.getEntity(id);
    if(model[0].getPermission(theUser).equals(Permission.WRITE) ||
       theUser.getRole().equals(Role.ADMIN)){
View Full Code Here

    }
    final int aFieldNameListSize = aFieldNameList.length;
    final int theGivenValueListSize = theGivenValueList.size();
    if(aFieldNameListSize != theGivenValueListSize)
    {
      throw new WPISuiteException("Too few fields or values given");
    }
    Method[] allMethods = anObjectQueried.getMethods();
    int i=0;
    List<Method> methodsToBeSaved = new ArrayList<Method>();
    while(i < aFieldNameListSize){
      for(Method m: allMethods){//Cycles through all of the methods in the class anObjectQueried
        if(i == aFieldNameListSize){
          //do nothing
        }
        else if(m.getName().equalsIgnoreCase("get" + aFieldNameList[i])){
          methodsToBeSaved.add(m); //saves the method called "get" + aFieldName
          i++;
        }
      }
    }
    final List<Method> theGetter = methodsToBeSaved;
    if(theGetter.size() == 0){
      logger.log(Level.WARNING, "Getter method was null during retrieve attempt");
      throw new WPISuiteException("Null getter method.");
    }
    final int theGettersSize = theGetter.size();
    int j = 0;
    List<Model> fullresult = new ArrayList<Model>();
    List<Model> result = new ArrayList<Model>();
View Full Code Here

  }
 
  public Project update(Session s, Project toUpdate, String changeSet) throws WPISuiteException
  {
    if(s == null){
      throw new WPISuiteException("Null session.");
    }
   
    User theUser = s.getUser();
    if(theUser.equals(toUpdate.getOwner()) ||
       theUser.getRole().equals(Role.ADMIN)){
View Full Code Here

    }
    final int aFieldNameListSize = aFieldNameList.length;
    final int theGivenValueListSize = theGivenValueList.size();
    if(aFieldNameListSize != theGivenValueListSize)
    {
      throw new WPISuiteException();
    }
    Method[] allMethods = anObjectQueried.getMethods();
    int i=0;
    List<Method> methodsToBeSaved = new ArrayList<Method>();
    while(i < aFieldNameListSize){
      for(Method m: allMethods){//Cycles through all of the methods in the class anObjectQueried
        if(i == aFieldNameListSize){
          //do nothing
        }
        else if(m.getName().equalsIgnoreCase("get" + aFieldNameList[i])){
          methodsToBeSaved.add(m); //saves the method called "get" + aFieldName
          i++;
        }
      }
    }
    final List<Method> theGetter = methodsToBeSaved;
    if(theGetter.size() == 0){
      logger.log(Level.WARNING, "Getter method was null during retrieve attempt");
      throw new WPISuiteException("Null getter method.");
    }
    final int theGettersSize = theGetter.size();
    int j = 0;
    List<Model> fullresult = new ArrayList<Model>();
    List<Model> result = new ArrayList<Model>();
View Full Code Here

  @Test
  public void testEmptyException()
  {
    String expected = "<html> <head> <title> 500 </title> </head> <body> <h1> Error 500 </h1> <h2> Info </h2> <p>  </p> </body> </html>";
   
    WPISuiteException e = new WPISuiteException();
    String error = this.formatter.formatContent(e);
    String statusCode = String.valueOf(e.getStatus());

   
    assertTrue(expected.contains(statusCode));
    assertTrue(expected.contains("Error " + statusCode));
    assertTrue(expected.equals(error));
View Full Code Here

TOP

Related Classes of edu.wpi.cs.wpisuitetng.exceptions.WPISuiteException

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.