List of usage examples for org.apache.commons.lang NullArgumentException NullArgumentException
public NullArgumentException(String argName)
Instantiates with the given argument name.
From source file:org.nuclos.client.common.NuclosCollectControllerFactory.java
/** * All specialized <code>CollectController</code>s that do not extend * <code>MasterDataCollectController</code> or <code>GenericObjectCollectController</code> * must be taken care of here.//from w w w .j av a2 s. c om * @param parent * @param sEntityName * @return * @throws org.nuclos.common.NuclosBusinessException * @throws CommonFatalException * @throws CommonPermissionException * @postcondition result != null */ public NuclosCollectController<?> newCollectController(String sEntityName, MainFrameTab tabIfAny, String customUsage) throws NuclosBusinessException, CommonPermissionException, CommonFatalException { if (sEntityName == null) { throw new NullArgumentException("sEntityName"); } // check if the entity is a generic object entity: Integer iModuleId = null; try { iModuleId = Modules.getInstance().getModuleIdByEntityName(sEntityName); } catch (NoSuchElementException ex) { iModuleId = null; } if (iModuleId != null) { Statemodel sm = StateDelegate.getInstance() .getStatemodel(new UsageCriteria(iModuleId, null, null, null)); if (sm == null) { JOptionPane.showMessageDialog(Main.getInstance().getMainFrame(), SpringLocaleDelegate.getInstance().getMessage("NuclosCollectControllerFactory.2", "Es ist kein Statusmodell definiert. Das Modul kann nicht geffnet werden.\nDie Statusmodellverwaltung finden Sie im Men Konfiguration."), sEntityName, JOptionPane.WARNING_MESSAGE); return null; } return newGenericObjectCollectController(iModuleId, tabIfAny, customUsage); } else { if (SecurityCache.getInstance().isReadAllowedForMasterData(sEntityName)) { MasterDataLayoutHelper.checkLayoutMLExistence(sEntityName); NuclosEntity systemEntity = NuclosEntity.getByName(sEntityName); if (systemEntity != null) { final CollectControllerFactorySingleton factory = CollectControllerFactorySingleton .getInstance(); switch (systemEntity) { case DATASOURCE: return factory.newDatasourceCollectController(tabIfAny); case DYNAMICENTITY: return factory.newDynamicEntityCollectController(tabIfAny); case VALUELISTPROVIDER: return factory.newValuelistProviderCollectController(tabIfAny); case RECORDGRANT: return factory.newRecordGrantCollectController(tabIfAny); case DYNAMICTASKLIST: return factory.newDynamicTasklistCollectController(tabIfAny); case CHART: return factory.newChartCollectController(tabIfAny); case STATEMODEL: return factory.newStateModelCollectController(tabIfAny); case PROCESSMONITOR: return factory.newProcessMonitorCollectController(tabIfAny); case INSTANCE: return factory.newInstanceCollectController(sEntityName, tabIfAny); case RULE: return factory.newRuleCollectController(tabIfAny); case IMPORT: return factory.newGenericObjectImportStructureCollectController(tabIfAny); case IMPORTFILE: return factory.newGenericObjectImportCollectController(tabIfAny); case TIMELIMITRULE: return factory.newTimelimitRuleCollectController(tabIfAny); case JOBCONTROLLER: return factory.newJobControlCollectController(tabIfAny); case LOCALE: return factory.newLocaleCollectController(tabIfAny); case NUCLET: return factory.newNucletCollectController(tabIfAny); case DBOBJECT: return factory.newDbObjectCollectController(tabIfAny); case DBSOURCE: return factory.newDbSourceCollectController(tabIfAny); case ENTITYRELATION: return factory.newEntityRelationShipCollectController(Main.getInstance().getMainFrame(), tabIfAny); case LDAPSERVER: return factory.newLdapServerCollectController(tabIfAny); case CODE: return factory.newCodeCollectController(tabIfAny); } } // try general masterdata factory method: // if there is no MasterDataCollectController for this entity, an exception will be thrown here. return newMasterDataCollectController(sEntityName, tabIfAny, customUsage); } else { throw new CommonPermissionException( SpringLocaleDelegate.getInstance().getMessage("NuclosCollectControllerFactory.1", "Sie haben kein Recht in der Entit\u00e4t ''{0}'' zu lesen.", SpringLocaleDelegate.getInstance().getLabelFromMetaDataVO( MasterDataDelegate.getInstance().getMetaData(sEntityName)))); //"Sie haben kein Recht in der Entit\u00e4t \"" + SpringLocaleDelegate.getLabelFromMetaDataVO(MasterDataDelegate.getInstance().getMetaData(sEntityName)) + "\" zu lesen."); } } }
From source file:org.nuclos.client.common.prefs.NuclosPreferencesRoot.java
/** * creates a root node for Nucleus preferences * @param facade/*from w w w. j a v a 2 s. c o m*/ */ NuclosPreferencesRoot(PreferencesFacadeRemote facade) { if (facade == null) { throw new NullArgumentException("facade"); } this.facade = facade; }
From source file:org.nuclos.client.common.Utils.java
/** * @param coll//from w ww .ja va 2s. c om * @return the common object, if any, based on equals. If all objects in the given Collection are equal, the first object is returned. * Otherwise, <code>null</code> is returned. * @precondition coll != null */ public static <E> E getCommonObject(Collection<E> coll) { if (coll == null) { throw new NullArgumentException("coll"); } E result = null; for (E e : coll) { if (result == null) { result = e; } else if (!result.equals(e)) { result = null; break; } } return result; }
From source file:org.nuclos.client.explorer.node.rule.DirectoryRuleNode.java
public DirectoryRuleNode(boolean bRoot, String sLabel, String aDescription, List<? extends TreeNode> aSubNodeList, boolean aIsAllRuleSubnodeFlag) { super(null, sLabel, aDescription, aSubNodeList, RuleNodeType.DIRECTORY); if (sLabel == null) { throw new NullArgumentException("sLabel"); }// w w w .j ava 2s . com this.bRoot = bRoot; this.isAllRuleSubnode = aIsAllRuleSubnodeFlag; }
From source file:org.nuclos.client.genericobject.CollectableGenericObject.java
/** * @param govo/*from ww w .j a v a 2s. co m*/ * @precondition govo != null */ public CollectableGenericObject(GenericObjectVO govo) { if (govo == null) { throw new NullArgumentException("govo"); } this.govo = govo; }
From source file:org.nuclos.client.genericobject.CollectableGenericObject.java
/** * @param sFieldName// w w w .j av a2 s. c o m * @param clctfValue * @precondition clctfValue != null * @precondition (clctfValue.getFieldType() == CollectableEntityField.TYPE_VALUEIDFIELD) -> (clctfValue.getValueId() instanceof Integer) */ @Override public void setField(String sFieldName, CollectableField clctfValue) { if (clctfValue == null) { throw new NullArgumentException("clctfValue"); } if (clctfValue.isNull()) { // remove from cvo: final DynamicAttributeVO attrvo = this.getAttributeValueByName(sFieldName); if (attrvo != null) { attrvo.remove(); } } else { // 1. cvo \u00e4ndern: DynamicAttributeVO attrvo = this.getAttributeValueByName(sFieldName); if (attrvo == null) { attrvo = newGenericObjectAttributeVO(this.govo.getModuleId(), sFieldName); } else if (attrvo.isRemoved()) { attrvo.unremove(); } assert !attrvo.isRemoved(); attrvo.setValue(clctfValue.getValue()); if (clctfValue.isIdField() && (this.getCollectableEntity().getEntityField(sFieldName).isReferencing() || this.getCollectableEntity().getEntityField(sFieldName).isIdField())) { attrvo.setValueId((Integer) clctfValue.getValueId()); } /** @todo OPTIMIZE: This method is very inefficient - check if this is an issue! */ this.govo.setAttribute(attrvo); // 2. Evtl. vorhandenen Cache-Eintrag l\u00f6schen: this.mpFields.remove(sFieldName); } assert this.getField(sFieldName).equals(clctfValue) : SpringLocaleDelegate.getInstance().getMessage( "CollectableGenericObject.2", "Das Feld {0} in der Entit\u00e4t {1} enth\u00e4lt den Wert {2} (erwartet: {3})", sFieldName, getCollectableEntity().getName(), this.getField(sFieldName), clctfValue); // "Das Feld " + sFieldName + " in der Entit\u00e4t " + getCollectableEntity().getName() + " enth\u00e4lt den Wert " + // this.getField(sFieldName) + " (erwartet: " + clctfValue + ")"; }
From source file:org.nuclos.client.genericobject.CollectableGenericObjectEntity.java
/** * creates a leased object entity with the given field names. * @param sName//w ww .j a va2s. com * @param sLabel * @param collFieldNames * @precondition collFieldNames != null */ public CollectableGenericObjectEntity(String sName, String sLabel, Collection<String> collFieldNames) { if (collFieldNames == null) { throw new NullArgumentException("collFieldNames"); } this.sName = sName; this.sLabel = sLabel; this.stFieldNames = new HashSet<String>(collFieldNames); }
From source file:org.nuclos.client.genericobject.GenericObjectDelegate.java
/** * gets the (historical) leased object with the given id at the historical date. * @param iGenericObjectId/*from ww w. j av a2s .c o m*/ * @param dateHistorical * @return the contents of the leased object at the given point in time. * @precondition dateHistorical != null * @postcondition result != null * @throws CommonFinderException if the given object didn't exist at the given point in time. */ public GenericObjectWithDependantsVO getHistorical(int iGenericObjectId, Date dateHistorical, String customUsage) throws CommonFinderException, CommonPermissionException { if (dateHistorical == null) { throw new NullArgumentException("dateHistorical"); } try { final GenericObjectWithDependantsVO result = this.getGenericObjectFacade() .getHistorical(iGenericObjectId, dateHistorical, customUsage); assert result != null; return result; } catch (RuntimeException ex) { throw new CommonFatalException(ex); } }
From source file:org.nuclos.client.genericobject.GenericObjectDelegate.java
/** * creates the given leased object and its dependants. * @param lowdcvo must have an empty (<code>null</code>) id. * @return the updated leased object (from the server) * @precondition lowdcvo.getId() == null * @precondition mpDependants != null --> for(m : mpDependants.values()) { m.getId() == null } * @precondition stRequiredSubEntityNames != null *///from w ww . j a v a 2s . c om public GenericObjectWithDependantsVO create(GenericObjectWithDependantsVO lowdcvo, Set<String> stRequiredSubEntityNames, String customUsage) throws CommonBusinessException { if (lowdcvo.getId() != null) { throw new IllegalArgumentException("lowdcvo"); } MasterDataDelegate.checkDependantsAreNew(lowdcvo.getDependants()); if (stRequiredSubEntityNames == null) { throw new NullArgumentException("stRequiredSubEntityNames"); } debug(lowdcvo); try { LOG.debug("create start"); final GenericObjectWithDependantsVO result = this.getGenericObjectFacade().create(lowdcvo, stRequiredSubEntityNames, customUsage); LOG.debug("create done"); return result; } catch (CommonFatalException ex) { if (ex.getCause() != null) // CreateException { final Throwable tCause = ex.getCause().getCause(); if (tCause instanceof BadGenericObjectException) { throw (BadGenericObjectException) tCause; } } // RuntimeException has the BAD habit to include its cause' message in its own message. // the default message of NuclosUpdateException is not always correct ("duplicate key"). // cause of the exception will be added at Errors.java throw new CommonCreateException("GenericObjectDelegate.2", ex); } catch (RuntimeException ex) { throw new CommonFatalException(ex); } }
From source file:org.nuclos.client.genericobject.GenericObjectLayoutCache.java
/** * parses the LayoutML definition and gets the layout information * @param clcte//from w w w . j a v a2 s . c o m * @param usagecriteria * @param bSearchScreen * @return id of the LayoutRoot * @precondition clcte != null * @precondition usagecriteria != null * @precondition clcte.getName().equals(Modules.getInstance().getEntityNameByModuleId(usagecriteria.getModuleId())) */ public synchronized Integer getLayoutId(CollectableEntity clcte, UsageCriteria usagecriteria, boolean bSearchScreen) { if (clcte == null) { throw new NullArgumentException("clcte"); } if (usagecriteria == null) { throw new NullArgumentException("usagecriteria"); } final String sEntityName = clcte.getName(); final Integer iModuleId = usagecriteria.getModuleId(); if (!sEntityName.equals(Modules.getInstance().getEntityNameByModuleId(iModuleId))) { throw new IllegalArgumentException( "The entity (\"" + sEntityName + "\") doesn't match the module id (" + iModuleId + ")."); } return this.getLayoutId(usagecriteria, bSearchScreen); }