Revision a2cc9f8d
Added by Andreas Kohlbecker almost 7 years ago
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPresenter.java | ||
---|---|---|
3 | 3 |
import java.io.Serializable; |
4 | 4 |
|
5 | 5 |
import org.apache.log4j.Logger; |
6 |
import org.hibernate.Session; |
|
7 |
import org.hibernate.engine.spi.SessionImplementor; |
|
6 | 8 |
import org.springframework.beans.factory.annotation.Autowired; |
7 | 9 |
import org.springframework.beans.factory.annotation.Qualifier; |
8 | 10 |
import org.springframework.security.core.context.SecurityContext; |
... | ... | |
63 | 65 |
return SecurityContextHolder.getContext(); |
64 | 66 |
} |
65 | 67 |
|
68 |
/** |
|
69 |
* @return |
|
70 |
*/ |
|
71 |
protected Session getSession() { |
|
72 |
Session session = getRepo().getSession(false); |
|
73 |
logger.trace(this._toString() + ".getSession() - session:" + session.hashCode() +", persistenceContext: " + ((SessionImplementor)session).getPersistenceContext() + " - " + session.toString()); |
|
74 |
return session; |
|
75 |
} |
|
76 |
|
|
77 |
protected String _toString(){ |
|
78 |
return this.getClass().getSimpleName() + "@" + this.hashCode(); |
|
79 |
} |
|
80 |
|
|
66 | 81 |
/** |
67 | 82 |
* Notifies the presenter that its view is initialized so that presenter can |
68 | 83 |
* start its own initialization if required. |
... | ... | |
70 | 85 |
* @param view |
71 | 86 |
*/ |
72 | 87 |
protected final void init(V view) { |
73 |
logger.trace("Presenter init");
|
|
88 |
logger.trace(String.format("Presenter %s init", this.toString()));
|
|
74 | 89 |
this.view = view; |
75 | 90 |
onPresenterReady(); |
76 | 91 |
} |
... | ... | |
80 | 95 |
* after presenter has finished initializing. |
81 | 96 |
*/ |
82 | 97 |
protected void onPresenterReady() { |
83 |
logger.trace("Presenter ready");
|
|
98 |
logger.trace(String.format("Presenter %s ready", this.toString()));
|
|
84 | 99 |
} |
85 | 100 |
|
86 | 101 |
public final void onViewEnter() { |
Also available in: Unified diff
more consistent save operations with better logging