Package com.narirelays.ems.persistence.orm

Examples of com.narirelays.ems.persistence.orm.MaintainRecord


    Equipment equipment = equipmentDAO.findById(equipmentID);
    if(equipment==null)
    {
      result.setFailed(EQUIPMENT_NOT_EXIST,equipmentID);
    }
    MaintainRecord maintainRecord = new MaintainRecord();
    Object sendTimeObj = properties.get("sendTimeStr");//获取送修时间,接口为sendTimeStr
    Object backTimeObj = properties.get("backTimeStr");
    SimpleDateFormat sdf  = new SimpleDateFormat("yyyy-MM-dd");
    if(sendTimeObj!=null)
    {
      try{
        Date sendTime = sdf.parse(stringValue(sendTimeObj));
        maintainRecord.setSendTime(sendTime);
      }
      catch(Exception e)
      {
        //异常,就不设置sendTime
        System.out.println("Wrong time format: "+stringValue(sendTimeObj));
//        e.printStackTrace();
      }
    }
    if(backTimeObj!=null)
    {
      try{
        Date backTime = sdf.parse(stringValue(backTimeObj));
        maintainRecord.setBackTime(backTime);
      }
      catch(Exception e)
      {
        System.out.println("Wrong time format: "+stringValue(backTimeObj));
//        e.printStackTrace();
      }
    }
    try{
      BeanUtils.populate(maintainRecord, properties);
      maintainRecord.setId(MyUUIDGen.getUUID());
      maintainRecord.setEquipment(equipment);
      maintainRecordDAO.merge(maintainRecord);
      result.setSucceed(maintainRecord.getId());
    }
    catch (IllegalAccessException e)
    {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here


    if(id==null)
    {
      result.setFailed(MAINTAINRECORD_ID_IS_NULL);
      return result;
    }
    MaintainRecord maintainRecord = maintainRecordDAO.findById(id);
    if(maintainRecord==null)
    {
      result.setFailed(MAINTAINRECORD_NOT_EXIST,id);
      return result;
    }
    Object sendTimeObj = properties.get("sendTimeStr");
    Object backTimeObj = properties.get("backTimeStr");
    SimpleDateFormat sdf  = new SimpleDateFormat("yyyy-MM-dd");
    if(sendTimeObj!=null)
    {
      try{
        Date sendTime = sdf.parse(stringValue(sendTimeObj));
        maintainRecord.setSendTime(sendTime);
      }
      catch(Exception e)
      {
        System.out.println("Wrong time format: "+stringValue(sendTimeObj));
//        e.printStackTrace();
      }
    }
    if(backTimeObj!=null)
    {
      try{
        Date backTime = sdf.parse(stringValue(backTimeObj));
        maintainRecord.setBackTime(backTime);
      }
      catch(Exception e)
      {
        System.out.println("Wrong time format: "+stringValue(backTimeObj));
//        e.printStackTrace();
View Full Code Here

    if(id==null)
    {
      result.setFailed(MAINTAINRECORD_ID_IS_NULL);
      return result;
    }
    MaintainRecord maintainRecord = maintainRecordDAO.findById(id);
    if(maintainRecord==null)
    {
      result.setFailed(MAINTAINRECORD_NOT_EXIST,id);
      return result;
    }
View Full Code Here

TOP

Related Classes of com.narirelays.ems.persistence.orm.MaintainRecord

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.