@Override public Object retrieve(String field) { if (field == null) { return null; } else if (field.equals(GROUP)) { return getGroup(); } else if (field.equals(ITEMCOUNT)) { return getItemCount(); } else if (field.equals(ACTIVE)) { return getActive(); } else if (field.equals(DATA)) { return getData(); } else { return super.retrieve(field); } }
@RolesAllowed("user") @Transactional(readOnly = false) public CommentAnnotation addComment(final long shareId, @NotNull final String commentText) { getShareIfAccessible(shareId); ExperimenterGroup group = iQuery.get(Share.class, shareId).getGroup(); final CommentAnnotation[] rv = new CommentAnnotation[1]; sec.runAsAdmin(group, new AdminAction(){ public void runAsAdmin() { final Share share = iQuery.get(Share.class, shareId); CommentAnnotation comment = new CommentAnnotation(); comment.setTextValue(commentText); comment.setNs(NS_COMMENT); share.linkAnnotation(comment); iUpdate.flush(); rv[0] = iQuery.get(CommentAnnotation.class, comment.getId()); }}); return rv[0]; }
to.setItemCount(from.getItemCount()); to.setActive(from.getActive()); to.setGroup(from.getGroup()); to.setData(from.getData());