Monday, April 23, 2018

Java Transient Keyword

transient is a Java keyword which marks a member variable not to be serialized when it is persisted to streams of bytes. When an object is transferred through the network, the object needs to be 'serialized'. Serialization converts the object state to serial bytes. Those bytes are sent over the network and the object is recreated from those bytes. Member variables marked by the java transientkeyword are not transferred; they are lost intentionally.
Syntax:
private transient <member-variable>;
or 
transient private <member-variable>;

For example:
Computer code
public class Foo implements Serializable
 {
   private String saveMe;
   private transient String dontSaveMe;
   private transient String password;
   //...
 }

Tuesday, April 10, 2018

Git Commond

Command line instructions

Git global setup
git config --global user.name "priyantha"
git config --global user.email "kdpsamaraweera@gmail.com"
Create a new repository
git clone http://172.26.86.150:8787/root/MicroServices_APITesting.git
cd MicroServices_APITesting
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder
cd existing_folder
git init
git remote add origin http://172.26.86.150:8787/root/MicroServices_APITesting.git
git add .
git commit -m "Initial commit"
git push -u origin master
Existing Git repository
cd existing_repo
git remote add origin http://172.26.86.150:8787/root/MicroServices_APITesting.git
git push -u origin --all
git push -u origin --tags

-GitLab(MY PART)

 How to setup global
 
	git config --global user.name "priyantha_inova"
	git config --global user.email "kdpsamaraweera@gmail.com"
	git config --global user.name
    git config --global user.email  

 If you already have project in gitlab and empty local repository
	you need to get git project to local repository
	
	git clone http://172.26.86.150:8787/root/Device_Sale.git
	 
 If you already have project in local repository but empty dev branch in gitlab
	You need to push your project to gitlab as initial commit
	
	git init
	git remote add origin http://172.26.86.150:8787/root/Device_Sale.git
	git add .
	git commit -m "Initial Commit"
	git push -u origin dev(If you need master then "git push -u origin master")
	
 If you already have project in dev branch and same projectt in local repository.
	 You need update dev branch with updated local project resources.
 
	 Then go to local folder
	 git pull http://172.26.86.150:8787/root/Device_Sale.git
	 git checkout dev(If you are in the master go to dev branch)
	 git add .
	 git commit -m "Something"
	 git remote add origine http://172.26.86.150:8787/root/Device_Sale.git  
	 git push -u origin dev (or git push -u -f origin dev)

Wednesday, April 4, 2018

Virtual Column in database


Virtual column value automatically calculated using a deterministic expression, in particular from the values of other fields in the table.

How to create  virtual columns

create table virtualcolumntest(
   name varchar(225),
   fixedSalery int,
   bonus int,
   totalSalery int generated always as (fixedSalery+bonus) virtual
);

Insert Values to table

In this scenario don't need to add values to the virtual column. It automatically generates.


insert into  virtualcolumntest(name , fixedSalery ,bonus) 
values ("teck4world", 20000,30000);

Then you can see table as bellow

name             fixedSalery    bonus      totalSalery
-------             --------------     --------       --------------
teck4world     20000           30000       50000


totalSalery value automatically inserted. 







How to convert json object to java classes - 01 (Basic Build)


Try to build This.

Json Body

{
  "retriveCusDetailsFrmCrmDTOI": {
         "accountNo": "",
         "apiCallingUser": "QA",
  
         "custref": "",
         "msisdn": "734300066",
         "provideServiceNoDetailsOnly": "2",
         "reqSBU": "7",
         "terminalIP": "",
         "terminalName": ""
  },
  "userId": "shar",
  "appName": "myapp"
}

RetriveCusDetailsFrmCrmDTO class

public class RetriveCusDetailsFrmCrmDTO {

 private RetriveCusDetailsFrmCrmDTOI retriveCusDetailsFrmCrmDTOI;
 private String userId;
 private String appName;
 
 public RetriveCusDetailsFrmCrmDTOI getRetriveCusDetailsFrmCrmDTOI() {
  return retriveCusDetailsFrmCrmDTOI;
 }
 public void setRetriveCusDetailsFrmCrmDTOI(RetriveCusDetailsFrmCrmDTOI retriveCusDetailsFrmCrmDTOI) {
  this.retriveCusDetailsFrmCrmDTOI = retriveCusDetailsFrmCrmDTOI;
 }
 public String getUserId() {
  return userId;
 }
 public void setUserId(String userId) {
  this.userId = userId;
 }
 public String getAppName() {
  return appName;
 }
 public void setAppName(String appName) {
  this.appName = appName;
 }
}



RetriveCusDetailsFrmCrmDTOI class

public class RetriveCusDetailsFrmCrmDTOI {
 
 private String accountNo;
 private String apiCallingUser;
 private String custref;
 private String msisdn;
 private String provideServiceNoDetailsOnly;
 private String reqSBU;
 private String terminalIP;
 private String terminalName;
 
 //Getter And Setter
}


http://localhost:9080/springbootbasic/address/addressList