Package com.cin.translators

Examples of com.cin.translators.DataTranslator


    List<OccupationDTO> theOccupation = null;
   
    Query query = manager.createQuery("SELECT obj from Occupation obj");
   
    List<?> result = query.getResultList();
    DataTranslator aTranslator = new DataTranslator();
    aTranslator.translateToOccupationDTO(result);
    return theOccupation;
  }
View Full Code Here


      query.append(" i.industrycode =  " + aIndCode);
      query.append(" AND o.occupationcode =  " + aOccCode);
      isCriteria = true;
   
    Query queryObj = manager.createQuery(query.toString());
    DataTranslator aTranslator = new DataTranslator();
   
    List<UserDTO> result = aTranslator.translateToUserDTO(queryObj.getResultList());
   
    return result;
  }
View Full Code Here

  }
 
  public List<StateAbbvDTO> findAllStates() {
    Query query = manager.createQuery(
        "SELECT state  from StateAbbv state");
    DataTranslator aTranslator = new DataTranslator();
    List<StateAbbvDTO> result = aTranslator.translateToState(query.getResultList());
    return result;
  }
View Full Code Here

  String aQuery = "select o from Ziptable o where o.statename = :statename " ;
    Query aQueryObject = manager.createQuery(aQuery);
    aQueryObject.setParameter("statename", stateAbbv);
 
  List<?> theZipDetails = aQueryObject.getResultList();
    DataTranslator aTranslator = new DataTranslator();
  return aTranslator.translateToZipDTO(theZipDetails);

}
View Full Code Here

public List<UserDTO> findUserForZip(int pZip)  {
 
  String aQuery = "select o from Userrecord o where o.zip =  '" + pZip + "' " ;
  Query aQueryObject = manager.createQuery(aQuery);
  DataTranslator aTranslator = new DataTranslator();
  List<?> theUserDetails = aQueryObject.getResultList();
  return aTranslator.translateToUserDTO(theUserDetails);
}
View Full Code Here

  public UserDTO checkUserExistence(GenericRequest pRequest) {
    // TODO: this can't be right
    UserDTO uDto = new UserDTO();
   
    DataTranslator aTranslator = new DataTranslator();

    if ((uDto = userFactory.findUserBySsn(pRequest.getUser().getSsn())) == null)
    {    System.out.println("Failed to authenticate: SSN not found");
    return null ;
    }
View Full Code Here

    String aMarital = pDTO.getMaritalStatus();
    if( aMarital != null ){
      aMarital = aMarital.trim();
    }
   
    DataTranslator aTranslator = new DataTranslator();
    StringBuilder aQuery = new StringBuilder();
    aQuery.append("SELECT u ");
    aQuery.append("FROM Userrecord u LEFT JOIN u.job j LEFT JOIN j.occupation o LEFT JOIN u.education e ");
       
    if(aZipCode != null && aZipCode.trim().length() > 0) {
      aQuery.append(" WHERE ");
      aQuery.append("u.zip = '" + aZipCode + "' ");
      isSet = true;
    }

    if (anEducation != null && anEducation.trim().length() > 0) {
      if (isSet) {
        aQuery.append(" AND ");
      } else {
        aQuery.append(" WHERE ");
      }
     
      aQuery.append(" UPPER(TRIM( e.education )) like '%" + anEducation.toUpperCase() + "%' ");
      isSet = true;
    }
    if(anOccupation != null && anOccupation.trim().length() > 0 ) {
      int anOccupationCode = this.findOccupationCode(anOccupation);
      if(isSet) {
        aQuery.append(" AND " );
      } else {
        aQuery.append(" WHERE ");
      }
     
      aQuery.append(" o.occupationcode = " + anOccupationCode + " ");
      isSet = true;
    }
    if(aMarital != null && aMarital.trim().length() > 0) {
      if(isSet) {
       
        aQuery.append(" AND " );
      }
      else {
        aQuery.append(" WHERE ");
      }
     
      aQuery.append(" UPPER(TRIM( u.marital )) like '%" + aMarital.toUpperCase() + "%' ");
      isSet = true;
    }
   
    Query aQueryObject = manager.createQuery(aQuery.toString());
    Collection<?> theUserDetails = aQueryObject.getResultList();
    return aTranslator.translateToUserDTO(theUserDetails);
  }
View Full Code Here

    }
    return 0;
  }

  public List<UserDTO> findUsersByCode(int pIndCode,int pOccCode) {
    DataTranslator aTranslator = new DataTranslator();
    String selectString = "select u from Userrecord u ";
    StringBuilder whereString = null;
 
   
    if(pOccCode > 0) {
      whereString = new StringBuilder();
      whereString.append("where u.job.occupation.occupationcode = :occupationCode ");
    }

    if(pIndCode > 0) {
      if(whereString == null) {
        whereString = new StringBuilder();
        whereString.append(" where " );
      } else {
        whereString.append(" and ");
      }
     
      whereString.append("u.job.industry.industrycode = :industryCode ");
    }
   
    if( whereString == null ){
      return null;
    }
    Query aQueryObject = manager.createQuery(selectString + whereString.toString());
    if( pOccCode > 0){
      aQueryObject.setParameter("occupationCode", pOccCode);
    }
    if( pIndCode > 0){
      aQueryObject.setParameter("industryCode", pIndCode);
    }
    List<?> theUserDetails = aQueryObject.getResultList();
    return aTranslator.translateToUserDTO(theUserDetails);
  }
View Full Code Here

  }
 
  public List<ZipDTO> findZipForState(String pState){
    String aQuery = "select o from Ziptable o where o.statename =  '" + pState + "' " ;
      Query aQueryObject = manager.createQuery(aQuery);
    DataTranslator aTranslator = new DataTranslator();
    List<?> theZipDetails = aQueryObject.getResultList();
    return aTranslator.translateToZipDTO(theZipDetails);
  }
View Full Code Here

    else {
     
      aQuery = aQuery + " = '" + pZip + "'";
    }
    Query aQueryObject = manager.createQuery(aQuery);
    DataTranslator aTranslator = new DataTranslator();
    List<?> theUserDetails = aQueryObject.getResultList();
    return aTranslator.translateToUserDTO(theUserDetails);
  }
View Full Code Here

TOP

Related Classes of com.cin.translators.DataTranslator

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.