BrightSide Workbench Full Report + Source Code
org.turro.jpa.composer.EntityComposer< E, ID > Class Template Referenceabstract
Inheritance diagram for org.turro.jpa.composer.EntityComposer< E, ID >:
Collaboration diagram for org.turro.jpa.composer.EntityComposer< E, ID >:

Public Member Functions

final void onChange (Event event)
 
final void onSave ()
 
final void onDelete ()
 
Object getEntity ()
 
Object getWrapper ()
 
void doBeforeComposeChildren (Component comp) throws Exception
 
void doFinally () throws Exception
 
void doAfterCompose (Component comp) throws Exception
 

Protected Member Functions

abstract String getAttributeName ()
 
abstract E getEntityInstance (ID id)
 
abstract DaoEntity getWrapperInstance (Component comp)
 
abstract boolean inSaveRole ()
 
abstract boolean inDeleteRole ()
 
void doOnSave ()
 
boolean beforeSave ()
 
void afterSave ()
 
void doOnDelete ()
 
boolean beforeDelete ()
 
void afterDelete ()
 
void doOnChange ()
 
boolean shouldBeSaved ()
 
boolean hasChanged ()
 
void retrieveEntity ()
 
boolean canClose ()
 

Protected Attributes

entity
 
DaoEntity wrapper
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g
Parameters
<E>
<ID>

Definition at line 49 of file EntityComposer.java.

Member Function Documentation

◆ afterDelete()

void org.turro.jpa.composer.EntityComposer< E, ID >.afterDelete ( )
protected

Definition at line 149 of file EntityComposer.java.

149  {
150  // do nothing
151  }

◆ afterSave()

◆ beforeDelete()

boolean org.turro.jpa.composer.EntityComposer< E, ID >.beforeDelete ( )
protected

Reimplemented in org.turro.financials.document.logic.DocumentComposer, and org.turro.financials.business.CompaniesComposer.

Definition at line 145 of file EntityComposer.java.

145  {
146  return true;
147  }

◆ beforeSave()

◆ canClose()

boolean org.turro.jpa.composer.EntityComposer< E, ID >.canClose ( )
protected

Reimplemented in org.turro.financials.contract.logic.ContractComposer.

Definition at line 185 of file EntityComposer.java.

185  {
186  return true;
187  }

◆ doAfterCompose()

void org.turro.jpa.composer.EntityComposer< E, ID >.doAfterCompose ( Component  comp) throws Exception

Definition at line 109 of file EntityComposer.java.

109  {
110  super.doAfterCompose(comp);
111  interceptOnClose();
112  }

◆ doBeforeComposeChildren()

void org.turro.jpa.composer.EntityComposer< E, ID >.doBeforeComposeChildren ( Component  comp) throws Exception

Definition at line 88 of file EntityComposer.java.

88  {
89  entity = null;
91  comp.setAttribute(getAttributeName(), entity);
93  comp.setAttribute("wrapper", wrapper);
94  super.doBeforeComposeChildren(comp);
95  }
abstract DaoEntity getWrapperInstance(Component comp)

◆ doFinally()

void org.turro.jpa.composer.EntityComposer< E, ID >.doFinally ( ) throws Exception

Reimplemented in org.turro.publication.zul.ctrl.PublicationComposer, org.turro.newsletter.NewsletterComposer, org.turro.dossier.zul.dossier.DossierComposer, org.turro.dossier.grant.ProjectGrantComposer, org.turro.zul.convocation.ConvocationComposer, org.turro.contacts.form.ContactComposer, org.turro.financials.document.logic.DocumentComposer, and org.turro.financials.contract.logic.ContractComposer.

Definition at line 98 of file EntityComposer.java.

98  {
99  super.doFinally();
100  save.setDisabled(!shouldBeSaved());
101  save.setLabel(I_.get("Save"));
102  save.setImage(Images.getImage("save"));
103  delete.setDisabled(!wrapper.canDelete() || !inDeleteRole());
104  delete.setLabel(I_.get("Delete"));
105  delete.setImage(Images.getImage("edit-delete"));
106  }

◆ doOnChange()

void org.turro.jpa.composer.EntityComposer< E, ID >.doOnChange ( )
protected

Reimplemented in org.turro.erp.workorder.logic.WorkOrderComposer.

Definition at line 153 of file EntityComposer.java.

153  {
154  // do nothing
155  }

◆ doOnDelete()

◆ doOnSave()

void org.turro.jpa.composer.EntityComposer< E, ID >.doOnSave ( )
protected

Reimplemented in org.turro.contacts.form.ContactComposer, and org.turro.financials.document.logic.DocumentComposer.

Definition at line 120 of file EntityComposer.java.

120  {
121  if(beforeSave()) {
122  entity = (E) wrapper.save();
123  Framework.getCurrent().closeSelected();
124  afterSave();
125  }
126  }
Here is the caller graph for this function:

◆ getAttributeName()

◆ getEntity()

Object org.turro.jpa.composer.EntityComposer< E, ID >.getEntity ( )

Definition at line 79 of file EntityComposer.java.

79  {
80  return entity;
81  }

◆ getEntityInstance()

abstract E org.turro.jpa.composer.EntityComposer< E, ID >.getEntityInstance ( ID  id)
abstractprotected

◆ getWrapper()

Object org.turro.jpa.composer.EntityComposer< E, ID >.getWrapper ( )

Definition at line 83 of file EntityComposer.java.

83  {
84  return wrapper;
85  }
Here is the caller graph for this function:

◆ getWrapperInstance()

◆ hasChanged()

boolean org.turro.jpa.composer.EntityComposer< E, ID >.hasChanged ( )
protected

Reimplemented in org.turro.financials.business.CompaniesComposer.

Definition at line 161 of file EntityComposer.java.

161  {
162  return !Jsons.isEmpty(entityJSON) ? (!Jsons.equals(entityJSON, Stubs.json(entity))) :
163  (entityXML == null || (!entityXML.equals(new XMLSerializer(entity).data())));
164  }

◆ inDeleteRole()

◆ inSaveRole()

◆ onChange()

final void org.turro.jpa.composer.EntityComposer< E, ID >.onChange ( Event  event)

Definition at line 62 of file EntityComposer.java.

62  {
63  if(!(event.getTarget() instanceof Tab)) {
64  save.setDisabled(!(wrapper.canSave() && (hasChanged() || shouldBeSaved())) || !inSaveRole());
65  doOnChange();
66  }
67  }

◆ onDelete()

final void org.turro.jpa.composer.EntityComposer< E, ID >.onDelete ( )

Definition at line 75 of file EntityComposer.java.

75  {
76  doOnDelete();
77  }
Here is the caller graph for this function:

◆ onSave()

final void org.turro.jpa.composer.EntityComposer< E, ID >.onSave ( )

Definition at line 70 of file EntityComposer.java.

70  {
71  doOnSave();
72  }

◆ retrieveEntity()

void org.turro.jpa.composer.EntityComposer< E, ID >.retrieveEntity ( )
protected

Reimplemented in org.turro.financials.document.logic.DocumentComposer, and org.turro.financials.business.CompaniesComposer.

Definition at line 166 of file EntityComposer.java.

166  {
167  Framework frame = Framework.getCurrent();
168  entity = (E) frame.getSelectedAttribute("tp_entity");
169  if(entity == null) {
170  if(Executions.getCurrent().getAttribute(getAttributeName() + "Generated") != null) {
171  entity = (E) Executions.getCurrent().getAttribute(getAttributeName() + "Generated");
172  Executions.getCurrent().removeAttribute(getAttributeName() + "Generated");
173  } else {
174  entity = (E) getEntityInstance((ID) frame.getDesktop().getAttribute(getAttributeName() + "Id"));
175  frame.getDesktop().removeAttribute(getAttributeName() + "Id");
176  }
177  frame.setSelectedAttribute("tp_entity", entity);
178  } else {
179  entity = (E) getEntityInstance((ID) DaoEntity.getEntityId(entity));
180  }
181  entityXML = new XMLSerializer(entity).data();
182  entityJSON = Stubs.json(entity);
183  }

◆ shouldBeSaved()

Member Data Documentation

◆ entity

E org.turro.jpa.composer.EntityComposer< E, ID >.entity
protected

Definition at line 52 of file EntityComposer.java.

◆ wrapper

Definition at line 53 of file EntityComposer.java.


The documentation for this class was generated from the following file: