Requirement Constraints

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg
Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Wednesday, 21 August 2013

How to get Current Date and Time and store in the bean

Posted on 21:18 by Unknown

In some cases, we always want to show the current date and time while adding new order or item, etc in the screen. Here is an example for the same.

Assume that you have the Hibernate POJO as follows

	import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Temporal(TemporalType.DATE)
private Date collectedDate;

private Time collectedTime;


public Date getCollectedDate() {
return collectedDate;
}

public void setCollectedDate(Date collectedDate) {
this.collectedDate = collectedDate;
}

public Time getCollectedTime() {
return collectedTime;
}

public void setCollectedTime(Time collectedTime) {
this.collectedTime = collectedTime;
}

Now you can use the following statement to set current date and time

this.selectedOrder.setCollectedDate(new Date());
        this.selectedOrder.setCollectedTime(new java.sql.Time(System
                .currentTimeMillis()));

Read More
Posted in Java | No comments

Monday, 1 October 2012

Java Static Import

Posted on 10:56 by Unknown

This is one of feature in Java 5.

In order to access static members, it is necessary to qualify references with the class they came from. For example, one must say:

double r = Math.cos(Math.PI * theta);
System.out.println(“Hi Welcome”);

Using Static import, we can simply call the method without qualifying the class that belongs to as follows:

import static java.lang.System.out;
import static
java.lang.Math.PI;
import static java.lang.Math.cos;

double r = cos(PI * theta);
out.println("Blah blah blah");

We can use this when we require to frequently access the static methods from one or more classes.  You can see the java documentation about static import here.

Read More
Posted in Java | No comments

Tuesday, 5 June 2012

Java List and ArrayList

Posted on 18:52 by Unknown

What is Difference between List and ArrayList
For the handling of objects collection in Java, Collection interface have been provided.
This is avail in java.util package.

"List" is an interface, extends collection interface, provides some sort of extra methods
than collection interface to work with collections. Where as "ArrayList" is the actual
implementation of "List" interface.

So both the following are correct
List x= new ArrayList(); or ArrayList x= new ArrayList();


List:
List is an interface in collection framework. several classes like ArrayList,
LinkedList implement this interface. List is an ordered collection ,
so the position of an object does matter.

ArrayList:
An ArrayList is a class which can grow at runtime. you can store java objects in an ArrayList
and also add new objects at run time.
you will use ArrayList when you dont have to add or remove objects frequently from it.
Because when you remove an object, all other objects need to be repositioned inside the ArrayList,
if you have this kind of situation, try using LinkedList instaed.


Example:
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;   public class ArrayToList {
public static void main(String[] argv) {   String sArray[] = new String[] { "Array 1", "Array 2", "Array 3" };   // convert array to list
List<String> lList = Arrays.asList(sArray);   // iterator loop
System.out.println("#1 iterator");
Iterator<String> iterator = lList.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next());
}   // for loop
System.out.println("#2 for");
for (int i = 0; i < lList.size(); i++) {
System.out.println(lList.get(i));
}   // for loop advance
System.out.println("#3 for advance");
for (String temp : lList) {
System.out.println(temp);
}   // while loop
System.out.println("#4 while");
int j = 0;
while (j < lList.size()) {
System.out.println(lList.get(j));
j++;
}
}
}



import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;

public class ListExample {

public static void main(String[] args) {

// List Example implement with ArrayList
List<String> ls=new ArrayList<String>();

ls.add("one");
ls.add("Three");
ls.add("two");
ls.add("four");

Iterator it=ls.iterator();

while(it.hasNext())
{
String value=(String)it.next();

System.out.println("Value :"+value);
}
}
}
Read More
Posted in Java | No comments
Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • Understanding EDI Structure
    EDI Structure Primary Levels are 1. Interchange Envelops 2. Functional Group 3. Transaction set Data Element A data element is equival...
  • EDI 270–5010 Documentation - ISA – Interchange Control Header
    ISA – Interchange Control Header ISA – Interchange Control Header   The ISA is a fixed record length segment and all positions within ea...
  • Types of Reimbursement
    Fee-For-Service Fee-for-service is a method of payment where the provider is paid a fee for each procedure performed and billed.Most payer ...
  • ZK ListBox
    Let us first design a simple  static list box with crud Buttons as last column. Here is the code <?page title="Practice List" c...
  • ZK Example for inline Editing with Add New and Delete
    I am quite impressed on this demo from ZK . But adding new record and delete existing record is missing as part of typical CRUD. So i thoug...
  • EDI Instructions
    HIPAA Compliant Codes All the Health care EDI Transaction set should use only the following HIPAA Compliant Codes Physicians Current Pro...
  • Java Static Import
    This is one of feature in Java 5. In order to access static members, it is necessary to qualify references with the class they came from. ...
  • Hibernate Validator Example 2
    In this example, we will see some more validation constraints such as @email, @past, @length, etc. And also we will also define custom error...
  • Medical Billing Process in detail
    Now let us see each activity on medical Billing Insurance Verification Process started from here and usually front desk people are doing t...
  • EDI Transactions
    The HIPAA transactions and code set standards are rules that standardize the electronic exchange of health-related administrative informati...

Categories

  • Billing Process
  • C Workbook
  • C++ Workbook
  • Eclipse Tips
  • EDI 5010
  • EMR Appointment Features
  • EMR Labs Stuff
  • EMR PMS Links
  • EMR Use cases
  • EMR Vital Sign
  • Good Website Design
  • Hibernate Criteria Queries
  • Hibernate Introduction
  • Hibernate Introduction Setup
  • Hibernate Mapping
  • Hibernate POC
  • Hibernate Validator
  • Hibernate–Java Environment setup
  • HPI
  • Java
  • Maven
  • MU Certification
  • NPI
  • PQRS
  • Practice Management System
  • Spring Security
  • Tech Links
  • Today Tech Stuff
  • zk
  • ZK Hibernate
  • ZK 5 Databinding
  • ZK Application
  • ZK Calling Another ZUL
  • ZK CheckBox
  • ZK CreateComponents
  • ZK CSS
  • ZK extended Components
  • ZK Foreach
  • ZK Forum Posts
  • ZK Framework
  • ZK Hibernate Setup
  • ZK ID Space
  • ZK Include
  • ZK Installation
  • ZK iReport
  • ZK Layout
  • ZK Listitem Pagination
  • ZK Message Box
  • ZK MVC
  • ZK MVC Combox Box
  • ZK MVC CRUD Examples
  • ZK MVC Listbox
  • ZK MVVM
  • ZK MVVM Combo
  • ZK MVVM CRUD
  • ZK MVVM ListBox
  • ZK Spring
  • ZK TextBox

Blog Archive

  • ▼  2013 (105)
    • ▼  December (3)
      • EDI Instructions
      • Understanding EDI Structure
      • What is an EDI ?
    • ►  September (7)
    • ►  August (13)
    • ►  July (1)
    • ►  June (11)
    • ►  May (3)
    • ►  April (14)
    • ►  March (19)
    • ►  February (21)
    • ►  January (13)
  • ►  2012 (177)
    • ►  December (1)
    • ►  November (13)
    • ►  October (19)
    • ►  September (24)
    • ►  August (26)
    • ►  July (6)
    • ►  June (37)
    • ►  May (30)
    • ►  April (16)
    • ►  March (1)
    • ►  January (4)
  • ►  2011 (5)
    • ►  December (1)
    • ►  November (1)
    • ►  July (1)
    • ►  June (1)
    • ►  April (1)
  • ►  2010 (1)
    • ►  September (1)
Powered by Blogger.

About Me

Unknown
View my complete profile