com.venky.swf.plugins.collab.extensions.participation.CompanyParticipantExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swf-plugin-collab Show documentation
Show all versions of swf-plugin-collab Show documentation
Succinct Web Framework - Plugin collaboration
package com.venky.swf.plugins.collab.extensions.participation;
import java.util.ArrayList;
import java.util.List;
import com.venky.swf.db.extensions.ParticipantExtension;
import com.venky.swf.plugins.collab.db.model.participants.admin.Company;
import com.venky.swf.plugins.collab.db.model.user.User;
public class CompanyParticipantExtension extends ParticipantExtension{
static {
registerExtension(new CompanyParticipantExtension());
}
@Override
protected List getAllowedFieldValues(com.venky.swf.db.model.User user, Company partial , String fieldName) {
List ret = null;
User u = (User)user;
if ("SELF_COMPANY_ID".equalsIgnoreCase(fieldName)){
ret = new ArrayList();
ret.add(u.getCompanyId());
if (partial.getId() > 0 && partial.getCreatorUserId() == user.getId()){
ret.add(partial.getId());
}
}else if ("CREATOR_USER_ID".equalsIgnoreCase(fieldName)){
if (partial.getId() == 0 ){
ret = new ArrayList();
ret.add(user.getId());
}
}
return ret;
}
}