Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gechengyang
nouiWithSpringMVC
Commits
4a9d88d8
Commit
4a9d88d8
authored
Mar 18, 2021
by
WeiCong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加bd提前退出交易机制
parent
60001fbe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
509 additions
and
508 deletions
+509
-508
ExitTransactionException.java
...entation/noui/api/exception/ExitTransactionException.java
+1
-1
NoUiPresentation.java
...a/org/sss/presentation/noui/context/NoUiPresentation.java
+500
-500
AbstractCommonController.java
...resentation/noui/controller/AbstractCommonController.java
+8
-7
No files found.
src/main/java/org/sss/presentation/noui/api/exception/ExitTransactionException.java
View file @
4a9d88d8
...
...
@@ -5,7 +5,7 @@ public class ExitTransactionException extends RuntimeException {
private
String
errorCode
;
public
ExitTransactionException
(
String
message
,
String
errorCod
e
)
{
public
ExitTransactionException
(
String
errorCode
,
String
messag
e
)
{
super
(
message
);
this
.
errorCode
=
errorCode
;
}
...
...
src/main/java/org/sss/presentation/noui/context/NoUiPresentation.java
View file @
4a9d88d8
...
...
@@ -9,6 +9,7 @@ import org.sss.common.impl.AbstractNullPresentation;
import
org.sss.common.impl.ProxyDatafield
;
import
org.sss.common.model.*
;
import
org.sss.exception.ContainerException
;
import
org.sss.presentation.noui.api.exception.ExitTransactionException
;
import
org.sss.presentation.noui.api.request.NoUiRequest
;
import
org.sss.presentation.noui.api.response.ErrorCodes
;
import
org.sss.presentation.noui.common.Constants
;
...
...
@@ -27,341 +28,340 @@ import java.util.List;
import
java.util.Map
;
public
class
NoUiPresentation
extends
AbstractNullPresentation
{
private
static
final
Log
log
=
LogFactory
.
getLog
(
NoUiPresentation
.
class
);
// public final Map<IModuleList<?>, List<RowOpItem>> tableRowMap = new
// HashMap<IModuleList<?>, List<RowOpItem>>();
// public final Map<IAttribute<?>, String> formatMap = new
// HashMap<IAttribute<?>, String>();
// public final Map<IAttribute<?>, String> messageMap = new
// HashMap<IAttribute<?>, String>();
// public final Map<IAttribute<?>, String> hintMap = new
// HashMap<IAttribute<?>, String>();
// public final List<IModuleList<?>> tableModifyList = new
// ArrayList<IModuleList<?>>();
// public final List<IAttribute<?>> modifyList = new
// ArrayList<IAttribute<?>>();
// public final List<IAttribute<?>> visibleList = new
// ArrayList<IAttribute<?>>();
// public final List<IAttribute<?>> codeValuesList = new
// ArrayList<IAttribute<?>>();
private
Map
<
String
,
Object
>
codetable
=
new
HashMap
<>();
private
NoUiRequest
noUiRequest
;
private
Map
<
String
,
Object
>
error
=
new
HashMap
<>();
private
Map
<
String
,
Object
>
modifyMap
=
new
HashMap
<>();
// public final List<IAttribute<?>> enableList = new
// ArrayList<IAttribute<?>>();
// public final List<IAttribute<?>> requiredList = new
// ArrayList<IAttribute<?>>();
private
String
message
=
null
;
// 弹出的message
private
String
message_code
=
ErrorCodes
.
SUCCESS
;
public
IPanel
popupPanel
=
null
;
@Override
public
void
close
(
IPanel
panel
)
throws
ContainerException
{
// TODO Auto-generated method stub
super
.
close
(
panel
);
}
@Override
public
void
popupOnly
(
IPanel
panel
)
throws
ContainerException
{
// TODO Auto-generated method stub
super
.
popupOnly
(
panel
);
}
@Override
public
Object
readFromSession
(
String
name
)
{
return
((
NoUiContext
)
this
.
ctx
).
getRedisLoginInfo
().
getContextMap
().
get
(
name
);
}
@Override
public
void
showMainPanel
()
throws
ContainerException
{
}
@Override
public
void
showPanel
(
IPanel
panel
)
throws
ContainerException
{
super
.
showPanel
(
panel
);
}
@Override
public
void
writeToSession
(
String
name
,
Object
value
)
{
((
NoUiContext
)
this
.
ctx
).
getRedisLoginInfo
().
getContextMap
().
put
(
name
,
value
);
}
public
String
transactionName
=
null
;
public
boolean
clearFlag
=
false
;
public
boolean
newTabFlag
=
false
;
private
boolean
isChain
=
false
;
public
Boolean
logoutFlag
=
null
;
public
String
getMessageCode
()
{
return
this
.
message_code
;
}
public
String
getMessage
()
{
return
this
.
message
;
}
public
boolean
isChain
()
{
return
isChain
;
}
public
NoUiPresentation
(
NoUiContext
context
,
NoUiRequest
noUiRequest
)
{
this
.
ctx
=
context
;
this
.
noUiRequest
=
noUiRequest
;
}
public
synchronized
void
dispose
()
{
if
(
disposed
)
{
return
;
}
clearRequest
();
super
.
dispose
();
}
public
final
boolean
noError
()
throws
ContainerException
{
return
error
.
isEmpty
();
}
public
final
void
clearRequest
()
throws
ContainerException
{
// tableRowMap.clear();
// formatMap.clear();
// messageMap.clear();
// hintMap.clear();
// tableModifyList.clear();
// modifyList.clear();
// visibleList.clear();
// codeValuesList.clear();
// enableList.clear();
// requiredList.clear();
popupPanel
=
null
;
transactionName
=
null
;
logoutFlag
=
null
;
}
public
final
void
chain
(
String
transactionName
)
throws
ContainerException
{
chain
(
transactionName
,
false
,
false
);
}
public
void
chain
(
String
transactionName
,
boolean
clearFlag
,
boolean
newTabFlag
)
{
this
.
transactionName
=
transactionName
;
this
.
clearFlag
=
clearFlag
;
this
.
newTabFlag
=
newTabFlag
;
isChain
=
true
;
}
public
void
logout
()
throws
ContainerException
{
logoutFlag
=
true
;
}
public
final
void
popup
(
IPanel
popupPanel
)
{
// this.popupPanel = popupPanel;
popupPanel
.
invokeDefaultRules
(
this
.
ctx
);
}
// @SuppressWarnings({ "rawtypes", "unchecked" })
// private final void mapPut(Map paramMap, IAttribute paramIAttribute,
// String paramString1, String paramString2, Object... paramVarArgs) {
// for (int i = 0; i < paramVarArgs.length; i++) {
// if ((paramVarArgs[i] instanceof String)) {
// paramVarArgs[i] = getI18nValue((String) paramVarArgs[i]);
// }
// }
// String str = MessageFormat.format(getI18nValue(paramString2),
// paramVarArgs);
// if (paramString1 != null) {
// paramIAttribute.setAttribute(paramString1, str);
// }
// paramMap.put(paramIAttribute, str);
//
// if ((paramIAttribute instanceof IDatafield)) {
// log.info(String.format("error field url %s.", new Object[] {
// ((IDatafield<?>) paramIAttribute).getUrl() }));
// }
//
// if ((paramIAttribute instanceof IBaseObject)) {
// error.put(((IBaseObject) paramIAttribute).getUrl(), str);
// }
//
// }
@SuppressWarnings
(
"rawtypes"
)
public
final
void
error
(
IAttribute
paramIAttribute
,
String
paramString
,
Object
...
paramVarArgs
)
throws
ContainerException
{
paramIAttribute
=
handleProxyField
(
paramIAttribute
);
// mapPut(messageMap, paramIAttribute, null, paramString, paramVarArgs);
for
(
int
i
=
0
;
i
<
paramVarArgs
.
length
;
i
++)
{
if
((
paramVarArgs
[
i
]
instanceof
String
))
{
paramVarArgs
[
i
]
=
getI18nValue
((
String
)
paramVarArgs
[
i
]);
}
}
String
str
=
MessageFormat
.
format
(
getI18nValue
(
paramString
),
paramVarArgs
);
if
((
paramIAttribute
instanceof
IBaseObject
))
{
error
.
put
(((
IBaseObject
)
paramIAttribute
).
getUrl
(),
str
);
}
if
((
log
.
isDebugEnabled
())
&&
((
paramIAttribute
instanceof
IDatafield
)))
{
log
.
info
(
String
.
format
(
"error field url %s."
,
new
Object
[]
{
((
IDatafield
<?>)
paramIAttribute
).
getUrl
()
}));
}
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
setHint
(
IAttribute
paramIAttribute
,
String
paramString
,
Object
...
paramVarArgs
)
throws
ContainerException
{
// mapPut(hintMap, paramIAttribute, "HINT", paramString, paramVarArgs);
}
public
boolean
message
(
MessageType
paramMessageType
,
String
paramString
,
Object
paramObject
)
throws
ContainerException
{
if
(
paramMessageType
.
equals
(
MessageType
.
ERROR
)
&&
(
paramObject
instanceof
Throwable
))
{
//记录异常日志
TxInfo
.
recordException
((
Throwable
)
paramObject
);
}
String
str1
=
""
;
try
{
if
((
paramObject
instanceof
String
))
{
str1
=
(
String
)
paramObject
;
}
else
if
((
paramObject
instanceof
Throwable
))
{
File
localFile
=
new
File
(
getRootPath
(),
"dump"
);
if
(!
localFile
.
exists
())
localFile
.
mkdirs
();
String
str2
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss.SSS"
).
format
(
new
Date
())
+
".log"
;
PrintStream
localPrintStream
=
new
PrintStream
(
new
FileOutputStream
(
new
File
(
localFile
,
str2
)));
((
Throwable
)
paramObject
).
printStackTrace
(
localPrintStream
);
localPrintStream
.
close
();
str1
=
String
.
format
(
getI18nValue
(
"eibs"
,
"error.message"
),
new
Object
[]
{
((
Throwable
)
paramObject
).
getMessage
(),
str2
});
log
.
error
(
"事件触发异常:"
+((
Throwable
)
paramObject
).
getMessage
(),(
Throwable
)
paramObject
);
}
else
if
(
paramObject
!=
null
)
{
str1
=
paramObject
.
toString
();
}
if
(
paramString
==
null
)
{
paramString
=
getI18nValue
(
"eibs"
,
"error.title"
);
}
if
((!
StringUtils
.
isEmpty
(
paramString
))
&&
paramString
.
matches
(
"E[0-9]{4}"
))
{
this
.
message_code
=
paramString
;
}
/*
private
static
final
Log
log
=
LogFactory
.
getLog
(
NoUiPresentation
.
class
);
// public final Map<IModuleList<?>, List<RowOpItem>> tableRowMap = new
// HashMap<IModuleList<?>, List<RowOpItem>>();
// public final Map<IAttribute<?>, String> formatMap = new
// HashMap<IAttribute<?>, String>();
// public final Map<IAttribute<?>, String> messageMap = new
// HashMap<IAttribute<?>, String>();
// public final Map<IAttribute<?>, String> hintMap = new
// HashMap<IAttribute<?>, String>();
// public final List<IModuleList<?>> tableModifyList = new
// ArrayList<IModuleList<?>>();
// public final List<IAttribute<?>> modifyList = new
// ArrayList<IAttribute<?>>();
// public final List<IAttribute<?>> visibleList = new
// ArrayList<IAttribute<?>>();
// public final List<IAttribute<?>> codeValuesList = new
// ArrayList<IAttribute<?>>();
public
IPanel
popupPanel
=
null
;
public
String
transactionName
=
null
;
public
boolean
clearFlag
=
false
;
public
boolean
newTabFlag
=
false
;
public
Boolean
logoutFlag
=
null
;
private
Map
<
String
,
Object
>
codetable
=
new
HashMap
<>();
private
NoUiRequest
noUiRequest
;
private
Map
<
String
,
Object
>
error
=
new
HashMap
<>();
private
Map
<
String
,
Object
>
modifyMap
=
new
HashMap
<>();
// public final List<IAttribute<?>> enableList = new
// ArrayList<IAttribute<?>>();
// public final List<IAttribute<?>> requiredList = new
// ArrayList<IAttribute<?>>();
private
String
message
=
null
;
// 弹出的message
private
String
message_code
=
ErrorCodes
.
SUCCESS
;
private
boolean
isChain
=
false
;
public
NoUiPresentation
(
NoUiContext
context
,
NoUiRequest
noUiRequest
)
{
this
.
ctx
=
context
;
this
.
noUiRequest
=
noUiRequest
;
}
@Override
public
void
close
(
IPanel
panel
)
throws
ContainerException
{
// TODO Auto-generated method stub
super
.
close
(
panel
);
}
@Override
public
void
popupOnly
(
IPanel
panel
)
throws
ContainerException
{
// TODO Auto-generated method stub
super
.
popupOnly
(
panel
);
}
@Override
public
Object
readFromSession
(
String
name
)
{
return
((
NoUiContext
)
this
.
ctx
).
getRedisLoginInfo
().
getContextMap
().
get
(
name
);
}
@Override
public
void
showMainPanel
()
throws
ContainerException
{
}
@Override
public
void
showPanel
(
IPanel
panel
)
throws
ContainerException
{
super
.
showPanel
(
panel
);
}
@Override
public
void
writeToSession
(
String
name
,
Object
value
)
{
((
NoUiContext
)
this
.
ctx
).
getRedisLoginInfo
().
getContextMap
().
put
(
name
,
value
);
}
public
String
getMessageCode
()
{
return
this
.
message_code
;
}
public
String
getMessage
()
{
return
this
.
message
;
}
public
boolean
isChain
()
{
return
isChain
;
}
public
synchronized
void
dispose
()
{
if
(
disposed
)
{
return
;
}
clearRequest
();
super
.
dispose
();
}
public
final
boolean
noError
()
throws
ContainerException
{
return
error
.
isEmpty
();
}
public
final
void
clearRequest
()
throws
ContainerException
{
// tableRowMap.clear();
// formatMap.clear();
// messageMap.clear();
// hintMap.clear();
// tableModifyList.clear();
// modifyList.clear();
// visibleList.clear();
// codeValuesList.clear();
// enableList.clear();
// requiredList.clear();
popupPanel
=
null
;
transactionName
=
null
;
logoutFlag
=
null
;
}
public
final
void
chain
(
String
transactionName
)
throws
ContainerException
{
chain
(
transactionName
,
false
,
false
);
}
public
void
chain
(
String
transactionName
,
boolean
clearFlag
,
boolean
newTabFlag
)
{
this
.
transactionName
=
transactionName
;
this
.
clearFlag
=
clearFlag
;
this
.
newTabFlag
=
newTabFlag
;
isChain
=
true
;
}
public
void
logout
()
throws
ContainerException
{
logoutFlag
=
true
;
}
public
final
void
popup
(
IPanel
popupPanel
)
{
// this.popupPanel = popupPanel;
popupPanel
.
invokeDefaultRules
(
this
.
ctx
);
}
// @SuppressWarnings({ "rawtypes", "unchecked" })
// private final void mapPut(Map paramMap, IAttribute paramIAttribute,
// String paramString1, String paramString2, Object... paramVarArgs) {
// for (int i = 0; i < paramVarArgs.length; i++) {
// if ((paramVarArgs[i] instanceof String)) {
// paramVarArgs[i] = getI18nValue((String) paramVarArgs[i]);
// }
// }
// String str = MessageFormat.format(getI18nValue(paramString2),
// paramVarArgs);
// if (paramString1 != null) {
// paramIAttribute.setAttribute(paramString1, str);
// }
// paramMap.put(paramIAttribute, str);
//
// if ((paramIAttribute instanceof IDatafield)) {
// log.info(String.format("error field url %s.", new Object[] {
// ((IDatafield<?>) paramIAttribute).getUrl() }));
// }
//
// if ((paramIAttribute instanceof IBaseObject)) {
// error.put(((IBaseObject) paramIAttribute).getUrl(), str);
// }
//
// }
@SuppressWarnings
(
"rawtypes"
)
public
final
void
error
(
IAttribute
paramIAttribute
,
String
paramString
,
Object
...
paramVarArgs
)
throws
ContainerException
{
paramIAttribute
=
handleProxyField
(
paramIAttribute
);
// mapPut(messageMap, paramIAttribute, null, paramString, paramVarArgs);
for
(
int
i
=
0
;
i
<
paramVarArgs
.
length
;
i
++)
{
if
((
paramVarArgs
[
i
]
instanceof
String
))
{
paramVarArgs
[
i
]
=
getI18nValue
((
String
)
paramVarArgs
[
i
]);
}
}
String
str
=
MessageFormat
.
format
(
getI18nValue
(
paramString
),
paramVarArgs
);
if
((
paramIAttribute
instanceof
IBaseObject
))
{
error
.
put
(((
IBaseObject
)
paramIAttribute
).
getUrl
(),
str
);
}
if
((
log
.
isDebugEnabled
())
&&
((
paramIAttribute
instanceof
IDatafield
)))
{
log
.
info
(
String
.
format
(
"error field url %s."
,
new
Object
[]{((
IDatafield
<?>)
paramIAttribute
).
getUrl
()}));
}
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
setHint
(
IAttribute
paramIAttribute
,
String
paramString
,
Object
...
paramVarArgs
)
throws
ContainerException
{
// mapPut(hintMap, paramIAttribute, "HINT", paramString, paramVarArgs);
}
public
boolean
message
(
MessageType
paramMessageType
,
String
paramString
,
Object
paramObject
)
{
if
(
paramObject
instanceof
ExitTransactionException
){
throw
ExitTransactionException
.
class
.
cast
(
paramObject
);
}
if
(
paramMessageType
.
equals
(
MessageType
.
ERROR
)
&&
(
paramObject
instanceof
Throwable
))
{
//记录异常日志
TxInfo
.
recordException
((
Throwable
)
paramObject
);
}
String
str1
=
""
;
try
{
if
((
paramObject
instanceof
String
))
{
str1
=
(
String
)
paramObject
;
}
else
if
((
paramObject
instanceof
Throwable
))
{
File
localFile
=
new
File
(
getRootPath
(),
"dump"
);
if
(!
localFile
.
exists
())
localFile
.
mkdirs
();
String
str2
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss.SSS"
).
format
(
new
Date
())
+
".log"
;
PrintStream
localPrintStream
=
new
PrintStream
(
new
FileOutputStream
(
new
File
(
localFile
,
str2
)));
((
Throwable
)
paramObject
).
printStackTrace
(
localPrintStream
);
localPrintStream
.
close
();
str1
=
String
.
format
(
getI18nValue
(
"eibs"
,
"error.message"
),
new
Object
[]{((
Throwable
)
paramObject
).
getMessage
(),
str2
});
log
.
error
(
"事件触发异常:"
+
((
Throwable
)
paramObject
).
getMessage
(),
(
Throwable
)
paramObject
);
}
else
if
(
paramObject
!=
null
)
{
str1
=
paramObject
.
toString
();
}
if
(
paramString
==
null
)
{
paramString
=
getI18nValue
(
"eibs"
,
"error.title"
);
}
if
((!
StringUtils
.
isEmpty
(
paramString
))
&&
paramString
.
matches
(
"E[0-9]{4}"
))
{
this
.
message_code
=
paramString
;
}
/*
* if (MessageType.ERROR.equals(paramMessageType)) {
* log.error(StringUtils.isEmpty(paramString) ? str1 : str1 + ":" +
* paramString); }
*/
this
.
message
=
str1
;
// log.debug(paramString + "--" + paramObject);
}
catch
(
Exception
e
)
{
if
((
paramObject
instanceof
Throwable
))
{
log
.
error
(
"dump message error"
,
(
Throwable
)
paramObject
);
}
log
.
warn
(
"function message error"
,
e
);
}
return
false
;
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
setRequired
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"REQUIRED"
,
Boolean
.
valueOf
(
true
));
// if (!requiredList.contains(paramIAttribute)) {
// requiredList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setNotRequired
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"REQUIRED"
,
Boolean
.
valueOf
(
false
));
// if (!requiredList.contains(paramIAttribute)) {
// requiredList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
boolean
isRequired
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
Boolean
localBoolean
=
(
Boolean
)
paramIAttribute
.
getAttribute
(
"REQUIRED"
);
return
localBoolean
==
null
?
false
:
localBoolean
.
booleanValue
();
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
enable
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"ENABLE"
,
Boolean
.
valueOf
(
true
));
// if (!enableList.contains(paramIAttribute)) {
// enableList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
disable
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"ENABLE"
,
Boolean
.
valueOf
(
false
));
// if (!enableList.contains(paramIAttribute)) {
// enableList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
final
boolean
isEnabled
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
Boolean
localBoolean
=
(
Boolean
)
paramIAttribute
.
getAttribute
(
"ENABLE"
);
return
localBoolean
==
null
?
true
:
localBoolean
.
booleanValue
();
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
visible
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"VISIBLE"
,
Boolean
.
valueOf
(
true
));
// if (!visibleList.contains(paramIAttribute)) {
// visibleList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
invisible
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"VISIBLE"
,
Boolean
.
valueOf
(
false
));
// if (!visibleList.contains(paramIAttribute)) {
// visibleList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
final
boolean
isVisible
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
Boolean
localBoolean
=
(
Boolean
)
paramIAttribute
.
getAttribute
(
"VISIBLE"
);
return
localBoolean
==
null
?
true
:
localBoolean
.
booleanValue
();
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
setModified
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
//paramIAttribute.setAttribute("MODIFY", Boolean.valueOf(true));
setModified
(
paramIAttribute
,
true
);
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
resetModified
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
this
.
message
=
str1
;
// log.debug(paramString + "--" + paramObject);
}
catch
(
Exception
e
)
{
if
((
paramObject
instanceof
Throwable
))
{
log
.
error
(
"dump message error"
,
(
Throwable
)
paramObject
);
}
log
.
warn
(
"function message error"
,
e
);
}
return
false
;
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
setRequired
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"REQUIRED"
,
Boolean
.
valueOf
(
true
));
// if (!requiredList.contains(paramIAttribute)) {
// requiredList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setNotRequired
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"REQUIRED"
,
Boolean
.
valueOf
(
false
));
// if (!requiredList.contains(paramIAttribute)) {
// requiredList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
boolean
isRequired
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
Boolean
localBoolean
=
(
Boolean
)
paramIAttribute
.
getAttribute
(
"REQUIRED"
);
return
localBoolean
==
null
?
false
:
localBoolean
.
booleanValue
();
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
enable
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"ENABLE"
,
Boolean
.
valueOf
(
true
));
// if (!enableList.contains(paramIAttribute)) {
// enableList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
disable
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"ENABLE"
,
Boolean
.
valueOf
(
false
));
// if (!enableList.contains(paramIAttribute)) {
// enableList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
final
boolean
isEnabled
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
Boolean
localBoolean
=
(
Boolean
)
paramIAttribute
.
getAttribute
(
"ENABLE"
);
return
localBoolean
==
null
?
true
:
localBoolean
.
booleanValue
();
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
visible
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"VISIBLE"
,
Boolean
.
valueOf
(
true
));
// if (!visibleList.contains(paramIAttribute)) {
// visibleList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
invisible
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
paramIAttribute
.
setAttribute
(
"VISIBLE"
,
Boolean
.
valueOf
(
false
));
// if (!visibleList.contains(paramIAttribute)) {
// visibleList.add(paramIAttribute);
// }
}
@SuppressWarnings
(
"rawtypes"
)
public
final
boolean
isVisible
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
Boolean
localBoolean
=
(
Boolean
)
paramIAttribute
.
getAttribute
(
"VISIBLE"
);
return
localBoolean
==
null
?
true
:
localBoolean
.
booleanValue
();
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
setModified
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
//paramIAttribute.setAttribute("MODIFY", Boolean.valueOf(true));
setModified
(
paramIAttribute
,
true
);
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
resetModified
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
// paramIAttribute.setAttribute("MODIFY", Boolean.valueOf(false));
setModified
(
paramIAttribute
,
false
);
}
@SuppressWarnings
(
"rawtypes"
)
public
final
boolean
isModified
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
Boolean
localBoolean
=
(
Boolean
)
paramIAttribute
.
getAttribute
(
"MODIFY"
);
return
localBoolean
==
null
?
false
:
localBoolean
.
booleanValue
();
}
private
IAttribute
handleProxyField
(
IAttribute
paramIAttribute
)
{
while
(
paramIAttribute
instanceof
ProxyDatafield
)
{
paramIAttribute
=
((
ProxyDatafield
)
paramIAttribute
).
getHost
();
log
.
info
(
"proxy url="
+
((
IBaseObject
)
paramIAttribute
).
getUrl
());
}
return
paramIAttribute
;
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
setValues
(
IAttributeValue
paramIAttributeValue
,
List
<
CodetableItem
>
paramList
)
throws
ContainerException
{
paramIAttributeValue
=
(
IAttributeValue
)
handleProxyField
(
paramIAttributeValue
);
codetable
.
put
(((
IBaseObject
)
paramIAttributeValue
).
getUrl
(),
paramList
);
paramIAttributeValue
.
setAttribute
(
"CODEVALUES"
,
paramList
);
setModified
(
paramIAttribute
,
false
);
}
@SuppressWarnings
(
"rawtypes"
)
public
final
boolean
isModified
(
IAttribute
paramIAttribute
)
throws
ContainerException
{
Boolean
localBoolean
=
(
Boolean
)
paramIAttribute
.
getAttribute
(
"MODIFY"
);
return
localBoolean
==
null
?
false
:
localBoolean
.
booleanValue
();
}
private
IAttribute
handleProxyField
(
IAttribute
paramIAttribute
)
{
while
(
paramIAttribute
instanceof
ProxyDatafield
)
{
paramIAttribute
=
((
ProxyDatafield
)
paramIAttribute
).
getHost
();
log
.
info
(
"proxy url="
+
((
IBaseObject
)
paramIAttribute
).
getUrl
());
}
return
paramIAttribute
;
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
setValues
(
IAttributeValue
paramIAttributeValue
,
List
<
CodetableItem
>
paramList
)
throws
ContainerException
{
paramIAttributeValue
=
(
IAttributeValue
)
handleProxyField
(
paramIAttributeValue
);
codetable
.
put
(((
IBaseObject
)
paramIAttributeValue
).
getUrl
(),
paramList
);
paramIAttributeValue
.
setAttribute
(
"CODEVALUES"
,
paramList
);
/*
* if (((paramIAttributeValue instanceof IBaseObject)) &&
* (!this.codeValuesList.contains(paramIAttributeValue))) { IBaseObject
...
...
@@ -370,13 +370,13 @@ public class NoUiPresentation extends AbstractNullPresentation {
*
* }
*/
}
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
listRowChange
(
IModuleList
paramIModuleList
,
RowOpType
paramRowOpType
,
int
paramInt1
,
int
paramInt2
)
throws
ContainerException
{
// if (!tableModifyList.contains(paramIModuleList)) {
// tableModifyList.add(paramIModuleList);
// }
@SuppressWarnings
(
"rawtypes"
)
public
final
void
listRowChange
(
IModuleList
paramIModuleList
,
RowOpType
paramRowOpType
,
int
paramInt1
,
int
paramInt2
)
throws
ContainerException
{
// if (!tableModifyList.contains(paramIModuleList)) {
// tableModifyList.add(paramIModuleList);
// }
/*
* List<Map<String, Object>> dataList = new ArrayList<Map<String,
* Object>>(); for (int i = 0; i < paramIModuleList.size(); i++) {
...
...
@@ -388,169 +388,169 @@ public class NoUiPresentation extends AbstractNullPresentation {
* data.put(paramIModuleList.getUrl(), dataList);
*/
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
setDescription
(
IDatafield
paramIDatafield
,
String
paramString
)
{
paramIDatafield
.
setAttribute
(
"DESCRIPTION"
,
paramString
);
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setChartArguments
(
IAttributeValue
paramIAttributeValue
,
Object
[]
paramArrayOfObject
)
{
paramIAttributeValue
.
setAttribute
(
"ARGS"
,
paramArrayOfObject
);
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setViewType
(
IAttributeValue
paramIAttributeValue
,
ViewType
paramViewType
,
int
paramInt
)
{
setViewType
(
paramIAttributeValue
,
paramViewType
,
1
,
paramInt
,
-
1
);
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setViewType
(
IAttributeValue
paramIAttributeValue
,
ViewType
paramViewType
,
int
paramInt1
,
int
paramInt2
,
int
paramInt3
)
{
paramIAttributeValue
.
setAttribute
(
"VIEWTYPE"
,
paramViewType
);
if
(
paramInt1
>
1
)
{
paramIAttributeValue
.
setAttribute
(
"COLSPAN"
,
Integer
.
valueOf
(
paramInt1
));
}
if
(
paramInt2
>
0
)
{
paramIAttributeValue
.
setAttribute
(
"WIDTH"
,
Integer
.
valueOf
(
paramInt2
));
}
if
(
paramInt3
>
0
)
{
paramIAttributeValue
.
setAttribute
(
"HEIGHT"
,
Integer
.
valueOf
(
paramInt3
));
}
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setViewAttribute
(
IAttributeValue
paramIAttributeValue
,
int
paramInt1
,
int
paramInt2
,
List
<
CodetableItem
>
paramList
)
{
if
(
paramInt1
>
0
)
{
paramIAttributeValue
.
setAttribute
(
"LENGTH"
,
Integer
.
valueOf
(
paramInt1
));
}
if
(
paramInt2
>
0
)
{
paramIAttributeValue
.
setAttribute
(
"LINE"
,
Integer
.
valueOf
(
paramInt2
));
}
if
((
paramList
!=
null
)
&&
(!
paramList
.
isEmpty
()))
{
paramIAttributeValue
.
setAttribute
(
"CODEVALUES"
,
paramList
);
}
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setViewFormat
(
IAttributeValue
paramIAttributeValue
,
String
paramString
)
{
if
(!
ContainerUtils
.
isEmpty
(
paramString
))
{
if
(!(
paramIAttributeValue
instanceof
IBaseObject
))
{
paramIAttributeValue
.
setAttribute
(
"FORMAT"
,
paramString
);
}
else
{
// IBaseObject localIBaseObject = (IBaseObject)
// paramIAttributeValue;
// this.formatMap.put(localIBaseObject, paramString);
}
}
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setViewStyle
(
IAttribute
paramIAttribute
,
String
paramString1
,
String
paramString2
)
{
if
(
paramString1
!=
null
)
{
paramIAttribute
.
setAttribute
(
"STYLE"
,
paramString1
);
}
if
(
paramString2
!=
null
)
{
paramIAttribute
.
setAttribute
(
"STYLECLASS"
,
paramString2
);
}
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setHeaderAttribute
(
IAttributeValue
paramIAttributeValue
,
int
paramInt1
,
int
paramInt2
)
{
setHeaderAttribute
(
paramIAttributeValue
,
paramInt1
,
paramInt2
,
1
);
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setHeaderAttribute
(
IAttributeValue
paramIAttributeValue
,
int
paramInt1
,
int
paramInt2
,
int
paramInt3
)
{
if
(
paramInt1
>
0
)
{
paramIAttributeValue
.
setAttribute
(
"WIDTH"
,
Integer
.
valueOf
(
paramInt1
));
}
if
(
paramInt2
>
1
)
{
paramIAttributeValue
.
setAttribute
(
"COLSPAN"
,
Integer
.
valueOf
(
paramInt2
));
}
if
(
paramInt3
>
1
)
{
paramIAttributeValue
.
setAttribute
(
"ROWSPAN"
,
Integer
.
valueOf
(
paramInt3
));
}
}
@SuppressWarnings
(
"rawtypes"
)
private
final
void
setModified
(
IAttribute
paramIAttribute
,
boolean
paramBoolean
)
{
paramIAttribute
=
handleProxyField
(
paramIAttribute
);
modifyMap
.
put
(((
IBaseObject
)
paramIAttribute
).
getUrl
(),
paramIAttribute
);
}
@Override
public
ICodetable
getCodetableInstance
()
throws
ContainerException
{
return
NoUiUtils
.
tbl
;
}
@Override
public
II18n
getI18nInstance
()
throws
ContainerException
{
return
NoUiUtils
.
i18n
;
}
@Override
public
IFilter
getPasswordFilter
()
throws
ContainerException
{
return
NoUiUtils
.
passwordFilter
;
}
@Override
public
String
getRootPath
()
throws
ContainerException
{
// return
// localFile.getParentFile().getParentFile().getParentFile().getAbsolutePath();
return
NoUiUtils
.
rootPath
;
}
@Override
public
boolean
isBackground
()
throws
ContainerException
{
return
false
;
}
@Override
public
boolean
isDebugMode
()
throws
ContainerException
{
return
NoUiUtils
.
debugMode
;
}
@Override
public
void
saveDisplay
(
IPanel
[]
panels
,
String
fileName
,
String
cssUrl
,
String
jsUrl
)
throws
ContainerException
{
saveDisplay
(
panels
,
fileName
);
}
@Override
public
void
saveDisplay
(
IPanel
[]
panels
,
String
fileName
)
throws
ContainerException
{
try
{
Map
<
String
,
?>
map
=
noUiRequest
.
getSaveDisplayMap
();
String
data
=
new
Gson
().
toJson
(
map
);
FileUtils
.
write
(
new
File
(
fileName
),
data
,
Constants
.
ENCODING
);
}
catch
(
IOException
e
)
{
log
.
error
(
"save dispaly error"
,
e
);
}
}
public
Map
<
String
,
Object
>
getCodetable
()
{
return
codetable
;
}
public
Map
<
String
,
Object
>
getError
(
)
{
return
error
;
}
public
void
setCodetable
(
Map
<
String
,
Object
>
codetable
)
{
this
.
codetable
=
codetable
;
}
public
void
setError
(
Map
<
String
,
Object
>
error
)
{
this
.
error
=
error
;
}
public
Map
<
String
,
Object
>
getModifyMap
()
{
return
modifyMap
;
}
public
void
setModifyMap
(
Map
<
String
,
Object
>
modifyMap
)
{
this
.
modifyMap
=
modifyMap
;
}
}
@SuppressWarnings
(
"rawtypes"
)
public
final
void
setDescription
(
IDatafield
paramIDatafield
,
String
paramString
)
{
paramIDatafield
.
setAttribute
(
"DESCRIPTION"
,
paramString
);
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setChartArguments
(
IAttributeValue
paramIAttributeValue
,
Object
[]
paramArrayOfObject
)
{
paramIAttributeValue
.
setAttribute
(
"ARGS"
,
paramArrayOfObject
);
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setViewType
(
IAttributeValue
paramIAttributeValue
,
ViewType
paramViewType
,
int
paramInt
)
{
setViewType
(
paramIAttributeValue
,
paramViewType
,
1
,
paramInt
,
-
1
);
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setViewType
(
IAttributeValue
paramIAttributeValue
,
ViewType
paramViewType
,
int
paramInt1
,
int
paramInt2
,
int
paramInt3
)
{
paramIAttributeValue
.
setAttribute
(
"VIEWTYPE"
,
paramViewType
);
if
(
paramInt1
>
1
)
{
paramIAttributeValue
.
setAttribute
(
"COLSPAN"
,
Integer
.
valueOf
(
paramInt1
));
}
if
(
paramInt2
>
0
)
{
paramIAttributeValue
.
setAttribute
(
"WIDTH"
,
Integer
.
valueOf
(
paramInt2
));
}
if
(
paramInt3
>
0
)
{
paramIAttributeValue
.
setAttribute
(
"HEIGHT"
,
Integer
.
valueOf
(
paramInt3
));
}
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setViewAttribute
(
IAttributeValue
paramIAttributeValue
,
int
paramInt1
,
int
paramInt2
,
List
<
CodetableItem
>
paramList
)
{
if
(
paramInt1
>
0
)
{
paramIAttributeValue
.
setAttribute
(
"LENGTH"
,
Integer
.
valueOf
(
paramInt1
));
}
if
(
paramInt2
>
0
)
{
paramIAttributeValue
.
setAttribute
(
"LINE"
,
Integer
.
valueOf
(
paramInt2
));
}
if
((
paramList
!=
null
)
&&
(!
paramList
.
isEmpty
()))
{
paramIAttributeValue
.
setAttribute
(
"CODEVALUES"
,
paramList
);
}
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setViewFormat
(
IAttributeValue
paramIAttributeValue
,
String
paramString
)
{
if
(!
ContainerUtils
.
isEmpty
(
paramString
))
{
if
(!(
paramIAttributeValue
instanceof
IBaseObject
))
{
paramIAttributeValue
.
setAttribute
(
"FORMAT"
,
paramString
);
}
else
{
// IBaseObject localIBaseObject = (IBaseObject)
// paramIAttributeValue;
// this.formatMap.put(localIBaseObject, paramString);
}
}
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setViewStyle
(
IAttribute
paramIAttribute
,
String
paramString1
,
String
paramString2
)
{
if
(
paramString1
!=
null
)
{
paramIAttribute
.
setAttribute
(
"STYLE"
,
paramString1
);
}
if
(
paramString2
!=
null
)
{
paramIAttribute
.
setAttribute
(
"STYLECLASS"
,
paramString2
);
}
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setHeaderAttribute
(
IAttributeValue
paramIAttributeValue
,
int
paramInt1
,
int
paramInt2
)
{
setHeaderAttribute
(
paramIAttributeValue
,
paramInt1
,
paramInt2
,
1
);
}
@SuppressWarnings
(
"rawtypes"
)
public
void
setHeaderAttribute
(
IAttributeValue
paramIAttributeValue
,
int
paramInt1
,
int
paramInt2
,
int
paramInt3
)
{
if
(
paramInt1
>
0
)
{
paramIAttributeValue
.
setAttribute
(
"WIDTH"
,
Integer
.
valueOf
(
paramInt1
));
}
if
(
paramInt2
>
1
)
{
paramIAttributeValue
.
setAttribute
(
"COLSPAN"
,
Integer
.
valueOf
(
paramInt2
));
}
if
(
paramInt3
>
1
)
{
paramIAttributeValue
.
setAttribute
(
"ROWSPAN"
,
Integer
.
valueOf
(
paramInt3
));
}
}
@SuppressWarnings
(
"rawtypes"
)
private
final
void
setModified
(
IAttribute
paramIAttribute
,
boolean
paramBoolean
)
{
paramIAttribute
=
handleProxyField
(
paramIAttribute
);
modifyMap
.
put
(((
IBaseObject
)
paramIAttribute
).
getUrl
(),
paramIAttribute
);
}
@Override
public
ICodetable
getCodetableInstance
()
throws
ContainerException
{
return
NoUiUtils
.
tbl
;
}
@Override
public
II18n
getI18nInstance
()
throws
ContainerException
{
return
NoUiUtils
.
i18n
;
}
@Override
public
IFilter
getPasswordFilter
()
throws
ContainerException
{
return
NoUiUtils
.
passwordFilter
;
}
@Override
public
String
getRootPath
()
throws
ContainerException
{
// return
// localFile.getParentFile().getParentFile().getParentFile().getAbsolutePath();
return
NoUiUtils
.
rootPath
;
}
@Override
public
boolean
isBackground
()
throws
ContainerException
{
return
false
;
}
@Override
public
boolean
isDebugMode
()
throws
ContainerException
{
return
NoUiUtils
.
debugMode
;
}
@Override
public
void
saveDisplay
(
IPanel
[]
panels
,
String
fileName
,
String
cssUrl
,
String
jsUrl
)
throws
ContainerException
{
saveDisplay
(
panels
,
fileName
);
}
@Override
public
void
saveDisplay
(
IPanel
[]
panels
,
String
fileName
)
throws
ContainerException
{
try
{
Map
<
String
,
?>
map
=
noUiRequest
.
getSaveDisplayMap
();
String
data
=
new
Gson
().
toJson
(
map
);
FileUtils
.
write
(
new
File
(
fileName
),
data
,
Constants
.
ENCODING
);
}
catch
(
IOException
e
)
{
log
.
error
(
"save dispaly error"
,
e
);
}
}
public
Map
<
String
,
Object
>
getCodetable
()
{
return
codetable
;
}
public
void
setCodetable
(
Map
<
String
,
Object
>
codetable
)
{
this
.
codetable
=
codetable
;
}
public
Map
<
String
,
Object
>
getError
(
)
{
return
error
;
}
public
void
setError
(
Map
<
String
,
Object
>
error
)
{
this
.
error
=
error
;
}
public
Map
<
String
,
Object
>
getModifyMap
()
{
return
modifyMap
;
}
public
void
setModifyMap
(
Map
<
String
,
Object
>
modifyMap
)
{
this
.
modifyMap
=
modifyMap
;
}
}
src/main/java/org/sss/presentation/noui/controller/AbstractCommonController.java
View file @
4a9d88d8
...
...
@@ -188,14 +188,15 @@ public abstract class AbstractCommonController {
ret
=
ResultUtil
.
result
(
NoUiPresentationUtil
.
retCode
(
context
),
NoUiPresentationUtil
.
retMsg
(
context
),
afterReturnData
,
paginationData
,
NoUiPresentationUtil
.
handleErrorReturnData
(
context
,
alias
),
NoUiPresentationUtil
.
handleCodeTableReturnData
(
context
,
alias
),
noUiVersion
.
getVersion
());
}
catch
(
ExitTransactionException
exitTrans
)
{
ret
=
ResultUtil
.
result
(
exitTrans
.
getErrorCode
(),
exitTrans
.
getMessage
(),
"service error"
,
noUiVersion
.
getVersion
());
}
catch
(
Throwable
e
)
{
log
.
error
(
"OnClick command error"
,
e
);
ret
=
ResultUtil
.
result
(
ErrorCodes
.
ERROR
,
"hander error"
,
"service error"
,
noUiVersion
.
getVersion
());
TxInfo
.
recordException
(
e
);
if
(
e
.
getCause
()
instanceof
ExitTransactionException
){
ExitTransactionException
exitTrans
=
ExitTransactionException
.
class
.
cast
(
e
.
getCause
());
ret
=
ResultUtil
.
result
(
exitTrans
.
getErrorCode
(),
exitTrans
.
getMessage
(),
exitTrans
.
getMessage
(),
noUiVersion
.
getVersion
());
}
else
{
log
.
error
(
"OnClick command error"
,
e
);
ret
=
ResultUtil
.
result
(
ErrorCodes
.
ERROR
,
"hander error"
,
"service error"
,
noUiVersion
.
getVersion
());
TxInfo
.
recordException
(
e
);
}
}
finally
{
if
(
context
!=
null
)
{
//context.getSupport().disconnect();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment