Open jinyoung opened 6 years ago
instance 에 대한 role mapping, process variable 값의 변경을 위한 백엔드 API 설계
http://localhost:8080/instance/{instId}/role-mapping/{roleName}
http://localhost:8080/instance/{instId}/process-variable/{variableName}
으로 REST 로 접근하여 값을 CRUD 함.
HumanActivity 에서 role 에 대한 실제 mapping 을 얻는 코드
protected void addWorkitem(ProcessInstance instance, String defaultStatus) throws Exception {
RoleMapping roleMapping = null;
try {
roleMapping = this.getActualMapping(instance);
} catch (Exception var13) {
throw var13;
}
...
}
이고,
public RoleMapping getActualMapping(ProcessInstance instance) throws Exception {
roleMapping = this.getRole().getMapping(instance, this.getTracingTag());
...
return roleMapping;
}
임.
Role.getRoleMapping(instance) 을 열어보면 결국,
mapping = inst.getRoleMapping(this.getName());
으로 얻어옴. 따라서, roleMapping 을 만들어줘야 하는 책임은,
JPAProcessInstance.java 의 getRoleMapping()
에서 해줘야 하는데, 이놈은 extends DefaultProcessInstance 에서 변수 값에 들어있는 패턴으로 roleMapping을 그냥 가져오고 있음...
public RoleMapping getRoleMapping(String roleName) throws Exception{
try{
Object val = get("", "_roleMapping_of_" + roleName);
//System.out.println("EJBActivityInstance::getRoleMapping.class = " + val.getClass());
if(val != null && val instanceof RoleMapping)
return (RoleMapping)val;
else
return null;
}catch(Exception e){
e.printStackTrace();
}
return null;
}
따라서,
http://localhost:8080/instances/{instId}/role-mappings/{roleName} 서비스는, PUT 에 의하여, 해당 JPAProcessInstance.putRoleMapping(...) 메서드를 호출하는 backend 구현이 이루어져야 함:
예제코드
@RestController public class RoleMappingService {
@Autowired
DefinitionService definitionService;
@Autowired
WorklistRepository worklistRepository;
// ---------------- CRUD mappings -------------------- //
@RequestMapping(value = "/instance/{instanceId}/role-mappings/{roleName}", method = RequestMethod.POST)
public RoleMapping putRoleMapping(@PathVariable("instId") String instId, @PathVariable("roleName") String roleName, @RequestBody RoleMapping roleMapping) throws Exception {
org.uengine.kernel.ProcessInstance instance = applicationContext.getBean(
org.uengine.kernel.ProcessInstance.class,
new Object[]{
null,
instId,
null
}
);
instance.putRoleMapping(roleName, roleMapping);
return roleMapping;
}
조용민님, process-codi-mw4 , metaworks4 풀 받고, 서버 재실행하고,
인스턴스 모니터링 화면에서 "담당자 변경" 클릭하시면, 다이어로그 창에 스트링으로 뿌려놨어요.
거기 항목에 total, limit, offset 등등 페이지네이션 할 수 있는 파라미터들이 있습니다.
거기서,
{ "_rev": "2-900b660102455725d01eb93df70c471a", "subscription_id": "1da17731-ae8f-4c34-8377-8c71378d3837", "level": 5, "docType": "oauth_user", "billing_organization_id": "eb381e88-c81f-4c86-919a-9aa540009c2f", "_id": "4a4afb18b0f84c8c9d571fb842c05477", "regDate": 1493015316043, "name": "장진영", "userPassword": "test", "updDate": 1493016488336, "userName": "jyjang@opence.org", "managementId": "ddfefec0789b4dbfb00c725611bb695e", "billing_account_id": "ef87d762-ddc1-435c-9d9c-c5abd1b1691f" }
데이터 형식중에, userName 이 pk 개념, name 이 사용자 이름입니다.
Rolemapiing 클래스의
java 객체의 정의: #org.uengine.kernel.RoleMapping
protected String resourceName;
protected String emailAddress;
protected String instanceMessengerId;
protected String endpoint; // userId
protected String companyId;
protected String nickName;
protected String groupId;
protected String groupName;
protected String userPortrait;
protected String userLastName;
protected String userMiddleName;
protected String userFirstName;
protected String title;
protected int assignType = 0;
protected String assignParam1;
private int dispatchingOption = org.uengine.kernel.Role.DISPATCHINGOPTION_AUTO;
protected boolean isMale = true;
protected Date birthday;
protected boolean isGroup = false;
protected String locale;
protected String isReferencer;
protected String dispatchParam1
{
_type: 'org.uengine.kernel.RoleMapping,
endpoint: 'jyjang@uengine.org'
}
넘길때는 endpoint 만 있으면 됨.
Background 에서 테스트시:
http localhost:8080/instance/1/role-mapping/initiator endpoint="jyjang@uengine.org" _type="org.uengine.kernel.RoleMapping"