Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.i4u.qla.action.contract;
- import javax.inject.Inject;
- import javax.inject.Named;
- import javax.faces.view.ViewScoped;
- import com.i4u.app.base.BaseCrud;
- import com.i4u.app.domain.AppDomain;
- import javax.transaction.Transactional;
- import javax.transaction.Transactional.TxType;
- import com.i4u.qla.model.contract.CntContract;
- @Named("contractCrud")
- @ViewScoped
- public class CntContractCrud extends BaseCrud<CntContract> {
- private static final long serialVersionUID = 1L;
- @Inject
- private CntUI ui;
- @Inject
- private AppDomain ad;
- @Override @Transactional
- public String remove(CntContract inst) {
- this.inst = entityManager.find(CntContract.class, inst.getId());
- super.remove(this.inst);
- return "";
- }
- @Override
- protected CntContract createInst() {
- inst = new CntContract();
- return inst;
- }
- @Override
- public void open(CntContract inst) {
- setPrmTarget("adm.contract");
- if (inst != null && inst.getId() != null) {
- this.inst = entityManager.find(CntContract.class, inst.getId());
- }
- ui.setContractDialogRendered(true);
- }
- }
- /* #########################################################
- /*
- /* and the remove method from super class:
- /*
- #########################################################*/
- /**
- * Remove.
- *
- * @param _inst
- * Instance to delete.
- * @return Result.
- */
- public String remove(T _inst) {
- try {
- entityManager.remove(_inst);
- entityManager.flush();
- message(msg.get("msg.Successful"), msg.get("msg.Removed"));
- } catch (Exception e) {
- fatalMessage(msg.get("msg.Failed"), msg.get("msg.Cannot remove"));
- e.printStackTrace();
- } // block catch PersistenceException
- return "";
- }
- /**
- * Method for removing from dialog form
- */
- public void remove() {
- remove(inst);
- cancel();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement