<commit_before>sap.ui.controller("personslist-web.personslist", {

/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* @memberOf personslist-web.personslist
*/
	   onInit: function() {
	       var oPersonsModel = new sap.ui.model.json.JSONModel();

	       oPersonsModel.setData({
				           Persons : [ {
					FirstName : "",
					LastName : ""
				} ]
	       });

	       this.getView().setModel(oPersonsModel);

	   },

	   addNewPerson : function( sFirstName, sLastName, oTable ) {
		   var oPersonsModel = new sap.ui.model.json.JSONModel();
	       oPersonsModel.setData({
				           Persons : [ {
					FirstName : sFirstName,
					LastName : sLastName
				} ]
	       });

		   this.getView().setModel(oPersonsModel);
	       oTable.unbindRows().bindRows("/Persons");
	   },


/**
* Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered
* (NOT before the first rendering! onInit() is used for that one!).
* @memberOf personslist-web.personslist
*/
//	onBeforeRendering: function() {
//
//	},
<commit_msg>[v-1.4.2] Section 4.2 of PersonsList HANA Cloud Tutorial<commit_after>sap.ui.controller("personslist-web.personslist", {

/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* @memberOf personslist-web.personslist
*/
	onInit : function() {
		var sOrigin = window.location.protocol + "//" + window.location.hostname
				+ (window.location.port ? ":" + window.location.port : "");
		var personsListOdataServiceUrl = sOrigin + "/personslist-repo-web/personslist.svc";

		var odataModel = new sap.ui.model.odata.ODataModel(
				personsListOdataServiceUrl);
		odataModel.setCountSupported(false);
		this.getView().setModel(odataModel);
	},

	addNewPerson : function(sFirstName, sLastName, oTable) {
		var persons = {};

		persons.FirstName = sFirstName;
		persons.LastName = sLastName;

		this.getView().getModel().create("/Persons", persons, null, this.successMsg, this.errorMsg);
	},

	successMsg : function() {
		sap.ui.commons.MessageBox.alert("Person entity has been successfully created");
	},

	errorMsg : function() {
		sap.ui.commons.MessageBox.alert("Error occured when creating person entity");
	},


/**
* Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered
* (NOT before the first rendering! onInit() is used for that one!).
* @memberOf personslist-web.personslist
*/
//	onBeforeRendering: function() {
//
//	},

{'fraction_non_alphanumeric': 0.12441399206635413, 'fraction_numerical': 0.0018031013342949874, 'mean_word_length': 3.57001647446458, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6350086', 'n_tokens_mistral': 920, 'n_tokens_neox': 839, 'n_words': 219}