BPM でユーザーの休暇ルールを作成しようとして、メソッドを作成しました (スニッパーは下に表示されます) が、jaxb オブジェクト インスタンスの作成時に例外が発生しました。
ruleInfoType.setCreatedDate(DateUtility.getCalendarInTimeZone(DateUtility.TIMEZONE_TR));
java.lang.NullPointerException
at oracle.xml.jaxb.JaxbNode.getOwnerDocument(JaxbNode.java:244)
at oracle.xml.jaxb.JaxbNode.setJaxbElement(JaxbNode.java:789)
at oracle.bpel.services.workflow.user.model.RuleInfoTypeImpl.setCreatedDate(RuleInfoTypeImpl.java:181)
at com.arsivist.structure.integration.bpm.BPMProcessUtility.createVacationRule(BPMProcessUtility.java:488)
at com.arsivist.structure.integration.bpm.BPMRoleManagementService.main(BPMRoleManagementService.java:101)
.
import com.arsivist.structure.integration.bpm.vo.DefaultColumnList;
import com.arsivist.structure.util.DateUtility;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import oracle.bpel.services.bpm.common.IBPMContext;
import oracle.bpel.services.common.util.XMLUtil;
import oracle.bpel.services.workflow.WorkflowException;
import oracle.bpel.services.workflow.client.IWorkflowServiceClient;
import oracle.bpel.services.workflow.client.config.ClientConfigurationUtil;
import oracle.bpel.services.workflow.client.config.WorkflowServicesClientConfigurationType;
import oracle.bpel.services.workflow.common.model.PrincipleRefType;
import oracle.bpel.services.workflow.common.model.PrincipleRefTypeImpl;
import oracle.bpel.services.workflow.query.ITaskQueryService;
import oracle.bpel.services.workflow.repos.Column;
import oracle.bpel.services.workflow.repos.Predicate;
import oracle.bpel.services.workflow.repos.TableConstants;
import oracle.bpel.services.workflow.runtimeconfig.model.AttributeLabelType;
import oracle.bpel.services.workflow.runtimeconfig.model.PayloadMappingType;
import oracle.bpel.services.workflow.task.model.ProcessType;
import oracle.bpel.services.workflow.task.model.Task;
import oracle.bpel.services.workflow.user.IUserMetadataService;
import oracle.bpel.services.workflow.user.model.RuleActionType;
import oracle.bpel.services.workflow.user.model.RuleActionTypeImpl;
import oracle.bpel.services.workflow.user.model.RuleAssignmentType;
import oracle.bpel.services.workflow.user.model.RuleAssignmentTypeImpl;
import oracle.bpel.services.workflow.user.model.RuleDetail;
import oracle.bpel.services.workflow.user.model.RuleDetailType;
import oracle.bpel.services.workflow.user.model.RuleDetailTypeImpl;
import oracle.bpel.services.workflow.user.model.RuleInfoType;
import oracle.bpel.services.workflow.user.model.RuleInfoTypeImpl;
import oracle.bpel.services.workflow.verification.IWorkflowContext;
import oracle.bpm.client.BPMServiceClientFactory;
import oracle.bpm.services.client.IBPMServiceClient;
import oracle.bpm.services.instancemanagement.model.IProcessFlexAttributes;
import oracle.bpm.services.instancemanagement.model.IProcessInstance;
import oracle.bpm.services.instancequery.IInstanceQueryService;
import oracle.bpm.services.processmetadata.IProcessMetadataService;
import oracle.bpm.services.processmetadata.ProcessMetadataSummary;
import oracle.bpm.services.processmetadata.StatusEnum;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
// ACTIVE/RETIRED/DELETED
/**
* Utility class with example usage of the BPM and HWF APIs
*/
public class BPMProcessUtility
{
public final static String PAYLOAD_ELEMENT = "payload";
public final static String TASK_NS = "http://www.acme.com.tr";
public final static String INIT_TASK_SUBMIT_OUTCOME = "SUBMIT";
private IBPMServiceClient bpmSvcClient_;
private IWorkflowServiceClient wfSvcClient_;
private Map<Column, Method> protectedFlexFieldMapping_;
public BPMProcessUtility(BPMServiceClientFactory clientFactory)
{
bpmSvcClient_ = clientFactory.getBPMServiceClient();
wfSvcClient_ = clientFactory.getWorkflowServiceClient();
protectedFlexFieldMapping_ = initializeFlexFieldMethodMapping("getProtected");
}
public void createVacationRule(IWorkflowContext ctx, String userNameOfRuleOwner, String targetUserName, Date beginDate, Date endDate,
oracle.bpm.services.organization.model.ObjectFactory objectFactory) throws Exception
{
IUserMetadataService iUserMetadataService = wfSvcClient_.getUserMetadataService();
RuleInfoType ruleInfoType = new RuleInfoTypeImpl();
RuleDetailType ruleDetail = new RuleDetailTypeImpl();
RuleActionType action = new RuleActionTypeImpl();
RuleAssignmentType ruleAssignment = new RuleAssignmentTypeImpl();
//prepare ruleinfotype instance
ruleInfoType.setCreatedDate(DateUtility.getCalendarInTimeZone(DateUtility.TIMEZONE_TR));
ruleInfoType.setDescription(userNameOfRuleOwner + "_" + DateUtility.convertDateToString(DateUtility.getToday(), "dd.MM.yyyy HH:mi"));
ruleInfoType.setStartDate(DateUtility.getCalendarOfDate(beginDate));
ruleInfoType.setEndDate(DateUtility.getCalendarOfDate(endDate));
ruleInfoType.setRuleName(userNameOfRuleOwner + "_" + DateUtility.convertDateToString(DateUtility.getToday(), "dd.MM.yyyy HH:mi"));
//prepare owneruser principalref
PrincipleRefType userOfRuleOwner = new PrincipleRefTypeImpl();
userOfRuleOwner.setRealm("jazn.com");
userOfRuleOwner.setName(userNameOfRuleOwner);
//set owner user to ruleInfoType
ruleInfoType.setOwner(userOfRuleOwner);
ruleDetail.setGeneralInfo(ruleInfoType);
//prepare targetuser principalref
PrincipleRefType targetUser = new PrincipleRefTypeImpl();
targetUser.setRealm("jazn.com");
targetUser.setName(targetUserName);
//set target user to reassigne user
ruleAssignment.setAssignee(targetUser);
action.setReassign(ruleAssignment);
iUserMetadataService.createRule(ctx, (RuleDetail)ruleDetail);
}
インスタンスを作成する正しい方法について誰かが考えていますか?