/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clips.delegate.kek;
import beans.cec.entity.CommitteeMemberDetails;
import cli_fmw.delegate.directory.complex.DirectoryLocator;
import cli_fmw.main.ClipsException;
import cli_fmw.delegate.lists.DataChunk;
import clips.delegate.directory.ro.DirectoryCollaborator;
import clips.delegate.directory.ro.DirectoryCollaboratorItem;
/**
*
* @author lacoste
*/
public class CommitteeMemberData extends DataChunk<CommitteeMemberDetails> {
public CommitteeMemberData(CommitteeLocal committee) throws ClipsException {
super(new CommitteeMemberDetails());
getDetails().committeeID = committee.getID();
}
public CommitteeMemberData(CommitteeLocal committee, CommitteeMemberDetails details)
throws ClipsException {
super(details);
if(committee != null &&
getDetails().committeeID != committee.getID()) {
throw new IllegalArgumentException("Inconsistent committee data");
}
}
public DirectoryCollaboratorItem getCollaborator() throws ClipsException {
DirectoryCollaborator dir = DirectoryLocator.getDirectory(DirectoryCollaborator.class, false);
return dir.getItemFromID(getDetails().collaboratorID);
}
public void setCollaborator(DirectoryCollaboratorItem collaborator) {
getDetails().collaboratorID = collaborator.getID();
}
@Override
public String toString() {
try {
return getCollaborator().toString();
} catch (ClipsException ex) {
ex.printStackTrace();
return "";
}
}
}