CFeatureObjectFactory.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /****************************************************************
  2. ** Licensed Materials - Property of IBM
  3. **
  4. ** BI and PM: qs
  5. **
  6. ** (C) Copyright IBM Corp. 2001, 2015
  7. **
  8. ** US Government Users Restricted Rights - Use, duplication or
  9. ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *****************************************************************/
  11. // Copyright (C) 2008 Cognos ULC, an IBM Company. All Rights Reserved.
  12. // Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated) in the United States and/or other countries. IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, or other countries, or both. Other company, product, or service names may be trademarks or service marks of others.
  13. var FEATURE_FACTORY_INITIALIZED_STATE = "initialized";
  14. var FEATURE_FACTORY_INITIALIZATION_FAILED_STATE = "initializationFailed";
  15. var FEATURE_FACTORY_DENIED_STATE = "denied";
  16. function CFeatureObjectFactory()
  17. {
  18. };
  19. CFeatureObjectFactory.prototype.getFeatureObject = function (sFeatureName)
  20. {
  21. var sObjectClass = "C" + sFeatureName;
  22. var oNewFeatureObject = null;
  23. if (goExcludedFeatures.get(sFeatureName) === null)
  24. {
  25. try
  26. {
  27. oNewFeatureObject = eval("new " + sObjectClass + "()");
  28. }
  29. catch (e)
  30. {
  31. oNewFeatureObject = this.createUnregisteredFeatureObject();
  32. }
  33. }
  34. else
  35. {
  36. oNewFeatureObject = this.createUnregisteredFeatureObject();
  37. oNewFeatureObject.m_sFeatureState = FEATURE_FACTORY_DENIED_STATE;
  38. }
  39. oNewFeatureObject.m_sFeatureName = sFeatureName;
  40. if (oNewFeatureObject instanceof AFeatureObject)
  41. {
  42. oNewFeatureObject.m_sFeatureState = FEATURE_FACTORY_INITIALIZED_STATE;
  43. }
  44. return oNewFeatureObject;
  45. };
  46. CFeatureObjectFactory.prototype.createUnregisteredFeatureObject = function ()
  47. {
  48. oNewFeatureObject = new Object();
  49. oNewFeatureObject.m_sFeatureState = FEATURE_FACTORY_INITIALIZATION_FAILED_STATE;
  50. return oNewFeatureObject;
  51. };