[ 
https://issues.apache.org/jira/browse/OOZIE-2328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14694880#comment-14694880
 ] 

Purshotam Shah commented on OOZIE-2328:
---------------------------------------

Can you refactor code. Modify get function to use getIfExist to avoid duplicate 
code

{code}

+    public CoordinatorActionBean getIfExist(CoordActionQuery namedQuery, 
Object... parameters) throws JPAExecutorException {
+        JPAService jpaService = Services.get().get(JPAService.class);
+        EntityManager em = jpaService.getEntityManager();
+        Query query = getSelectQuery(namedQuery, em, parameters);
+        Object ret = jpaService.executeGet(namedQuery.name(), query, em);
+        if (ret == null) {
+            return null;
+        }
+        CoordinatorActionBean bean = constructBean(namedQuery, ret);
+        return bean;
+    }
+
+    @Override


        @Override
    public CoordinatorActionBean get(CoordActionQuery namedQuery, Object... 
parameters) throws JPAExecutorException {
        Object ret = getIfExist(namedQuery.name(), parameters);
        if (ret == null) {
            throw new JPAExecutorException(ErrorCode.E0605, query.toString());
        }
        return bean;
    }
{code}  

> Coordinator endtime change should check if the last action is in database
> -------------------------------------------------------------------------
>
>                 Key: OOZIE-2328
>                 URL: https://issues.apache.org/jira/browse/OOZIE-2328
>             Project: Oozie
>          Issue Type: Bug
>    Affects Versions: trunk
>            Reporter: Kailong Sheng
>            Assignee: Kailong Sheng
>         Attachments: OOZIE-2328-1.patch, OOZIE-2328-2.patch, 
> OOZIE-2328-3.patch, OOZIE-2328-4.patch, OOZIE-2328.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to