Commit 632af1a8 authored by Jie Yuan's avatar Jie Yuan
Browse files

iss9 add timestamp feature

parent cc43e101
......@@ -12,6 +12,8 @@ import java.util.Date;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -373,7 +375,8 @@ public class ServiceComponentController implements Serializable{
}
else{
/** Otherwise we do not update it **/
log.info("There are no changes on the old serviceComponent, discarding updates on it");
this.updateServiceComponentTimeStamp(servCompOld, servComponent);
log.info("There are no changes on the old serviceComponent, only time stamp modified");
}
}
else{
......@@ -436,7 +439,9 @@ public class ServiceComponentController implements Serializable{
}
else{
/** Otherwise we do not update it **/
log.info("There are no changes on the old serviceComponent, discarding updates on it");
log.info("time stamp modification");
this.updateServiceComponentTimeStamp(servCompOld, servComponent);
log.info("There are no changes on the old serviceComponent, only time stamp modified");
}
}
else{
......@@ -538,6 +543,44 @@ public class ServiceComponentController implements Serializable{
}
/**
* Updates the old serviceComponent with the data of the new servComp
* and saves it on the DB
* @param servCompOld
* @param servCompNew
* author: jie yuan
*
*/
private void updateServiceComponentTimeStamp(ServiceComponent servCompOld, ServiceComponent servCompNew){
//this.servCompRepository.save(servCompOld);
log.info("in function to modify time stamp");
servCompNew.setCreatedTime(new DateTime());
// Then we update the old with the new data and we save it
log.info(
"Updating old serviceComponent data time stamp: "
+"Old time stamp: "+servCompOld.getCreatedTime().toString()+"\n"
+"With new serviceComponent data time stamp:"
+"New prodTag: "+servCompNew.getCreatedTime().toString()+"\n"
);
//DateTime now = servCompOld.getCreatedTime();
servCompOld.setCreatedTime(servCompNew.getCreatedTime().now());
//log.info(servCompOld.getCreatedTime());
//log.info(servCompNew.getCreatedTime());
servCompOld = this.servCompRepository.save(servCompOld);
log.info("Service component time stamp updated and saved on DB");
}
/**
* Parses the pakiti report and return a list with each data row of each serviceComponentName data
* @param pakitiReport
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment