Skip to content

Commit

Permalink
Add session information to the output Json
Browse files Browse the repository at this point in the history
Add session information to the output Json when running the tool with --published-session-uid.
The option will be supported only for customers with specific HF installed
  • Loading branch information
chkp-yaelg authored Dec 25, 2018
1 parent 501a6cd commit dde68aa
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/com/checkpoint/mgmt_api/objects/IndexView.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
public class IndexView
{
private String publishedSessionUid;
private Session session;
private String domain;
private List<PolicyPackage> policyPackages = new ArrayList<>();

Expand All @@ -34,14 +34,14 @@ public List<PolicyPackage> getPolicyPackages()
return policyPackages;
}

public String getPublishedSessionUid()
public Session getSession()
{
return publishedSessionUid;
return session;
}

public void setPublishedSessionUid(String publishedSessionUid)
public void setSession(Session session)
{
this.publishedSessionUid = publishedSessionUid;
this.session = session;
}

/**
Expand All @@ -54,7 +54,9 @@ public JSONObject toJson(){

JSONObject jsonIndex = new JSONObject();

jsonIndex.put("published-session-uid",publishedSessionUid);
if(session != null){
jsonIndex.put("published-session",session.toJson());
}
jsonIndex.put("domain",domain);
JSONArray policy = new JSONArray();
for( PolicyPackage policyPackage : policyPackages){
Expand Down
64 changes: 64 additions & 0 deletions src/main/java/com/checkpoint/mgmt_api/objects/Session.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.checkpoint.mgmt_api.objects;

import org.json.simple.JSONObject;

public class Session
{
private String uid;
private String name;
private String publishTime;
private Boolean lastPublishedSession;

public String getUid()
{
return uid;
}

public void setUid(String uid)
{
this.uid = uid;
}

public String getName()
{
return name;
}

public void setName(String name)
{
this.name = name;
}

public String getPublishTime()
{
return publishTime;
}

public void setPublishTime(String publishTime)
{
this.publishTime = publishTime;
}

public Boolean getLastPublishedSession()
{
return lastPublishedSession;
}

public void setLastPublishedSession(Boolean lastPublishedSession)
{
this.lastPublishedSession = lastPublishedSession;
}

public JSONObject toJson(){

JSONObject jsonObject = new JSONObject();
jsonObject.put("uid",getUid());
jsonObject.put("name",getName());
jsonObject.put("publish-time",getPublishTime());
jsonObject.put("last-published-session", getLastPublishedSession());

return jsonObject;
}


}

0 comments on commit dde68aa

Please sign in to comment.