Example usage for org.apache.commons.lang NullArgumentException NullArgumentException

List of usage examples for org.apache.commons.lang NullArgumentException NullArgumentException

Introduction

In this page you can find the example usage for org.apache.commons.lang NullArgumentException NullArgumentException.

Prototype

public NullArgumentException(String argName) 

Source Link

Document

Instantiates with the given argument name.

Usage

From source file:org.nuclos.common.UsageCriteria.java

/**
 * @param that//from   ww  w .ja  v  a  2s .c  om
 * @return Is this comparable to that?
 * @precondition that != null
 */
public boolean isComparableTo(UsageCriteria that) {
    if (that == null) {
        throw new NullArgumentException("that");
    }
    return isComparable(this.getModuleId(), that.getModuleId())
            && isComparable(this.getProcessId(), that.getProcessId())
            && isComparable(this.getStatusId(), that.getStatusId())
            && isComparable(this.getCustom(), that.getCustom());
}

From source file:org.nuclos.common2.File.java

/**
 * creates a File object with the given name and contents. Note that this does not create a real file (on disk),
 * it's just a placeholder!/*from ww w  .  j a v  a2s . c o m*/
 * @param sFileName
 * @param abContents
 * @precondition sFileName != null
 * @precondition abContents != null
 */
public File(String sFileName, byte[] abContents) {
    this(sFileName);
    if (abContents == null) {
        throw new NullArgumentException("abContents");
    }
    this.contents = abContents;
}

From source file:org.nuclos.common2.File.java

/**
 * creates a File object without contents. May be used by successors to implement lazy loading of contents.
 * @param sFileName//from   w  w w  .  j  a  v a 2s .c  om
 * @precondition sFileName != null
 * @postcondition this.contents == null
 */
protected File(String sFileName) {
    if (sFileName == null) {
        throw new NullArgumentException("sFileName");
    }
    this.sFileName = sFileName;
    this.sFileType = getFiletype(getExtension(sFileName));
    assert this.contents == null;
}

From source file:org.nuclos.common2.File.java

/**
 * @param sFilename/*from  w  ww.  j  a va  2 s . co m*/
 * @return the extension of the given file name, if any.
 */
public static String getExtension(String sFilename) {
    if (sFilename == null) {
        throw new NullArgumentException("sFileName");
    }
    final int iPosition = sFilename.lastIndexOf('.');
    return (iPosition == -1) ? null : sFilename.substring(iPosition + 1);
}

From source file:org.nuclos.common2.TruncatableCollectionDecorator.java

/**
 *
 * @param coll// www .j av  a2 s.c  o  m
 * @param bTruncated
 * @param iTotalSize
 * @precondition coll != null
 * @precondition iTotalSize >= coll.size()
 */
public TruncatableCollectionDecorator(Collection<E> coll, boolean bTruncated, int iTotalSize) {
    super(coll);
    if (coll == null) {
        throw new NullArgumentException("coll");
    }
    if (iTotalSize < coll.size()) {
        throw new IllegalArgumentException("iTotalSize < coll.size()");
    }
    this.bTruncated = bTruncated;
    this.iTotalSize = iTotalSize;
}

From source file:org.nuclos.server.attribute.ejb3.AttributeFacadeBean.java

/**
 * @param iAttributeId id of attribute/*from   ww w.j a v  a2s . c  o m*/
 * @return the attribute value object for the attribute with the given id
 * @throws CommonPermissionException
 * @precondition iAttributeId != null
 */
public AttributeCVO get(Integer iAttributeId) throws CommonFinderException, CommonPermissionException {
    //      this.checkReadAllowed(NuclosEntity.ATTRIBUTE);
    if (iAttributeId == null) {
        throw new NullArgumentException("iAttributeId");
    }
    final AttributeCVO result;
    try {
        result = attributeCache.getAttribute(iAttributeId);
    } catch (NuclosAttributeNotFoundException ex) {
        throw new CommonFinderException(ex);
    }
    return result;
}

From source file:org.nuclos.server.common.AttributeCache.java

@Override
public AttributeCVO getAttribute(String sEntity, String sAttributeName)
        throws NuclosAttributeNotFoundException {
    if (sAttributeName == null) {
        throw new NullArgumentException("sAttributeName");
    }/*w  w  w  . j a  v a  2  s  .c om*/
    validate();

    try {
        final AttributeCVO result = getAttribute(
                IdUtils.unsafeToId(metaDataServerProvider.getEntityField(sEntity, sAttributeName).getId()));
        if (result == null) {
            throw new NuclosAttributeNotFoundException(sAttributeName);
        }
        assert result != null;
        return result;
    } catch (CommonFatalException ex) {
        throw new NuclosAttributeNotFoundException(sAttributeName);
    }
}

From source file:org.nuclos.server.common.ejb3.EntityObjectFacadeBean.java

/**
 * fills the dependants of <code>lowdcvo</code> with the data from the required sub entities.
 * @param base//from  ww w  .  ja  va  2  s  . c  om
 * @param stRequiredSubEntityNames
 * @param subEntities
 * @precondition stRequiredSubEntityNames != null
 */
private void fillDependants(EntityObjectVO base, Set<String> stRequiredSubEntityNames, String customUsage)
        throws CommonFinderException {

    if (stRequiredSubEntityNames == null) {
        throw new NullArgumentException("stRequiredSubEntityNames");
    }
    // final String username = getCurrentUserName();
    final DependantMasterDataMap dmdm = base.getDependants();
    final boolean log = LOG.isDebugEnabled();
    for (String s : stRequiredSubEntityNames) {
        final String refField = findRefField(base, s, customUsage);
        if (refField == null) {
            if (log) {
                LOG.debug("Can't find ref field from " + s + " to " + base.getEntity());
            }
            continue;
        }
        final Collection<EntityObjectVO> col = getDependentEntityObjects(s, refField, base.getId());
        dmdm.addAllData(s, col);
    }
    // base.setDependants(dmdm);
}

From source file:org.nuclos.server.common.ejb3.NuclosFacadeBean.java

/**
 * checks if it is allowed to read a genericobject
 * @param sEntityName/*from ww  w.  j av a  2  s  . co m*/
 * @param iGenericObjectId
 * @precondition iGenericObjectId != null
 * @throws CommonPermissionException if reading of the entity and the special genericobject is not allowed for the current user.
 */
protected void checkReadAllowedForModule(String sEntityName, Integer iGenericObjectId)
        throws CommonPermissionException {
    if (this.isCalledRemotely()) {
        if (iGenericObjectId == null) {
            throw new NullArgumentException("iGenericObjectId");
        }

        final String user = getCurrentUserName();
        if (!securityCache.isReadAllowedForModule(user, sEntityName, iGenericObjectId)) {
            throw new CommonPermissionException(StringUtils.getParameterizedExceptionMessage(
                    "nucleus.facade.permission.exception.1", user, getSystemIdentifier(iGenericObjectId),
                    modules.getEntityLabelByModuleName(sEntityName)));
        }
    }
}

From source file:org.nuclos.server.common.ejb3.NuclosFacadeBean.java

/**
 * checks if it is allowed to write a genericobject
 * @param sEntityName/*from   ww w  . j  av a  2s  .com*/
 * @param iGenericObjectId
 * @precondition iGenericObjectId != null
 * @throws CommonPermissionException if writing of the entity and the special genericobject is not allowed for the current user.
 */
protected void checkWriteAllowedForModule(String sEntityName, Integer iGenericObjectId)
        throws CommonPermissionException {
    checkFrozenEntities(sEntityName);
    if (this.isCalledRemotely()) {
        if (iGenericObjectId == null) {
            throw new NullArgumentException("iGenericObjectId");
        }

        final String user = getCurrentUserName();
        if (!securityCache.isWriteAllowedForModule(user, sEntityName, iGenericObjectId)) {
            throw new CommonPermissionException(StringUtils.getParameterizedExceptionMessage(
                    "nucleus.facade.permission.exception.2", user, getSystemIdentifier(iGenericObjectId),
                    modules.getEntityLabelByModuleName(sEntityName)));
        }
    }
}