gt: 		if (checkGroups == null) groups = new Vector();
context: /*
  Copyright (c) 2000-2013 "independIT Integrative Technologies GmbH",
  Authors: Ronald Jeninga, Dieter Stubler
  
  schedulix Enterprise Job Scheduling System
  
  independIT Integrative Technologies GmbH [http://www.independit.de]
  mailto:contact@independit.de
  
  This file is part of schedulix
  
  schedulix is free software:
  you can redistribute it and/or modify it under the terms of the
  GNU Affero General Public License as published by the
  Free Software Foundation, either version 3 of the License,
  or (at your option) any later version.
  
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Affero General Public License for more details.
  
  You should have received a copy of the GNU Affero General Public License
  along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
  
  package de.independit.scheduler.server.repository;
  
  import java.io.*;
  import java.util.*;
  import java.lang.*;
  import java.sql.*;
  
  import de.independit.scheduler.server.*;
  import de.independit.scheduler.server.util.*;
  import de.independit.scheduler.server.exception.*;
  
  public class SDMSExitStateTranslationProfileProxyGeneric extends SDMSProxy
  {
  
  	public final static long privilegeMask = SDMSPrivilege.EDIT|SDMSPrivilege.CREATE|SDMSPrivilege.VIEW|SDMSPrivilege.DROP|SDMSPrivilege.GRANT;
  
  	static final public int name_size = 64;
  
  	protected SDMSExitStateTranslationProfileProxyGeneric(SDMSObject p_object)
  	{
  		super(p_object);
  	}
  
  	protected static SDMSExitStateTranslationProfile getProxy (SystemEnvironment sysEnv, SDMSObject p_object)
  	{
  		int i = SDMSExitStateTranslationProfileTable.table.tableIndex;
  		SDMSProxy p = SDMSRepository.getProxy(i);
  		if (p == null)
  			p = new SDMSExitStateTranslationProfile (p_object);
  		else {
  			p.initProxy(p_object);
  		}
  		sysEnv.tx.addUsedProxy(i, p);
  		return (SDMSExitStateTranslationProfile)p;
  	}
  
  	public String getName (SystemEnvironment env)
  	throws SDMSException
  	{
  		checkRead(env);
  		return (((SDMSExitStateTranslationProfileGeneric)(object)).getName (env));
  	}
  
  	public void setName (SystemEnvironment env, String p_name)
  	throws SDMSException
  	{
  		checkWrite(env);
  		if(!checkPrivileges(env, SDMSPrivilege.EDIT))
  			throw new AccessViolationException (accessViolationMessage(env, "01312181241"));
  
  		((SDMSExitStateTranslationProfileGeneric)(object)).setName (env, p_name);
  		return ;
  	}
  	public static int getNameMaxLength ()
  	{
  		return (64);
  	}
  	public Long getCreatorUId (SystemEnvironment env)
  	throws SDMSException
  	{
  		checkRead(env);
  		return (((SDMSExitStateTranslationProfileGeneric)(object)).getCreatorUId (env));
  	}
  
  	private void setCreatorUId (SystemEnvironment env, Long p_creatorUId)
  	throws SDMSException
  	{
  		checkWrite(env);
  		if(!checkPrivileges(env, SDMSPrivilege.EDIT))
  			throw new AccessViolationException (accessViolationMessage(env, "01312181241"));
  
  		((SDMSExitStateTranslationProfileGeneric)(object)).setCreatorUId (env, p_creatorUId);
  		return ;
  	}
  	public Long getCreateTs (SystemEnvironment env)
  	throws SDMSException
  	{
  		checkRead(env);
  		return (((SDMSExitStateTranslationProfileGeneric)(object)).getCreateTs (env));
  	}
  
  	private void setCreateTs (SystemEnvironment env, Long p_createTs)
  	throws SDMSException
  	{
  		checkWrite(env);
  		if(!checkPrivileges(env, SDMSPrivilege.EDIT))
  			throw new AccessViolationException (accessViolationMessage(env, "01312181241"));
  
  		((SDMSExitStateTranslationProfileGeneric)(object)).setCreateTs (env, p_createTs);
  		return ;
  	}
  	public Long getChangerUId (SystemEnvironment env)
  	throws SDMSException
  	{
  		checkRead(env);
  		return (((SDMSExitStateTranslationProfileGeneric)(object)).getChangerUId (env));
  	}
  
  	public void setChangerUId (SystemEnvironment env, Long p_changerUId)
  	throws SDMSException
  	{
  		checkWrite(env);
  		if(!checkPrivileges(env, SDMSPrivilege.EDIT))
  			throw new AccessViolationException (accessViolationMessage(env, "01312181241"));
  
  		((SDMSExitStateTranslationProfileGeneric)(object)).setChangerUId (env, p_changerUId);
  		return ;
  	}
  	protected SDMSExitStateTranslationProfile setChangerUIdNoCheck (SystemEnvironment env, Long p_changerUId)
  	throws SDMSException
  	{
  		checkWrite(env);
  		((SDMSExitStateTranslationProfileGeneric)(object)).setChangerUId (env, p_changerUId);
  		return (SDMSExitStateTranslationProfile)this;
  	}
  	public Long getChangeTs (SystemEnvironment env)
  	throws SDMSException
  	{
  		checkRead(env);
  		return (((SDMSExitStateTranslationProfileGeneric)(object)).getChangeTs (env));
  	}
  
  	private void setChangeTs (SystemEnvironment env, Long p_changeTs)
  	throws SDMSException
  	{
  		checkWrite(env);
  		if(!checkPrivileges(env, SDMSPrivilege.EDIT))
  			throw new AccessViolationException (accessViolationMessage(env, "01312181241"));
  
  		((SDMSExitStateTranslationProfileGeneric)(object)).setChangeTs (env, p_changeTs);
  		return ;
  	}
  	protected SDMSExitStateTranslationProfile setChangeTsNoCheck (SystemEnvironment env, Long p_changeTs)
  	throws SDMSException
  	{
  		checkWrite(env);
  		((SDMSExitStateTranslationProfileGeneric)(object)).setChangeTs (env, p_changeTs);
  		return (SDMSExitStateTranslationProfile)this;
  	}
  
  	public SDMSKey getSortKey(SystemEnvironment sysEnv)
  	throws SDMSException
  	{
  		SDMSKey s = null;
  		Long myId = getId(sysEnv);
  		if (sysEnv.tx.sortKeyMap == null)
  			sysEnv.tx.sortKeyMap = new HashMap();
  		else
  			s = (SDMSKey) sysEnv.tx.sortKeyMap.get(myId);
  		if (s != null) return s;
  		boolean gotIt = false;
  		s = new SDMSKey();
  
  		s.add(getName(sysEnv));
  
  		sysEnv.tx.sortKeyMap.put(myId, s);
  		return s;
  	}
  
  	public void delete (SystemEnvironment env)
  	throws SDMSException
  	{
  		SDMSObjectCommentTable.dropComment (env, getId (env));
  		Vector gv = SDMSGrantTable.idx_objectId.getVector(env, getId(env));
  		for (int i = 0; i < gv.size(); ++i) {
  			SDMSGrant g = (SDMSGrant) gv.get(i);
  			g.setDeleteVersion(env, env.tx.txId);
  		}
  		super.delete(env);
  	}
  
  	public final boolean checkPrivileges(SystemEnvironment env, long p)
  	throws SDMSException
  	{
  		return (getPrivileges(env, p, true, null) & p) == p;
  	}
  
  	public final boolean checkPrivileges(SystemEnvironment env, long p, long version)
  	throws SDMSException
  	{
  		return (getPrivileges(env, p, true, null, version) & p) == p;
  	}
  
  	public long getPrivilegeMask()
  	{
  		return privilegeMask;
  	}
  
  	public final SDMSPrivilege getPrivileges(SystemEnvironment env)
  	throws SDMSException
  	{
  		return new SDMSPrivilege(env, getPrivileges(env, privilegeMask, false, null));
  	}
  
  	public final SDMSPrivilege getPrivilegesForGroups(SystemEnvironment env, Vector checkGroups)
  	throws SDMSException
  	{
  		return new SDMSPrivilege(env, getPrivileges(env, privilegeMask, false, checkGroups));
  	}
  
  	public long getPrivileges(SystemEnvironment env, long checkPrivs, boolean fastFail, Vector checkGroups)
  	throws SDMSException
  	{
  		Vector groups;
  		if (checkGroups == null) groups = new Vector();
  		else groups = checkGroups;
  
  		long p = 0;
  		if(env.cEnv.isUser()) {
  			if(checkGroups == null)
  				groups.addAll(env.cEnv.gid());
  			if(groups.contains(SDMSObject.adminGId)) p = checkPrivs;
  			else {
  				p = p | SDMSPrivilege.VIEW & checkPrivs;
  			}
  		} else p = checkPrivs;
  		return p;
  	}
  
  	public final SDMSPrivilege getPrivileges(SystemEnvironment env, long version)
  	throws SDMSException
  	{
  		return new SDMSPrivilege(env, getPrivileges(env, privilegeMask, false, null, version));
  	}
  
  	public final SDMSPrivilege getPrivilegesForGroups(SystemEnvironment env, Vector checkGroups, long version)
  	throws SDMSException
  	{
  		return new SDMSPrivilege(env, getPrivileges(env, privilegeMask, false, checkGroups, version));
  	}
  
  	public long getPrivileges(SystemEnvironment env, long checkPrivs, boolean fastFail, Vector checkGroups, long version)
  	throws SDMSException
  	{
  		Vector groups;
  