Skip to content

Commit

Permalink
Merge pull request #6860 from hmislk/issue#6859
Browse files Browse the repository at this point in the history
Issue#6859 Closes #6859
  • Loading branch information
Irani96 authored Aug 23, 2024
2 parents 1093ea8 + af2ef7f commit 86f127b
Show file tree
Hide file tree
Showing 117 changed files with 7,816 additions and 2,324 deletions.
23 changes: 19 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.divudi</groupId>

<artifactId>horizon</artifactId>
<artifactId>coop</artifactId>
<version>3.0.0</version>
<packaging>war</packaging>
<name>horizon</name>
<name>coop</name>

<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
Expand Down Expand Up @@ -314,7 +314,17 @@
<artifactId>tomcat-catalina</artifactId>
<version>9.0.83</version> <!-- or the version compatible with your setup -->
</dependency>

<dependency>
<groupId>com.github.hmislk</groupId>
<artifactId>lims-middleware-libraries</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<type>jar</type>
</dependency>
</dependencies>


Expand Down Expand Up @@ -368,6 +378,11 @@
<enabled>false</enabled>
</snapshots>
</repository>
<!-- JitPack repository -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>

</repositories>
</project>
101 changes: 101 additions & 0 deletions src/main/java/com/divudi/bean/cashTransaction/CashBookController.java
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());
}
}
}

}
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());
}
}
}

}
Loading

0 comments on commit 86f127b

Please sign in to comment.