-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6860 from hmislk/issue#6859
Issue#6859 Closes #6859
- Loading branch information
Showing
117 changed files
with
7,816 additions
and
2,324 deletions.
There are no files selected for viewing
This file contains 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
101 changes: 101 additions & 0 deletions
101
src/main/java/com/divudi/bean/cashTransaction/CashBookController.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Open Hospital Management Information System | ||
* Dr M H B Ariyaratne | ||
* [email protected] | ||
*/ | ||
package com.divudi.bean.cashTransaction; | ||
|
||
import com.divudi.bean.common.SessionController; | ||
import com.divudi.entity.cashTransaction.CashBook; | ||
import com.divudi.facade.CashBookFacade; | ||
import java.io.Serializable; | ||
import javax.ejb.EJB; | ||
import javax.enterprise.context.SessionScoped; | ||
import javax.faces.component.UIComponent; | ||
import javax.faces.context.FacesContext; | ||
import javax.faces.convert.Converter; | ||
import javax.faces.convert.FacesConverter; | ||
import javax.inject.Inject; | ||
import javax.inject.Named; | ||
|
||
/** | ||
* | ||
* @author Lawan Chaamindu | ||
*/ | ||
@Named | ||
@SessionScoped | ||
public class CashBookController implements Serializable { | ||
|
||
@EJB | ||
private CashBookFacade CashbookFacade; | ||
@EJB | ||
private CashBook cashBook; | ||
|
||
@Inject | ||
private SessionController sessionController; | ||
|
||
|
||
public CashBookController() { | ||
} | ||
|
||
public CashBookFacade getCashbookFacade() { | ||
return CashbookFacade; | ||
} | ||
|
||
public void setCashbookFacade(CashBookFacade CashbookFacade) { | ||
this.CashbookFacade = CashbookFacade; | ||
} | ||
|
||
public CashBook getCashBook() { | ||
return cashBook; | ||
} | ||
|
||
public void setCashBook(CashBook cashBook) { | ||
this.cashBook = cashBook; | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
@FacesConverter(forClass = CashBook.class) | ||
public static class CashBookConverter implements Converter { | ||
|
||
@Override | ||
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) { | ||
if (value == null || value.length() == 0) { | ||
return null; | ||
} | ||
CashBookController controller = (CashBookController) facesContext.getApplication().getELResolver(). | ||
getValue(facesContext.getELContext(), null, "CashBookController"); | ||
return controller.getCashbookFacade().find(getKey(value)); | ||
} | ||
|
||
java.lang.Long getKey(String value) { | ||
java.lang.Long key; | ||
key = Long.valueOf(value); | ||
return key; | ||
} | ||
|
||
String getStringKey(java.lang.Long value) { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append(value); | ||
return sb.toString(); | ||
} | ||
|
||
@Override | ||
public String getAsString(FacesContext facesContext, UIComponent component, Object object) { | ||
if (object == null) { | ||
return null; | ||
} | ||
if (object instanceof CashBook) { | ||
CashBook o = (CashBook) object; | ||
return getStringKey(o.getId()); | ||
} else { | ||
throw new IllegalArgumentException("object " + object + " is of type " | ||
+ object.getClass().getName() + "; expected type: " + CashBook.class.getName()); | ||
} | ||
} | ||
} | ||
|
||
} |
103 changes: 103 additions & 0 deletions
103
src/main/java/com/divudi/bean/cashTransaction/CashBookEntryController.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Open Hospital Management Information System | ||
* Dr M H B Ariyaratne | ||
* [email protected] | ||
*/ | ||
package com.divudi.bean.cashTransaction; | ||
|
||
import com.divudi.bean.common.SessionController; | ||
import com.divudi.entity.cashTransaction.CashBook; | ||
import com.divudi.entity.cashTransaction.CashBookEntry; | ||
import com.divudi.facade.CashBookEntryFacade; | ||
import com.divudi.facade.CashBookFacade; | ||
import java.io.Serializable; | ||
import javax.ejb.EJB; | ||
import javax.enterprise.context.SessionScoped; | ||
import javax.faces.component.UIComponent; | ||
import javax.faces.context.FacesContext; | ||
import javax.faces.convert.Converter; | ||
import javax.faces.convert.FacesConverter; | ||
import javax.inject.Inject; | ||
import javax.inject.Named; | ||
|
||
/** | ||
* | ||
* @author Lawan Chaamindu | ||
*/ | ||
@Named | ||
@SessionScoped | ||
public class CashBookEntryController implements Serializable { | ||
|
||
@EJB | ||
private CashBookEntryFacade CashbookEntryFacade; | ||
@EJB | ||
private CashBook cashBook; | ||
|
||
@Inject | ||
private SessionController sessionController; | ||
|
||
|
||
public CashBookEntryController() { | ||
} | ||
|
||
public CashBookEntryFacade getCashbookEntryFacade() { | ||
return CashbookEntryFacade; | ||
} | ||
|
||
public void setCashbookEntryFacade(CashBookEntryFacade CashbookEntryFacade) { | ||
this.CashbookEntryFacade = CashbookEntryFacade; | ||
} | ||
|
||
public CashBook getCashBook() { | ||
return cashBook; | ||
} | ||
|
||
public void setCashBook(CashBook cashBook) { | ||
this.cashBook = cashBook; | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
@FacesConverter(forClass = CashBookEntry.class) | ||
public static class CashBookEntryConverter implements Converter { | ||
|
||
@Override | ||
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) { | ||
if (value == null || value.length() == 0) { | ||
return null; | ||
} | ||
CashBookEntryController controller = (CashBookEntryController) facesContext.getApplication().getELResolver(). | ||
getValue(facesContext.getELContext(), null, "CashBookEntryController"); | ||
return controller.getCashbookEntryFacade().find(getKey(value)); | ||
} | ||
|
||
java.lang.Long getKey(String value) { | ||
java.lang.Long key; | ||
key = Long.valueOf(value); | ||
return key; | ||
} | ||
|
||
String getStringKey(java.lang.Long value) { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append(value); | ||
return sb.toString(); | ||
} | ||
|
||
@Override | ||
public String getAsString(FacesContext facesContext, UIComponent component, Object object) { | ||
if (object == null) { | ||
return null; | ||
} | ||
if (object instanceof CashBookEntry) { | ||
CashBookEntry o = (CashBookEntry) object; | ||
return getStringKey(o.getId()); | ||
} else { | ||
throw new IllegalArgumentException("object " + object + " is of type " | ||
+ object.getClass().getName() + "; expected type: " + CashBookEntry.class.getName()); | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.