Salome HOME
More business logic has been moved from BO to services. ServiceLocator is created...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / exception / LockAlreadyExistsException.java
1 /*****************************************************************************
2  * Company         OPEN CASCADE
3  * Application     SIMAN
4  * File            Id: 
5  * Creation date   02.10.2012
6  * @author         Author: Maria KRUCHININA
7  * @version        Revision: 
8  *****************************************************************************/
9 package org.splat.exception; 
10
11 import org.splat.common.properties.MessageKeyEnum;
12
13 /**
14  *
15  * Exception thrown when a lock already exists for another one.
16  * @author Maria KRUCHININA
17  *
18  */
19 public class LockAlreadyExistsException extends AbstractException {
20         
21         /**
22          * loginName of a user who has already locked an object.
23          */
24         private String _loginName;
25         /**
26          * Version id for serialization.
27          */
28         private static final long serialVersionUID = -4596111071538834057L;
29
30         /**
31          * Create a LockAlreadyExistsException.
32          * 
33          * @param tableUid the table name uid 
34          * @param rowUid the row uid 
35          * @param pLogin The plogin of the user identified by the user ID
36          */
37         public LockAlreadyExistsException(final String tableUid, final String rowUid, final String pLogin) {
38                 super(MessageKeyEnum.LCK_000001.toString(), tableUid, rowUid, pLogin);
39                 _loginName = pLogin;
40         }
41
42         /**
43          * Create a LockAlreadyExistsException.
44          * 
45          * @param throwable the cause
46          * @param tableUid the table name uid 
47          * @param rowUid the row uid 
48          * @param pLogin The plogin of the user identified by the user ID
49          */
50         public LockAlreadyExistsException(final Throwable throwable, final String tableUid, final String rowUid, final String pLogin) {
51                 super(MessageKeyEnum.LCK_000001.toString(),throwable, tableUid, rowUid, pLogin);
52                 _loginName = pLogin;
53         }
54
55         /**
56          * Create a LockAlreadyExistsException.
57          * 
58          * @param throwable
59          *            the original LockAlreadyExistsException
60          * @param msgKey
61          *            the message key
62          * @param objName
63          *            the object name
64          */
65         public LockAlreadyExistsException(
66                         final LockAlreadyExistsException throwable, final String msgKey,
67                         final String objName) {
68                 super(msgKey, throwable, objName, throwable.getLoginName());
69                 _loginName = throwable.getLoginName();
70         }
71
72
73         /**
74          * Get the loginName of a user who has already locked an object.
75          * @return the loginName
76          */
77         public final String getLoginName() {
78                 return _loginName;
79         }
80
81         /**
82          * Set the loginName of a user who has already locked an object.
83          * @param loginName the loginName to set
84          */
85         public final void setLoginName(final String loginName) {
86                 _loginName = loginName;
87         }
88
89 }