All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.venky.swf.plugins.collab.extensions.participation.CompanyParticipantExtension Maven / Gradle / Ivy

There is a newer version: 2.12
Show newest version
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;
	}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy