@Test public void testSetMembership() throws Exception { FedoraUserDao dao = new FedoraUserDao(); dao.setTransaction(tx); UserProfile user = new UserProfile(); user.setUserName("testUser"); dao.add(user, support.getTestUser(), testName.getMethodName()); Group g = Group.create(testName.getMethodName(), testName.getMethodName() + "Title"); FedoraGroupDao groupDao = new FedoraGroupDao(); groupDao.setTransaction(tx); groupDao.addGroup(g, support.getTestUser(), testName.getMethodName()); dao.setMembership(user, Arrays.asList(g), testName.getMethodName()); String userPid = user.getUserNameAsPid(); RemoteObject fobject = tx.getRemoteStorage().find(userPid); RelationEditor relationEditor = new RelationEditor(fobject); Collection<String> membership = relationEditor.getMembership(); assertEquals(Arrays.asList(UserUtil.toGroupPid(g)), membership); }
public void setMembership(UserProfile user, Collection<Group> groups, String logMessage) throws DigitalObjectException { String pid = user.getUserNameAsPid(); RemoteObject fobject = getRemoteStorage().find(pid); RelationEditor relationEditor = new RelationEditor(fobject); relationEditor.setMembership(UserUtil.toGroupPid(groups)); relationEditor.write(relationEditor.getLastModified(), logMessage); fobject.flush(); }
FedoraUserDao extends FedoraDao { public void setMembership(UserProfile user, Collection<Group> groups, String logMessage) throws DigitalObjectException { String pid = user.getUserNameAsPid(); RemoteObject fobject = getRemoteStorage().find(pid); RelationEditor relationEditor = new RelationEditor(fobject); relationEditor.setMembership(UserUtil.toGroupPid(groups)); relationEditor.write(relationEditor.getLastModified(), logMessage); fobject.flush(); } }
FedoraUserDao extends FedoraDao { public void setMembership(UserProfile user, Collection<Group> groups, String logMessage) throws DigitalObjectException { String pid = user.getUserNameAsPid(); RemoteObject fobject = getRemoteStorage().find(pid); RelationEditor relationEditor = new RelationEditor(fobject); relationEditor.setMembership(UserUtil.toGroupPid(groups)); relationEditor.write(relationEditor.getLastModified(), logMessage); fobject.flush(); } FedoraUserDao(); }
FedoraUserDao extends FedoraDao { public void setMembership(UserProfile user, Collection<Group> groups, String logMessage) throws DigitalObjectException { String pid = user.getUserNameAsPid(); RemoteObject fobject = getRemoteStorage().find(pid); RelationEditor relationEditor = new RelationEditor(fobject); relationEditor.setMembership(UserUtil.toGroupPid(groups)); relationEditor.write(relationEditor.getLastModified(), logMessage); fobject.flush(); } FedoraUserDao(); String add(UserProfile user, String owner, String logMessage); void addMembership(UserProfile user, Collection<Group> groups, String logMessage); void setMembership(UserProfile user, Collection<Group> groups, String logMessage); }
FedoraUserDao extends FedoraDao { public void setMembership(UserProfile user, Collection<Group> groups, String logMessage) throws DigitalObjectException { String pid = user.getUserNameAsPid(); RemoteObject fobject = getRemoteStorage().find(pid); RelationEditor relationEditor = new RelationEditor(fobject); relationEditor.setMembership(UserUtil.toGroupPid(groups)); relationEditor.write(relationEditor.getLastModified(), logMessage); fobject.flush(); } FedoraUserDao(); String add(UserProfile user, String owner, String logMessage); void addMembership(UserProfile user, Collection<Group> groups, String logMessage); void setMembership(UserProfile user, Collection<Group> groups, String logMessage); static final String METAMODEL_ID; static final String PID_PREFIX; }