addActionError("Status is required");
}
if(hasActionErrors()){
return INPUT;
}
Article article;
LogInformation logInfo;
if("".equalsIgnoreCase(getArticle().getId())){
logInfo = new LogInformation();
article = new Article();
logInfo.setCreateBy(sess.getCurrentUser().getId());
logInfo.setCreateDate(new Timestamp(System.currentTimeMillis()));
setMsg("Add");
}else {
article = (Article) getManager().getById(Article.class, getArticle().getId());
logInfo = article.getLogInformation();
setMsg("update");
}
if(getCategoryId() != null && !"".equalsIgnoreCase(getCategoryId())){
ACategory = (ArticleCategory) getManager().getById(ArticleCategory.class, getCategoryId());
}else{
ACategory = null;
}
logInfo.setActiveFlag(getStatus());
logInfo.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
article.setName(getArticle().getName());
article.setAbstrak(getArticle().getAbstrak());
article.setDescription(getArticle().getDescription());
article.setCategoryId(ACategory);
article.setLogInformation(logInfo);
getManager().save(article);
return SUCCESS;
}