Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BasicAPI
Project
Project
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
杜科
BasicAPI
Commits
21fa7752
Commit
21fa7752
authored
Apr 23, 2023
by
shyWang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PDM前端改造
基线相关接口
parent
abb72b07
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
320 additions
and
100 deletions
+320
-100
SearchOperatorEnumUtil.java
src/com/yonde/basedata/search/SearchOperatorEnumUtil.java
+6
-0
BaseSearchService.java
src/com/yonde/basedata/service/BaseSearchService.java
+3
-2
DxBaselineController.java
src/com/yonde/baseline/controller/DxBaselineController.java
+24
-9
DxBaselineService.java
src/com/yonde/baseline/service/DxBaselineService.java
+49
-21
DxBaselineMemberVO.java
src/com/yonde/baseline/vo/DxBaselineMemberVO.java
+15
-9
DxBaselineVO.java
src/com/yonde/baseline/vo/DxBaselineVO.java
+45
-2
BaseLineUtil.java
src/com/yonde/common/BaseLineUtil.java
+2
-1
CommonUtil.java
src/com/yonde/common/CommonUtil.java
+8
-0
DocUtil.java
src/com/yonde/common/DocUtil.java
+3
-1
DxSearchUtil.java
src/com/yonde/common/DxSearchUtil.java
+66
-55
Global.java
src/com/yonde/contants/Global.java
+5
-0
ContainerUtil.java
src/com/yonde/context/uitls/ContainerUtil.java
+94
-0
No files found.
src/com/yonde/basedata/search/SearchOperatorEnumUtil.java
View file @
21fa7752
...
...
@@ -42,6 +42,12 @@ public class SearchOperatorEnumUtil {
public
static
final
String
DX_VIEWID
=
"dxViewId"
;
public
static
final
String
DX_CONTEXT_NAME
=
"dxContext-name"
;
public
static
final
String
DX_FOLDER_ID
=
"folderName"
;
public
static
final
String
DX_SUBTYPE_NAME
=
"subTypeName"
;
public
static
final
String
DX_ID
=
"id"
;
public
static
final
String
DX_NAME
=
"name"
;
...
...
src/com/yonde/basedata/service/BaseSearchService.java
View file @
21fa7752
...
...
@@ -15,6 +15,7 @@ import com.yonde.change.vo.pr.DxProblemReportVo;
import
com.yonde.common.*
;
import
com.yonde.doc.vo.DxDocumentVO
;
import
com.yonde.part.vo.DxPartVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.springframework.stereotype.Service
;
...
...
@@ -102,7 +103,7 @@ public class BaseSearchService <V extends IdVO> implements RemoteAccess {
}
if
(
wtObjectById
instanceof
ManagedBaseline
)
{
ManagedBaseline
baseline
=
(
ManagedBaseline
)
wtObjectById
;
idVO
=
new
DxBaselineVO
(
baseline
);
idVO
=
new
DxBaselineVO
(
baseline
,
false
);
return
idVO
;
}
if
(
wtObjectById
instanceof
EPMDocument
)
{
...
...
@@ -136,7 +137,7 @@ public class BaseSearchService <V extends IdVO> implements RemoteAccess {
}
else
{
o
=
(
WTObject
)
element
;
}
DxSearchUtil
.
buildQueryResult
(
o
,
partList
,
indices
);
DxSearchUtil
.
buildQueryResult
(
o
,
partList
,
searchQueryCondition
);
}
resultMap
.
put
(
"totalSize"
,
queryResult
.
getTotalSize
());
resultMap
.
put
(
"result"
,
partList
);
...
...
src/com/yonde/baseline/controller/DxBaselineController.java
View file @
21fa7752
...
...
@@ -7,13 +7,13 @@ import com.yonde.basedata.vo.RevisionControlledVO;
import
com.yonde.baseline.service.DxBaselineService
;
import
com.yonde.baseline.vo.DxBaselineVO
;
import
com.yonde.common.ObjectsUtil
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Map
;
@RestController
@RequestMapping
({
"/DxBaseline"
})
public
class
DxBaselineController
extends
AbstractBaseController
{
//@ApiOperation("获取基线成员矩阵")
...
...
@@ -32,18 +32,33 @@ public class DxBaselineController extends AbstractBaseController {
//@ApiOperation("基线冻结")
@PostMapping
({
"/frozen/{id}"
})
public
ApiResult
frozen
(
@PathVariable
(
"id"
)
Long
id
)
{
public
ApiResult
frozen
(
@PathVariable
(
"id"
)
Long
id
,
HttpServletRequest
request
)
{
//return ApiResult.ok(this.service.frozen(id));
return
null
;
String
portUserName
=
request
.
getHeader
(
"portUserName"
);
DxBaselineVO
frozen
=
null
;
try
{
frozen
=
DxBaselineService
.
frozen
(
id
,
portUserName
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ApiResult
.
error
(
"501"
,
e
.
getCause
().
getLocalizedMessage
(),
e
);
}
return
ApiResult
.
ok
(
frozen
);
}
//@ApiOperation("基线解冻")
@PostMapping
({
"/unFrozen/{id}"
})
public
ApiResult
unFrozen
(
@PathVariable
(
"id"
)
Long
id
)
{
public
ApiResult
unFrozen
(
@PathVariable
(
"id"
)
Long
id
,
HttpServletRequest
request
)
{
//return ApiResult.ok(this.service.unFrozen(id));
return
null
;
String
portUserName
=
request
.
getHeader
(
"portUserName"
);
DxBaselineVO
frozen
=
null
;
try
{
frozen
=
DxBaselineService
.
unFrozen
(
id
,
portUserName
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ApiResult
.
error
(
"501"
,
e
.
getCause
().
getLocalizedMessage
(),
e
);
}
return
ApiResult
.
ok
(
frozen
);
}
//保存基线
@PostMapping
({
"recursion"
})
...
...
src/com/yonde/baseline/service/DxBaselineService.java
View file @
21fa7752
...
...
@@ -4,34 +4,30 @@ import com.yonde.baseline.vo.DxBaselineMemberVO;
import
com.yonde.baseline.vo.DxBaselineVO
;
import
com.yonde.common.*
;
import
com.yonde.context.vo.DxContextVO
;
import
com.yonde.doc.vo.DxDocumentVO
;
import
com.yonde.part.vo.DxPartVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
wt.doc.WTDocument
;
import
wt.epm.EPMDocument
;
import
org.apache.log4j.Logger
;
import
wt.fc.IdentityHelper
;
import
wt.fc.Persistable
;
import
wt.fc.QueryResult
;
import
wt.fc.PersistenceHelper
;
import
wt.fc.WTObject
;
import
wt.fc.collections.WTCollection
;
import
wt.fc.collections.WTHashSet
;
import
wt.inf.container.WTContainer
;
import
wt.locks.LockHelper
;
import
wt.log4j.LogR
;
import
wt.method.RemoteAccess
;
import
wt.method.RemoteMethodServer
;
import
wt.part.WTPart
;
import
wt.pom.Transaction
;
import
wt.session.SessionServerHelper
;
import
wt.util.WTException
;
import
wt.vc.baseline.BaselineHelper
;
import
wt.vc.baseline.Baselineable
;
import
wt.vc.baseline.ManagedBaseline
;
import
wt.vc.baseline.ManagedBaselineIdentity
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Vector
;
public
class
DxBaselineService
implements
RemoteAccess
{
private
static
final
Logger
log
=
LogR
.
getLogger
(
DxBaselineService
.
class
.
getName
());
public
static
DxBaselineVO
createBaseline
(
DxBaselineVO
baselineVO
,
String
userName
)
throws
Exception
{
if
(!
RemoteMethodServer
.
ServerFlag
)
{
return
(
DxBaselineVO
)
RemoteMethodServer
.
getDefault
().
invoke
(
"createBaseline"
,
DxBaselineService
.
class
.
getName
(),
null
,
...
...
@@ -70,7 +66,7 @@ public class DxBaselineService implements RemoteAccess {
if
(
ObjectsUtil
.
nonNull
(
baselineVO
.
getDynamicAttrs
()))
{
IBAUtil
.
forceSetIBAValues
(
baseline
,
baselineVO
.
getDynamicAttrs
());
}
dxBaselineVO
=
new
DxBaselineVO
(
baseline
);
dxBaselineVO
=
new
DxBaselineVO
(
baseline
,
false
);
ts
.
commit
();
ts
=
null
;
}
finally
{
...
...
@@ -109,19 +105,21 @@ public class DxBaselineService implements RemoteAccess {
ManagedBaselineIdentity
identificationObject
=
(
ManagedBaselineIdentity
)
baseline
.
getIdentificationObject
();
identificationObject
.
setName
(
baselineVO
.
getName
());
IdentityHelper
.
service
.
changeIdentity
(
baseline
,
identificationObject
);
// 重命名名称
dxBaselineVO
=
new
DxBaselineVO
(
baseline
);
dxBaselineVO
=
new
DxBaselineVO
(
baseline
,
false
);
//更新基线对象
QueryResult
items
=
BaselineHelper
.
service
.
getBaselineItems
(
baseline
);
/*
QueryResult items = BaselineHelper.service.getBaselineItems(baseline);
Vector vector = items.getObjectVector().getVector();
//删除基线对象
BaselineHelper
.
service
.
removeFromBaseline
(
vector
,
baseline
);
BaselineHelper.service.removeFromBaseline(vector,baseline);*/
List
<
DxBaselineMemberVO
>
baselineMembers
=
baselineVO
.
getBaselineMembers
();
if
(
CollectionUtils
.
isNotEmpty
(
baselineMembers
))
{
WTCollection
collectDocuments
=
new
WTHashSet
();
for
(
DxBaselineMemberVO
member
:
baselineMembers
)
{
Long
id
=
member
.
getTarget
().
getId
();
WTObject
wtObjectById
=
RfUtil
.
getWTObjectById
(
id
);
if
(
"REMOVE"
.
equalsIgnoreCase
(
member
.
getOperator
()))
{
BaselineHelper
.
service
.
removeFromBaseline
((
Baselineable
)
wtObjectById
,
baseline
);
continue
;
}
collectDocuments
.
add
(
wtObjectById
);
}
BaselineHelper
.
service
.
addToBaseline
(
collectDocuments
,
baseline
);
...
...
@@ -141,7 +139,35 @@ public class DxBaselineService implements RemoteAccess {
return
dxBaselineVO
;
}
public
static
void
buildDxBaselineMembers
(
DxBaselineVO
baselineVO
)
throws
Exception
{
public
static
DxBaselineVO
frozen
(
Long
id
,
String
userName
)
throws
Exception
{
if
(!
RemoteMethodServer
.
ServerFlag
)
{
return
(
DxBaselineVO
)
RemoteMethodServer
.
getDefault
().
invoke
(
"frozen"
,
DxBaselineService
.
class
.
getName
(),
null
,
new
Class
[]
{
Long
.
class
,
String
.
class
},
new
Object
[]
{
id
,
userName
});
}
CommonUtil
.
initSessionContext
(
userName
);
ManagedBaseline
baseline
=
(
ManagedBaseline
)
RfUtil
.
getWTObjectById
(
id
);
baseline
=
(
ManagedBaseline
)
LockHelper
.
assignLock
(
baseline
,
null
,
"后台锁定"
);
baseline
=
(
ManagedBaseline
)
PersistenceHelper
.
manager
.
save
(
baseline
);
DxBaselineVO
dxBaselineVO
=
new
DxBaselineVO
(
baseline
,
false
);
return
dxBaselineVO
;
}
public
static
DxBaselineVO
unFrozen
(
Long
id
,
String
userName
)
throws
Exception
{
if
(!
RemoteMethodServer
.
ServerFlag
)
{
return
(
DxBaselineVO
)
RemoteMethodServer
.
getDefault
().
invoke
(
"unFrozen"
,
DxBaselineService
.
class
.
getName
(),
null
,
new
Class
[]
{
Long
.
class
,
String
.
class
},
new
Object
[]
{
id
,
userName
});
}
CommonUtil
.
initSessionContext
(
userName
);
ManagedBaseline
baseline
=
(
ManagedBaseline
)
RfUtil
.
getWTObjectById
(
id
);
baseline
=
(
ManagedBaseline
)
LockHelper
.
releaseLock
(
baseline
);
baseline
=
(
ManagedBaseline
)
PersistenceHelper
.
manager
.
save
(
baseline
);
DxBaselineVO
dxBaselineVO
=
new
DxBaselineVO
(
baseline
,
false
);
return
dxBaselineVO
;
}
/* public static void buildDxBaselineMembers(DxBaselineVO baselineVO) throws Exception {
Long id = baselineVO.getId();
WTObject wtObjectById = RfUtil.getWTObjectById(id);
if (ObjectsUtil.nonNull(wtObjectById)) {
...
...
@@ -149,12 +175,13 @@ public class DxBaselineService implements RemoteAccess {
DxBaselineVO dxBaselineVO = buildDxBaseline(baseline);
baselineVO.setBaselineMembers(dxBaselineVO.getBaselineMembers());
}
}
}
*/
public
static
DxBaselineVO
buildDxBaseline
(
ManagedBaseline
baseline
)
throws
Exception
{
DxBaselineVO
dxBaselineVO
=
new
DxBaselineVO
(
baseline
);
/*
public static DxBaselineVO buildDxBaseline(ManagedBaseline baseline) throws Exception {
DxBaselineVO dxBaselineVO = new DxBaselineVO(baseline
, false
);
QueryResult baselineItems = BaselineHelper.service.getBaselineItems(baseline);
List<DxBaselineMemberVO> memberVOList = new ArrayList<DxBaselineMemberVO>();
log.error("===buildDxBaseline 1 ===" + baselineItems.size());
while (baselineItems.hasMoreElements()) {
Persistable obj = (Persistable) baselineItems.nextElement();
if (obj instanceof WTPart) {
...
...
@@ -173,7 +200,8 @@ public class DxBaselineService implements RemoteAccess {
//TODO
}
}
log.error("===buildDxBaseline===" + memberVOList.size());
dxBaselineVO.setBaselineMembers(memberVOList);
return dxBaselineVO;
}
}
*/
}
src/com/yonde/baseline/vo/DxBaselineMemberVO.java
View file @
21fa7752
...
...
@@ -5,34 +5,40 @@ import com.yonde.basedata.vo.RevisionControlledVO;
import
java.io.Serializable
;
public
class
DxBaselineMemberVO
implements
Serializable
{
private
DxBaselineVO
source
;
private
Long
id
;
private
RevisionControlledVO
target
;
private
Long
sourceId
;
private
String
sourceIdType
;
private
Long
targetId
;
private
String
targetIdType
;
private
String
operator
;
public
DxBaselineMemberVO
()
{
}
public
DxBaselineMemberVO
(
DxBaselineVO
source
,
RevisionControlledVO
target
)
{
this
.
source
=
source
;
this
.
sourceId
=
source
.
getId
();
this
.
sourceIdType
=
source
.
getSubTypeName
();
this
.
target
=
target
;
this
.
targetId
=
target
.
getId
();
this
.
targetIdType
=
target
.
getSubTypeName
();
this
.
id
=
targetId
;
}
public
String
getOperator
()
{
return
operator
;
}
public
void
setOperator
(
String
operator
)
{
this
.
operator
=
operator
;
}
public
DxBaselineVO
getSource
()
{
return
source
;
public
Long
getId
()
{
return
id
;
}
public
void
set
Source
(
DxBaselineVO
source
)
{
this
.
source
=
source
;
public
void
set
Id
(
Long
id
)
{
this
.
id
=
id
;
}
public
RevisionControlledVO
getTarget
()
{
...
...
src/com/yonde/baseline/vo/DxBaselineVO.java
View file @
21fa7752
...
...
@@ -6,14 +6,24 @@ import com.yonde.basedata.vo.IdVO;
import
com.yonde.common.IBAHelper
;
import
com.yonde.common.ObjectsUtil
;
import
com.yonde.context.vo.DxContextVO
;
import
com.yonde.doc.vo.DxDocumentVO
;
import
com.yonde.part.vo.DxPartVO
;
import
wt.doc.WTDocument
;
import
wt.epm.EPMDocument
;
import
wt.fc.Persistable
;
import
wt.fc.QueryResult
;
import
wt.locks.LockHelper
;
import
wt.org.WTOrganization
;
import
wt.part.WTPart
;
import
wt.type.ClientTypedUtility
;
import
wt.util.WTException
;
import
wt.vc.baseline.BaselineHelper
;
import
wt.vc.baseline.ManagedBaseline
;
import
java.io.Serializable
;
import
java.lang.reflect.InvocationTargetException
;
import
java.rmi.RemoteException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
...
...
@@ -31,15 +41,17 @@ public class DxBaselineVO extends IdVO implements Serializable {
private
DxOrganizationVO
dxOrganization
;
private
Long
dxOrganizationId
;
private
String
dxOrganizationIdType
;
private
Long
masterId
;
public
DxBaselineVO
()
{
}
public
DxBaselineVO
(
ManagedBaseline
baseline
)
throws
WTException
,
RemoteException
,
InvocationTarget
Exception
{
public
DxBaselineVO
(
ManagedBaseline
baseline
,
boolean
needMembers
)
throws
Exception
{
super
(
baseline
);
this
.
versionId
=
this
.
id
;
this
.
masterId
=
this
.
id
;
this
.
state
=
baseline
.
getState
().
getState
().
toString
();
this
.
frozenState
=
baseline
.
isDirty
(
);
this
.
frozenState
=
LockHelper
.
isLocked
(
baseline
);
this
.
name
=
baseline
.
getName
();
this
.
number
=
baseline
.
getNumber
();
// 获取基线对象
...
...
@@ -53,6 +65,29 @@ public class DxBaselineVO extends IdVO implements Serializable {
this
.
dynamicAttrs
=
IBAHelper
.
getAllIBAValues
(
baseline
);
this
.
subTypeName
=
"DxBaseline"
;
//TODO 要映射
this
.
subTypeDisplayName
=
ClientTypedUtility
.
getLocalizedTypeName
(
baseline
,
Locale
.
SIMPLIFIED_CHINESE
);
if
(
needMembers
)
{
QueryResult
baselineItems
=
BaselineHelper
.
service
.
getBaselineItems
(
baseline
);
List
<
DxBaselineMemberVO
>
memberVOList
=
new
ArrayList
<
DxBaselineMemberVO
>();
while
(
baselineItems
.
hasMoreElements
())
{
Persistable
obj
=
(
Persistable
)
baselineItems
.
nextElement
();
if
(
obj
instanceof
WTPart
)
{
DxPartVO
dxPartVO
=
new
DxPartVO
((
WTPart
)
obj
);
DxBaselineMemberVO
memberVO
=
new
DxBaselineMemberVO
(
this
,
dxPartVO
);
memberVOList
.
add
(
memberVO
);
continue
;
}
if
(
obj
instanceof
WTDocument
)
{
DxDocumentVO
dxDocumentVO
=
new
DxDocumentVO
((
WTDocument
)
obj
);
DxBaselineMemberVO
memberVO
=
new
DxBaselineMemberVO
(
this
,
dxDocumentVO
);
memberVOList
.
add
(
memberVO
);
continue
;
}
if
(
obj
instanceof
EPMDocument
)
{
//TODO
}
}
this
.
setBaselineMembers
(
memberVOList
);
}
}
public
List
<
DxBaselineMemberVO
>
getBaselineMembers
()
{
...
...
@@ -63,6 +98,14 @@ public class DxBaselineVO extends IdVO implements Serializable {
this
.
baselineMembers
=
baselineMembers
;
}
public
Long
getMasterId
()
{
return
masterId
;
}
public
void
setMasterId
(
Long
masterId
)
{
this
.
masterId
=
masterId
;
}
public
Boolean
getFrozenState
()
{
return
frozenState
;
}
...
...
src/com/yonde/common/BaseLineUtil.java
View file @
21fa7752
package
com
.
yonde
.
common
;
import
com.yonde.contants.Global
;
import
wt.fc.IdentityHelper
;
import
wt.fc.PersistenceHelper
;
import
wt.folder.Folder
;
...
...
@@ -50,7 +51,7 @@ public class BaseLineUtil {
if
(
ObjectsUtil
.
isNull
(
baselineType
))
{
baselineType
=
"wt.vc.baseline.ManagedBaseline"
;
}
else
{
baselineType
=
CommonUtil
.
buildTypeKey
(
Global
.
PMD_DOMAIN
,
baselineType
,
ManagedBaseline
.
class
);
}
TypeDefinitionReference
typeDef
=
TypedUtility
.
getTypeDefinitionReference
(
baselineType
);
if
(
typeDef
==
null
)
throw
new
WTException
(
"没有此类型:"
+
baselineType
);
...
...
src/com/yonde/common/CommonUtil.java
View file @
21fa7752
...
...
@@ -838,4 +838,12 @@ public class CommonUtil implements RemoteAccess {
}
return
folder
;
}
public
static
String
buildTypeKey
(
String
domain
,
String
key
,
Class
<?
extends
WTObject
>
cls
)
{
String
typeName
=
cls
.
getName
()
+
"|"
+
key
;
if
(
StringUtils
.
isNotEmpty
(
domain
))
{
typeName
=
cls
.
getName
()
+
"|"
+
domain
+
"."
+
key
;
}
return
typeName
;
}
}
src/com/yonde/common/DocUtil.java
View file @
21fa7752
...
...
@@ -1045,7 +1045,9 @@ public class DocUtil implements RemoteAccess, Serializable {
AttributeDefDefaultView
addv
=
IBADefinitionHelper
.
service
.
getAttributeDefDefaultViewByPath
(
ibaName
);
if
(
addv
==
null
)
{
throw
new
IBADefinitionException
(
"No IBA Definition:"
+
ibaName
);
logger
.
error
(
"No IBA Definition:"
+
ibaName
);
//throw new IBADefinitionException("No IBA Definition:" + ibaName);
return
null
;
}
long
ibaDefId
=
addv
.
getObjectID
().
getId
();
QuerySpec
qs
=
new
QuerySpec
();
...
...
src/com/yonde/common/DxSearchUtil.java
View file @
21fa7752
package
com
.
yonde
.
common
;
import
com.yonde.basedata.data.DxPageImpl
;
import
com.yonde.basedata.search.SearchItem
;
import
com.yonde.basedata.search.SearchItems
;
import
com.yonde.basedata.search.SearchOperatorEnumUtil
;
import
com.yonde.basedata.search.SearchQueryCondition
;
import
com.yonde.baseline.service.DxBaselineService
;
import
com.yonde.baseline.vo.DxBaselineVO
;
import
com.yonde.change.service.DXChangeOrderService
;
import
com.yonde.change.vo.ecn.DxChangeNoticeVo
;
import
com.yonde.change.vo.ecr.DxChangeRequestVo
;
import
com.yonde.change.vo.pr.DxProblemReportVo
;
import
com.yonde.contants.Global
;
import
com.yonde.doc.vo.DxDocumentVO
;
import
com.yonde.part.vo.DxPartVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageRequest
;
import
wt.change2.WTChangeIssue
;
import
wt.change2.WTChangeOrder2
;
import
wt.change2.WTChangeRequest2
;
import
wt.doc.WTDocument
;
import
wt.fc.*
;
import
wt.folder.Folder
;
import
wt.folder.Foldered
;
import
wt.inf.container.WTContained
;
import
wt.inf.container.WTContainer
;
import
wt.log4j.LogR
;
import
wt.method.RemoteAccess
;
import
wt.method.RemoteMethodServer
;
import
wt.part.WTPart
;
import
wt.pds.StatementSpec
;
import
wt.query.*
;
import
wt.session.SessionServerHelper
;
import
wt.type.TypeDefinitionForeignKey
;
import
wt.type.TypeDefinitionReference
;
import
wt.type.TypedUtility
;
import
wt.util.WTAttributeNameIfc
;
import
wt.util.WTException
;
import
wt.vc.Iterated
;
...
...
@@ -41,7 +43,6 @@ import wt.vc.wip.WorkInProgressState;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -49,39 +50,6 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
private
static
Logger
logger
=
LogR
.
getLogger
(
DxSearchUtil
.
class
.
getName
());
private
static
final
long
serialVersionUID
=
1L
;
@Deprecated
public
static
DxPageImpl
findByConfigSpec
(
SearchQueryCondition
searchQueryCondition
)
throws
Exception
{
if
(!
RemoteMethodServer
.
ServerFlag
)
{
return
(
DxPageImpl
)
RemoteMethodServer
.
getDefault
().
invoke
(
"findByConfigSpecSelect"
,
DxSearchUtil
.
class
.
getName
(),
null
,
new
Class
[]
{
SearchQueryCondition
.
class
},
new
Object
[]
{
searchQueryCondition
});
}
logger
.
error
(
"searchCondition===111"
+
searchQueryCondition
.
toString
());
boolean
enforce
=
SessionServerHelper
.
manager
.
setAccessEnforced
(
false
);
List
partList
;
List
<
String
>
indices
=
searchQueryCondition
.
getIndices
();
try
{
SearchItems
searchItems
=
searchQueryCondition
.
getSearchItems
();
if
(
ObjectsUtil
.
isNull
(
searchItems
))
{
searchItems
=
searchQueryCondition
.
getSearchVersion
().
getSearchItems
();
}
QuerySpec
querySpec
=
DxSearchUtil
.
buildQuerySpec
(
searchItems
,
WTPart
.
class
);
QueryResult
qr
=
PersistenceHelper
.
manager
.
find
((
StatementSpec
)
querySpec
);
partList
=
new
ArrayList
<
DxPartVO
>();
while
(
qr
.
hasMoreElements
())
{
WTObject
o
=
(
WTObject
)
qr
.
nextElement
();
if
(
o
instanceof
WTPart
)
{
buildQueryResult
(
o
,
partList
,
indices
);
}
}
}
finally
{
SessionServerHelper
.
manager
.
setAccessEnforced
(
enforce
);
}
long
total
=
CollectionUtils
.
size
(
partList
);
PageImpl
ts
=
new
PageImpl
(
partList
,
new
PageRequest
(
searchQueryCondition
.
getPageFrom
(),
searchQueryCondition
.
getPageSize
()),
total
);
return
DxPageImpl
.
fromPage
(
ts
);
}
/**
* 通用查询接口
* @param searchQueryCondition
...
...
@@ -92,9 +60,9 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
CommonUtil
.
initSessionContext
(
null
);
boolean
enforce
=
SessionServerHelper
.
manager
.
setAccessEnforced
(
false
);
List
<
String
>
indices
=
searchQueryCondition
.
getIndices
();
Class
cls
=
WTPart
.
class
;
if
(
StringUtils
.
isNotEmpty
(
searchQueryCondition
.
getName
()
))
{
cls
=
SearchOperatorEnumUtil
.
typeMap
.
get
(
searchQueryCondition
.
getName
()
);
Class
cls
=
SearchOperatorEnumUtil
.
typeMap
.
get
(
searchQueryCondition
.
getName
())
;
if
(
ObjectsUtil
.
isNull
(
cls
))
{
throw
new
WTException
(
"搜索类型不存在!"
);
}
try
{
//合并查询条件
...
...
@@ -137,7 +105,7 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
bpqs
.
setPrimaryStatement
(
querySpec
);
logger
.
error
(
"pageFrom===="
+
pageFrom
*
pageSize
);
logger
.
error
(
"pageSize===="
+
pageSize
);
bpqs
.
setOffset
(
pageFrom
*
pageSize
);
bpqs
.
setOffset
(
pageFrom
*
pageSize
);
bpqs
.
setRange
(
pageSize
);
bpqs
.
setBackgroundThreadEnabled
(
false
);
bpqs
.
setLimitModeEnabled
(
true
);
...
...
@@ -152,10 +120,10 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
* 生成反馈结果
* @param o
* @param objList
* @param
indices
* @param
searchQueryCondition
* @throws Exception
*/
public
static
void
buildQueryResult
(
WTObject
o
,
List
objList
,
List
<
String
>
indices
)
throws
Exception
{
public
static
void
buildQueryResult
(
WTObject
o
,
List
objList
,
SearchQueryCondition
searchQueryCondition
)
throws
Exception
{
long
id
=
PersistenceHelper
.
getObjectIdentifier
(
o
).
getId
();
if
(
o
instanceof
WTPart
)
{
WTPart
wtPart
=
(
WTPart
)
o
;
...
...
@@ -172,7 +140,15 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
if
(
o
instanceof
ManagedBaseline
)
{
//基线
ManagedBaseline
baseline
=
(
ManagedBaseline
)
o
;
DxBaselineVO
baselineVO
=
DxBaselineService
.
buildDxBaseline
(
baseline
);
boolean
needMember
=
false
;
List
<
SearchQueryCondition
>
openProps
=
searchQueryCondition
.
getOpenProps
();
if
(
CollectionUtils
.
isNotEmpty
(
openProps
))
{
SearchQueryCondition
condition
=
openProps
.
get
(
0
);
if
(
"baselineMembers"
.
equalsIgnoreCase
(
condition
.
getName
()))
{
needMember
=
true
;
}
}
DxBaselineVO
baselineVO
=
new
DxBaselineVO
(
baseline
,
needMember
);
objList
.
add
(
baselineVO
);
return
;
}
...
...
@@ -251,13 +227,45 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
for
(
SearchItem
item
:
items
)
{
logger
.
error
(
"item===111"
+
item
.
toString
());
String
fieldName
=
item
.
fieldName
;
/* if (fieldName.equals("masterId")) {
return null;
}*/
// TODO fieldName.equals(SearchOperatorEnumUtil.DX_ID)||latest
if
(
fieldName
.
equals
(
"checkOuted"
)
||
fieldName
.
equals
(
"creatorId"
)||
fieldName
.
equals
(
"latest"
))
{
continue
;
}
//子类型
if
(
fieldName
.
equals
(
SearchOperatorEnumUtil
.
DX_SUBTYPE_NAME
))
{
// TODO 域名待确认
String
typeName
=
CommonUtil
.
buildTypeKey
(
Global
.
PMD_DOMAIN
,
(
String
)
item
.
value
,
clazz
);
TypeDefinitionReference
tdr
=
TypedUtility
.
getTypeDefinitionReference
(
typeName
);
if
(
ObjectsUtil
.
nonNull
(
tdr
))
{
addQuerySpecOp
(
querySpec
,
operator
);
SearchCondition
typeDefinitionCondition
=
new
SearchCondition
(
WTDocument
.
class
,
WTDocument
.
TYPE_DEFINITION_REFERENCE
+
"."
+
TypeDefinitionReference
.
KEY
+
"."
+
TypeDefinitionForeignKey
.
BRANCH_ID
,
SearchCondition
.
EQUAL
,
tdr
.
getKey
().
getBranchId
());
querySpec
.
appendWhere
(
typeDefinitionCondition
,
new
int
[]{
0
});
}
continue
;
}
//TODO 产品 存储库
if
(
fieldName
.
equals
(
SearchOperatorEnumUtil
.
DX_CONTEXT_NAME
))
{
WTContainer
container
=
ContainerUtil
.
getContainerByName
((
String
)
item
.
value
);
if
(
container
!=
null
)
{
addQuerySpecOp
(
querySpec
,
operator
);
SearchCondition
sc
=
new
SearchCondition
(
WTContained
.
class
,
WTContained
.
CONTAINER_ID
,
SearchCondition
.
EQUAL
,
PersistenceHelper
.
getObjectIdentifier
(
container
).
getId
());
querySpec
.
appendWhere
(
sc
,
new
int
[]{
0
});
}
continue
;
}
//TODO 文件夹
if
(
fieldName
.
equals
(
SearchOperatorEnumUtil
.
DX_FOLDER_ID
))
{
Folder
folderByOid
=
(
Folder
)
RfUtil
.
getWTObjectByOid
(
"OR:wt.folder.SubFolder:"
+
item
.
value
);
if
(
ObjectsUtil
.
nonNull
(
folderByOid
))
{
addQuerySpecOp
(
querySpec
,
operator
);
SearchCondition
sc
=
new
SearchCondition
(
clazz
,
Foldered
.
FOLDERING_INFO
+
"."
+
WTAttributeNameIfc
.
REF_OBJECT_ID
,
SearchCondition
.
EQUAL
,
PersistenceHelper
.
getObjectIdentifier
(
folderByOid
).
getId
());
querySpec
.
appendWhere
(
sc
,
new
int
[]{
0
});
}
continue
;
}
//视图
if
(
fieldName
.
equals
(
SearchOperatorEnumUtil
.
DX_VIEWID
))
{
String
viewName
=
SearchOperatorEnumUtil
.
viewMap
.
get
(
String
.
valueOf
(
item
.
value
));
...
...
@@ -288,13 +296,16 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
continue
;
}
// 软属性子查询
addQuerySpecOp
(
querySpec
,
operator
);
SubSelectExpression
subSelect
=
DocUtil
.
getStringIBAQuery
(
fieldName
,
String
.
valueOf
(
item
.
value
),
"B"
);
if
(
ObjectsUtil
.
nonNull
(
subSelect
))
{
addQuerySpecOp
(
querySpec
,
operator
);
SearchCondition
sc
=
new
SearchCondition
(
new
ClassAttribute
(
clazz
,
Persistable
.
PERSIST_INFO
+
"."
+
PersistInfo
.
OBJECT_IDENTIFIER
+
"."
+
ObjectIdentifier
.
ID
),
SearchCondition
.
IN
,
subSelect
);
querySpec
.
appendWhere
(
sc
,
new
int
[]{
0
});
}
}
}
/**
...
...
src/com/yonde/contants/Global.java
0 → 100644
View file @
21fa7752
package
com
.
yonde
.
contants
;
public
interface
Global
{
String
PMD_DOMAIN
=
"com.yonde"
;
}
src/com/yonde/context/uitls/ContainerUtil.java
0 → 100644
View file @
21fa7752
package
com
.
yonde
.
context
.
uitls
;
import
com.yonde.common.RfUtil
;
import
wt.fc.Persistable
;
import
wt.fc.PersistenceHelper
;
import
wt.fc.QueryResult
;
import
wt.folder.Cabinet
;
import
wt.folder.Folder
;
import
wt.folder.FolderHelper
;
import
wt.inf.container.WTContainer
;
import
wt.inf.library.WTLibrary
;
import
wt.method.RemoteAccess
;
import
wt.method.RemoteMethodServer
;
import
wt.pdmlink.PDMLinkProduct
;
import
wt.query.QuerySpec
;
import
wt.query.SearchCondition
;
import
wt.session.SessionServerHelper
;
import
wt.util.WTException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
public
class
ContainerUtil
implements
RemoteAccess
{
private
static
String
CLASSNAME
=
ContainerUtil
.
class
.
getName
();
public
static
WTContainer
getContainerByName
(
String
containerName
)
throws
WTException
{
if
(!
RemoteMethodServer
.
ServerFlag
)
{
try
{
return
(
WTContainer
)
RemoteMethodServer
.
getDefault
().
invoke
(
"getContainerByName"
,
CLASSNAME
,
null
,
new
Class
[]{
String
.
class
},
new
Object
[]{
containerName
});
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
WTException
(
e
,
e
.
getLocalizedMessage
());
}
}
else
{
boolean
access
=
SessionServerHelper
.
manager
.
setAccessEnforced
(
false
);
try
{
QuerySpec
qs
=
new
QuerySpec
(
WTContainer
.
class
);
SearchCondition
sc
=
new
SearchCondition
(
WTContainer
.
class
,
WTContainer
.
NAME
,
SearchCondition
.
EQUAL
,
containerName
);
qs
.
appendSearchCondition
(
sc
);
QueryResult
qr
=
PersistenceHelper
.
manager
.
find
(
qs
);
if
(
qr
.
hasMoreElements
())
{
return
(
WTContainer
)
qr
.
nextElement
();
}
return
null
;
}
finally
{
SessionServerHelper
.
manager
.
setAccessEnforced
(
access
);
}
}
}
public
List
<
Folder
>
getAllSubFolder
(
Folder
parentFolder
)
throws
WTException
{
List
<
Folder
>
resultList
=
new
ArrayList
<
Folder
>();
QueryResult
result
=
FolderHelper
.
service
.
findSubFolders
(
parentFolder
);
while
(
result
.
hasMoreElements
())
{
Folder
subFolder
=
(
Folder
)
result
.
nextElement
();
resultList
.
add
(
subFolder
);
//ProFolder node = toEntity((WTObject) subFolder, ProFolder.class);
/* if (node != null) {
if (parentFolder != null) {
node.setSuperior(
String.valueOf(parentFolder.getPersistInfo().getObjectIdentifier().getId()));
}
treeNodes.add(node);
treeNodeDocs.add(subFolder);
}
getAllsubFolder(treeNodes, treeNodeDocs, subFolder);*/
}
return
resultList
;
}
public
Map
<
String
,
Object
>
getProjectFolderByFilter
(
String
productOid
,
String
type
)
throws
Exception
{
//根文件夹
Cabinet
cabinet
=
null
;
Persistable
container
=
RfUtil
.
getWTObjectByOid
(
productOid
);
if
(
container
instanceof
PDMLinkProduct
)
{
cabinet
=
((
PDMLinkProduct
)
container
).
getDefaultCabinet
();
}
else
if
(
container
instanceof
WTLibrary
)
{
cabinet
=
((
WTLibrary
)
container
).
getDefaultCabinet
();
}
else
{
System
.
err
.
println
(
"==> treeNodeDocs container : "
+
container
);
}
if
(
cabinet
==
null
)
{
return
null
;
}
List
<
Folder
>
allSubFolder
=
getAllSubFolder
(
cabinet
);
return
null
;
}
}
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