Package gwtappcontainer.shared.apps.insight

Examples of gwtappcontainer.shared.apps.insight.ProgramType


  public static ProgramType get(String programTypeName) {
       
      try {
        String sql = "select program_type_id, program_type from program_types where program_type = ?";           
          
            ProgramType programType = null;
          
            try (Connection connection = DriverManager.getConnection(Utils.getCloudSqlURL())) {                  
                try (PreparedStatement ps = connection.prepareStatement(sql)) {                      
                    ps.setString(1, programTypeName.toLowerCase());
                   
                    try (ResultSet resultSet = ps.executeQuery()) {                     
                        while (resultSet.next()) {                         
                        programType = new ProgramType();
                        programType.id = resultSet.getInt(1);
                        programType.name = resultSet.getString(2);                                                                                                         
                        }
                    }                                       
                }
View Full Code Here


               
                 ps.executeUpdate();                
             }
         }
       
         ProgramType programType = get(programTypeName);     
         return programType;
        
     } catch (Exception ex) {
         throw new RuntimeException(ex);
     }             
View Full Code Here

     }             
   }

  public static void delete(String programTypeName) {
        
       ProgramType programType = get(programTypeName);
     
       if (null == programType)
           throw new APIException(Status.ERROR_RESOURCE_DOES_NOT_EXIST,
                           "Program type [" + programTypeName + "] does not exist");
                                             
View Full Code Here

                            
              try (PreparedStatement ps = connection.prepareStatement(sql)) {                                     
                
                try (ResultSet resultSet = ps.executeQuery()) {                                       
                    while (resultSet.next()) {
                      ProgramType programType = new ProgramType();
                      programType.id = resultSet.getInt(1);
                      programType.name = resultSet.getString(2);
                     
                        all.add(programType);
                    }
View Full Code Here

              throw new RuntimeException(ex);
      }
  }

  public static ProgramType addPractise(String programTypeName, String practiseName) {
    ProgramType programType = get(programTypeName);
    if (null == programType)
      throw new APIException(Status.ERROR_RESOURCE_DOES_NOT_EXIST,
          "Program type [" + programTypeName + "] does not exist");
   
    Practise practise = PractiseRepository.get(practiseName);
View Full Code Here

         throw new RuntimeException(ex);
     }                      
  }
 
  public static ProgramType deletePractise(String programTypeName, String practiseName) {
    ProgramType programType = get(programTypeName);
    if (null == programType)
      throw new APIException(Status.ERROR_RESOURCE_DOES_NOT_EXIST,
          "Program type [" + programTypeName + "] does not exist");
   
    Practise practise = PractiseRepository.get(practiseName);
View Full Code Here

    TestHelper.deleteAllData()
  }
 
  @Test
  public void getTest() {
    ProgramType programType = ProgramTypeRepository.get("isha kriya");
    assertTrue(programType == null);
   
    ProgramTypeRepository.add("isha kriya");
    programType = ProgramTypeRepository.get("isha kriya");
    assertTrue(programType != null);
View Full Code Here

    assertTrue(programType.name.equals("isha kriya"));
  }
 
  @Test
  public void addTest() {
    ProgramType programType = ProgramTypeRepository.get("isha kriya");
    assertTrue(programType == null);
   
    ProgramTypeRepository.add("isha KRiYa");
    programType = ProgramTypeRepository.get("isha KRIYa");
    assertTrue(programType != null);
View Full Code Here

  }
 
  @Test
  public void deleteTest() {
    ProgramTypeRepository.add("isha kriya");
    ProgramType programType = ProgramTypeRepository.get("isha Kriya");
    assertTrue(programType != null);
   
    ProgramTypeRepository.delete("isha kriya");
    programType = ProgramTypeRepository.get("isha Kriya");
    assertTrue(programType == null);
View Full Code Here

    PractiseRepository.add("shoonya");
    PractiseRepository.add("pranayam");
    ProgramTypeRepository.addPractise("SSY", "shoonyA");
    ProgramTypeRepository.addPractise("SSY", "Pranayam");
   
    ProgramType programType = ProgramTypeRepository.get("ssy");
    assertTrue(programType.practises.size() == 2);
    assertTrue(programType.practises.get(0).equals("pranayam"));
    assertTrue(programType.practises.get(1).equals("shoonya"));
  }
View Full Code Here

TOP

Related Classes of gwtappcontainer.shared.apps.insight.ProgramType

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.