TheOpenCloudEngine / uEngine5-base

uEngine5 BPMS that totally re-written in Microservices architecture. uEngine5 can act as not only a conventional Workflow or BPMS but also as a REST api orchestrator or a BPaaS (Business process as a service) of members of OCE's MSA components.
MIT License
10 stars 13 forks source link

UserPicker UI Html Tag #22

Open jinyoung opened 6 years ago

jinyoung commented 6 years ago
  1. 인스턴스 검색 후, 담당자를 위임처리 하기 위하여 Role Mapping 을 지정할 수 있는 UI 가 제공되어야 함.
  2. 회사마다 사용하는 조직도 데이터베이스 (일반 DB인 경우, LDAP 인 경우등)가 다르기 때문에 조직도를 여는 방식에 대한 우리의 기본 방향은 IAM 에서 유저를 검색하는 방식으로 한다.
  3. 사용자를 선택하도록 하는 버튼으로 만들거나 (옛날방식) 혹은 사용자 이름 그냥 넣으면 사용자를 하단에 팝업으로 바로 선택할 수 있도록 하는 Auto complete Text field 방식도 좋음
jinyoung commented 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 함.

jinyoung commented 6 years ago

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을 그냥 가져오고 있음...

따라서, 
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;
}
SeungpilPark commented 6 years ago

조용민님, 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 클래스의

jinyoung commented 6 years ago

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
jinyoung commented 6 years ago
{
   _type: 'org.uengine.kernel.RoleMapping,
   endpoint: 'jyjang@uengine.org'
}

넘길때는 endpoint 만 있으면 됨.

jinyoung commented 6 years ago

Background 에서 테스트시:

http localhost:8080/instance/1/role-mapping/initiator endpoint="jyjang@uengine.org" _type="org.uengine.kernel.RoleMapping"