提交 194e33c5 编写于 作者: L luojing

teamwok扩展属性服务

上级 f6d5a5a2
......@@ -69,7 +69,7 @@ public class CustomExtFieldReleFactory extends AbstractFactory {
}
/**
* 根据关联ID列示扩展属性ID信息列表
* 根据关联ID列示扩展属性信息列表
* @param correlationId
* @return
* @throws Exception
......@@ -86,6 +86,24 @@ public class CustomExtFieldReleFactory extends AbstractFactory {
return em.createQuery(cq.where(p)).getResultList();
}
/**
* 根据扩展属性类型列示扩展属性信息列表
* @param type
* @return
* @throws Exception
*/
public List<CustomExtFieldRele> listFieldReleObjByType( String type ) throws Exception {
if( StringUtils.isEmpty( type ) ){
throw new Exception("type can not be empty!");
}
EntityManager em = this.entityManagerContainer().get(CustomExtFieldRele.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<CustomExtFieldRele> cq = cb.createQuery(CustomExtFieldRele.class);
Root<CustomExtFieldRele> root = cq.from(CustomExtFieldRele.class);
Predicate p = cb.equal( root.get(CustomExtFieldRele_.type), type );
return em.createQuery(cq.where(p)).getResultList();
}
/**
* 根据关联ID列示扩展属性ID信息列表
* @param correlationId
......
......@@ -94,7 +94,7 @@ public class CustomExtFieldReleAction extends StandardJaxrsAction {
@Path("list/{correlationId}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listFieldsWithProject(@Suspended final AsyncResponse asyncResponse,
public void listFieldsWithCorrelation(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request,
@JaxrsParameterDescribe("关联ID") @PathParam("correlationId") String correlationId ) {
ActionResult<List<ActionListWithCorrelation.Wo>> result = new ActionResult<>();
......@@ -108,6 +108,25 @@ public class CustomExtFieldReleAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "根据扩展属性类型查询扩展属性信息列表.", action = ActionListWithType.class)
@GET
@Path("listPublicFields/{type}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listFieldsWithType(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request,
@JaxrsParameterDescribe("扩展属性类型") @PathParam("type") String type ) {
ActionResult<List<ActionListWithType.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListWithType().execute( request, effectivePerson, type );
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "创建或者更新一个扩展属性关联信息.", action = ActionSave.class)
@POST
@Path("relevance")
......
......@@ -65,6 +65,23 @@ public class CustomExtFieldReleQueryService {
throw e;
}
}
/**
* 根据扩展属性类型查询扩展属性关联信息
* @param type
* @return
* @throws Exception
*/
public List<CustomExtFieldRele> listReleWithType( String type ) throws Exception {
if (StringUtils.isEmpty(type)) {
return new ArrayList<>();
}
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
return customExtFieldReleService.listReleWithType(emc, type);
} catch (Exception e) {
throw e;
}
}
public String getExtFieldDisplayName(String projectId, String extFieldName) throws Exception {
if( StringUtils.isEmpty( projectId ) ){
......
......@@ -51,6 +51,18 @@ class CustomExtFieldReleService {
}
}
/**
* 根据扩展属性类型查询扩展属性关联信息
* @param emc
* @param type
* @return
* @throws Exception
*/
protected List<CustomExtFieldRele> listReleWithType(EntityManagerContainer emc, String type ) throws Exception {
Business business = new Business( emc );
return business.customExtFieldReleFactory().listFieldReleObjByType( type );
}
/**
* 根据扩展属性ID删除项目扩展属性信息
* @param emc
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册