This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Step1 -- ngRepeat directive to go through all the rows in the table | |
//emp.html - we see a snipped code which is conrolled by the empController | |
<div ng-controller="empController"> | |
<table id="myTable" class="emp-table"> | |
<thead> | |
<tr> | |
<th>Name</th> | |
<th>Address</th> | |
</tr> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Step 1. on ng-click call a method and pass the $index to it. say select($index). | |
//Note - $index is a property of ng-Repeat and represents the index of the selected row | |
<div ng-controller ="MyCtrl"> | |
<tr ng-repeat="car in cars" ng-click="select($index)"> | |
<td>..</td> | |
<tr> | |
</div> | |
//Step2 - On MyCtrl Controller, store the index | |
$scope.select = function(index){ | |
$scope.index = index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The query for the books: | |
//Reference : http://www.laliluna.de/articles/java-persistence-hibernate/performance-tips-hibernate-java-persistence.html | |
List<Book> books = session.createQuery( | |
“from Book b where b.name like ?”).setString(0, “Java%”).list(); | |
/* The following code printing the books will create one SQL query per | |
book to initialize the chapters. We get 1+n queries in total. One for | |
the books and n for the chapters, if we have n books. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.webforefront.aop; | |
import org.hibernate.stat.Statistics; | |
import org.hibernate.SessionFactory; | |
import org.aspectj.lang.ProceedingJoinPoint; | |
import org.aspectj.lang.annotation.Around; | |
import org.aspectj.lang.annotation.Aspect; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import javax.persistence.EntityManagerFactory; | |
import org.hibernate.ejb.HibernateEntityManagerFactory; | |
import org.apache.commons.logging.Log; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.webforefront.aop; | |
import org.apache.commons.lang.time.StopWatch; | |
import org.apache.commons.logging.Log; | |
import org.apache.commons.logging.LogFactory; | |
import org.aspectj.lang.ProceedingJoinPoint; | |
import org.aspectj.lang.annotation.Around; | |
import org.aspectj.lang.annotation.Pointcut; | |
import org.aspectj.lang.annotation.Aspect; | |
@Aspect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def parseXmlClosure = { pRoot,parentObj,user,curId -> | |
def xmlMap=[:] | |
def rootName = pRoot.name() | |
def domainClz = SingUtils.DOMAIN_OBJECTS_MAP."${rootName}" | |
log.debug "domainc lass loaded as ${domainClz}" | |
def curObj=null | |
if(curId) { | |
curObj = domainClz.get(curId) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html ng-app="testApp"> <!-- remember testApp defines that this is angular app, you can define it at downlevels too --> | |
<!-- your css files --> | |
<head> | |
<link rel="stylesheet" href="css/style.default.css" type="text/css" /> | |
<link rel="stylesheet" href="css/style.navyblue.css" type="text/css" /> | |
<link rel="stylesheet" href="css/responsive-tables.css"> | |
<script src="js/lib/angular/angular.js"></script> | |
<script src="js/lib/angular/angular-resource.js"></script> | |
<script src="js/app.js"></script> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//do nothing on the success callback, hence replacing the success callbck function with angular.noop() | |
$scope.contacts= Contacts.query( angular.noop,function(response) { | |
Window.myresp = response; | |
$scope.displayError(response); | |
console.log("bad boy, listContacts failed"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Happy Coding! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://jsfiddle.net/mbhatamb/4JYQH/ | |
//Below is the Description of Employee Object, in a simple way | |
Employee e = new Object(); | |
e.firstName = "John"; | |
e.lastName = "tester"; | |
e.getFullName = new function() { | |
return this.firstName + " " + this.lastName; | |
} | |
console.log(e.getFullName()); |