public String delete() {
    try {
      TableMappingInterface dataMappingInterface = (TableMappingInterface) this.getItemInterface();

      String id = (String) dataMappingInterface.getKey();
      InventoryEntityFactory.getInstance()
          .getInventoryEntityInstance()
          .deleteWhere(BasicItemData.ID, id);

      StringBuffer stringBuffer = new StringBuffer();

      stringBuffer.append("Successfully Removed the item with ");
      stringBuffer.append(BasicItemData.ID);
      stringBuffer.append("=");
      stringBuffer.append(id);
      stringBuffer.append(" from to the Inventory table");

      String success = stringBuffer.toString();

      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.SQLTAGS)) {
        LogUtil.put(LogFactory.getInstance(success, this, "doStartTag()"));
      }
      return success;
    } catch (Exception e) {
      String error = "Failed to remove item with from Inventory";

      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.SQLTAGSERROR)) {
        LogUtil.put(LogFactory.getInstance(error, this, "doStartTag()", e));
      }
      return error;
    }
  }
Exemplo n.º 2
0
  public String restore() {
    try {
      String success = "Restore Successful";
      String result =
          QuoteRequestEntityFactory.getInstance()
              .getQuoteRequestEntityInstance()
              .restoreTable(this.portion);

      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.SQLTAGS)) {
        LogUtil.put(LogFactory.getInstance(success, this, "restore()"));
      }

      return result;
    } catch (Exception e) {
      String error = "Failed to restore backup";

      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.SQLTAGSERROR)) {
        LogUtil.put(LogFactory.getInstance(error, this, "restore()", e));
      }

      return error;
    }
  }
Exemplo n.º 3
0
  protected void destroyApp(boolean unconditional) {
    final String METHOD_NAME = "GameMidlet::destroyApp";
    try {
      PreLogUtil.put(AllGameStatisticsFactory.getInstance().toString(), this, METHOD_NAME);
      // LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, METHOD_NAME));

      GameAdState gameAdState = GameAdStateFactory.getInstance().getCurrentInstance();

      gameAdState.getAdvertisements().stopAll();

      if (!this.isDestroyed()) {
        this.stopGameCanvasRunnableInterface();
        this.setGameCanvasRunnableInterface(null);
        // if(!AppletUtil.isAppletLoader(this))
        // {
        this.mediaShutdown();
        // }
      } else {
        LogUtil.put(
            LogFactory.getInstance(
                "Midlet Managment Error: Midlet Should Only Be Destroyed Once", this, METHOD_NAME));
      }

      super.destroyApp(true);

      // LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().END, this, METHOD_NAME));
      PreLogUtil.put(CommonStrings.getInstance().END, this, METHOD_NAME);
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, METHOD_NAME, e));
    }
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().END, this, METHOD_NAME));
    PreLogUtil.put(CommonStrings.getInstance().END, this, METHOD_NAME);
  }
  public String insert() throws Exception {
    try {
      TableMappingInterface dataMappingInterface = (TableMappingInterface) this.getItemInterface();

      Vector values = dataMappingInterface.toVector();

      InventoryEntityFactory.getInstance().getInventoryEntityInstance().insert(values);

      String success = "Successfully Added Product";

      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.SQLTAGS)) {
        LogUtil.put(LogFactory.getInstance(success, this, "insert()"));
      }
      return success;
    } catch (Exception e) {
      String error = "Failed to add item to Inventory";

      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.SQLTAGSERROR)) {
        LogUtil.put(LogFactory.getInstance(error, this, "insert()", e));
      }
      return error;
    }
  }
  public GenericProfile(Node node) {
    this.setName(DomNodeHelper.getTextNodeValue(node));
    this.vector = new Vector();

    NodeList nodeList = node.getChildNodes();

    LogUtil.put(
        LogFactory.getInstance(
            "Name: " + this.getName() + " Child Nodes: " + nodeList.getLength(),
            this,
            "Contructor"));

    for (int index = 0; index < nodeList.getLength(); index++) {
      Node profileNode = nodeList.item(index);

      if (profileNode.getNodeName().compareTo(GenericProfileDataWorkerData.NAME) == 0) {
        GenericProfileDataWorkerType genericProfileDataWorkerType =
            GenericProfileDataWorkerType.getInstance(profileNode);
        LogUtil.put(
            LogFactory.getInstance(
                "Adding GenericProfileDataWorkerType: " + genericProfileDataWorkerType.toString(),
                this,
                "Contructor"));
        this.vector.add(genericProfileDataWorkerType);
      }
    }
  }
  public String validationInfo() throws Exception {
    StringBuffer stringBuffer = new StringBuffer();

    String command = (String) this.getRequestHashMap().get(GLOBALS.ADMINCOMMAND);
    if (command == null || command.compareTo(UPDATEPRODUCT) != 0) {
      return CommonSeps.getInstance().SPACE;
    }

    stringBuffer.append(new BasicItemValidation(this.itemInterface).validationInfo());

    StoreFrontInterface storeFrontInterface =
        StoreFrontFactory.getInstance(this.getWeblisketSession().getStoreName());

    String fullCategory =
        (String) URLGLOBALS.getWebappPath()
            + storeFrontInterface.getCurrentHostNamePath()
            + // storeFrontInterface.getCategoryPath() +
            this.itemInterface.getCategory();

    if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
        abcs.logic.communication.log.config.type.LogConfigType.VIEW)) {
      LogUtil.put(LogFactory.getInstance("Category: " + fullCategory, this, "validationInfo()"));
    }

    try {
      if (InventoryEntityFactory.getInstance()
              .getInventoryEntityInstance()
              .getItem(this.itemInterface.getId())
          == null) {
        stringBuffer.append("Item does not exist.<br>");
      }
    } catch (MoneyException e) {
      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.VIEW)) {
        LogUtil.put(
            LogFactory.getInstance("Existing Item With MoneyException", this, "validationInfo()"));
      }
    }

    Object object = this.getRequestHashMap().get(BasicItemData.IMAGE);

    if (HttpFileUploadUtil.getInstance().isValid(object)) {
      FileItem fileItem = (FileItem) object;

      long size = fileItem.getSize();
      String fileName = fileItem.getName();
      String fileItemFieldName = fileItem.getFieldName();

      this.validationInfo(stringBuffer, fileName, fileItemFieldName, size);
    }

    // else stringBuffer.append("Image File Form Data Error");

    return stringBuffer.toString();
  }
  public static DomNodeInterface getInstance(String storeName) // throws LicensingException
      {
    try {
      StoreFrontsEntity storeFronts =
          StoreFrontsEntityFactory.getInstance().getStoreFrontsEntityInstance();

      return (DomNodeInterface) new StoreFrontView(storeFronts.getStoreFrontInterface(storeName));
    }
    /*
    catch(LicensingException e)
    {
       String error = "Failed to get instance";
       if(abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(abcs.logic.communication.log.config.type.LogConfigType.FACTORYERROR))
       {
          LogUtil.put(error,"StoreFrontFactory","getInstance()",e);
       }
       //throw e;
       return null;
    }
     */
    catch (Exception e) {
      String error = "Failed to get instance";
      if (org.allbinary.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          org.allbinary.logic.communication.log.config.type.LogConfigType.FACTORYERROR)) {
        LogUtil.put(LogFactory.getInstance(error, "StoreFrontFactory", "getInstance()", e));
      }
      return null;
    }
  }
Exemplo n.º 8
0
  public boolean after(String text, String after) {
    try {
      int index = this.string.indexOf(after);

      if (index < 0) {
        System.out.println("No such start: " + after + " in: " + this.string);
        return false;
      }

      index = index + after.length();

      String start = this.string.substring(0, index);

      String end = this.string.substring(index + 1, this.string.length());

      FileOutputStream idFile = new FileOutputStream(this.fileName);
      DataOutputStream idOutData = new DataOutputStream(idFile);
      idOutData.writeBytes(start + text + end);
      // System.out.println("Output: " + start + text + end);

      idOutData.close();
      idFile.close();

      return true;
    } catch (Exception e) {
      if (org.allbinary.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          org.allbinary.logic.communication.log.config.type.LogConfigType.IDLOGGING)) {
        LogUtil.put(
            LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "after", e));
      }
      return false;
    }
  }
  private Boolean isValid(String fileName, long size) throws Exception {
    FileData fileData = FileData.getInstance();

    if (size > fileData.MINIMAGEFILESIZE) {
      if (size < fileData.MAXIMAGEFILESIZE) {
        if (!StringValidationUtil.getInstance()
            .isValidRequired(fileName, fileData.MINLEN, fileData.MAXLEN)) {
          return Boolean.FALSE;
        }
      } else {
        if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
            abcs.logic.communication.log.config.type.LogConfigType.VIEW)) {
          StringBuffer stringBuffer = new StringBuffer();

          stringBuffer.append("File Size To Large: ");
          stringBuffer.append(size);
          stringBuffer.append(">");
          stringBuffer.append(fileData.MAXIMAGEFILESIZE);

          LogUtil.put(LogFactory.getInstance(stringBuffer.toString(), this, "isValid()"));
        }
        return Boolean.FALSE;
      }
      this.processImageFiles();
    }
    return Boolean.TRUE;
  }
 static {
   try {
     LogUtil.put(
         LogFactory.getInstance("Start", "CapturedBufferedImagesCacheSingleton", "Static Block"));
     cacheInterface =
         (AutomaticCacheInterface)
             CacheInterfaceFactory.getInstance(
                 (CacheTypeFactory.getInstance().SHIFT_ONE_CACHE_SET),
                 (CachePolicyFactory.getInstance().ONE_MINUTE_FIVE_MAX));
     LogUtil.put(
         LogFactory.getInstance("End", "CapturedBufferedImagesCacheSingleton", "Static Block"));
   } catch (Exception e) {
     LogUtil.put(
         LogFactory.getInstance(
             "Exception", "CapturedBufferedImagesCacheSingleton", "Static Block", e));
   }
 }
  public String update() {
    try {
      // TWB - JIQL has problem updated with commas so a short fix is to delete and then insert
      this.delete();
      this.insert();
      /*
      TableMappingInterface dataMappingInterface =
          (TableMappingInterface) this.getItemInterface();

      HashMap hashMap = dataMappingInterface.toHashMap();
      InventoryEntityFactory.getInstance().getInventoryEntityInstance().update(hashMap);

      String number = this.getItemInterface().getNumber();
      if (number != null && !StringValidationUtil.isNumber(number))
      {
          Long numberLong = new Long(number);
          long number_long = numberLong.longValue();
          if (number_long == 0)
          {
              //send event when product is unavailable
          } else if (number_long > 0)
          {
              //send event when product is unavailable
          } else
          {
              throw new Exception("Sanity Check On Number Of Items In Stock");
          }
      }
      */

      String success = "Item Successfully Updated";
      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.SQLTAGS)) {
        LogUtil.put(LogFactory.getInstance(success, this, "update()"));
      }
      return success;
    } catch (Exception e) {
      String error = "Failed To Update Item";
      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.SQLTAGSERROR)) {
        LogUtil.put(LogFactory.getInstance(error, this, "update()", e));
      }
      return error;
    }
  }
  // Graphics.HCENTER & Graphics.TOP
  public void scrollY(int anchor) throws Exception {
    AllBinaryTiledLayer terrainTiledLayer = geographicMapInterface.getAllBinaryTiledLayer();
    DisplayInfoSingleton displayInfo = DisplayInfoSingleton.getInstance();

    if (anchor == Graphics.TOP) {
      LogUtil.put(LogFactory.getInstance("Top", this, "scrollY"));
    } else if (anchor == Graphics.BOTTOM) {
      LogUtil.put(LogFactory.getInstance("Bottom", this, "scrollY"));
      int diffY = (terrainTiledLayer.getHeight() - displayInfo.getLastHeight());
      this.move(0, diffY);
    } else if (anchor == Graphics.VCENTER) {
      LogUtil.put(LogFactory.getInstance("Center", this, "scrollY"));
      // Already sees bottom but I want the map at the Center
      int diffY = (terrainTiledLayer.getHeight() - displayInfo.getLastHeight()) / 2;
      this.move(0, diffY);
    } else {
      throw new Exception("No Such Anchor Supported");
    }
  }
Exemplo n.º 13
0
  protected void pauseAppBackground(boolean background) {
    final String METHOD_NAME = "pauseAppBackground";
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, METHOD_NAME));
    // PreLogUtil.put(CommonStrings.getInstance().START, this, METHOD_NAME);

    if (allbinaryGameCanvasRunnableInterface != null) {
      allbinaryGameCanvasRunnableInterface.pause();
      /*
      if (!allbinaryGameCanvasRunnableInterface.isPaused())
      {
          allbinaryGameCanvasRunnableInterface.pause();
      }
       */
    } else {
      LogUtil.put(LogFactory.getInstance("<<<<<< Null", this, METHOD_NAME));
    }

    AllBinarySensorManager.getInstance().shutdown();
  }
  /** Creates new form ColorAtActionJPanel */
  public AlwaysActionScriptConditionJPanel(
      AlwaysActionScriptConditionInterface alwaysActionScriptConditionInterface) {
    LogUtil.put(LogFactory.getInstance("Start", this, "Constructor"));

    initComponents();

    this.alwaysActionScriptConditionInterface = alwaysActionScriptConditionInterface;

    this.set();
  }
Exemplo n.º 15
0
  public String drop() {
    try {
      String success =
          QuoteRequestEntityFactory.getInstance().getQuoteRequestEntityInstance().dropTable();

      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.SQLTAGS)) {
        LogUtil.put(LogFactory.getInstance(success, this, "drop()"));
      }
      return success;
    } catch (Exception e) {
      String error = "Failed to drop QuoteRequest table";
      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.SQLTAGSERROR)) {
        LogUtil.put(LogFactory.getInstance(error, this, "drop()", e));
      }
      return error;
    }
  }
Exemplo n.º 16
0
 public Boolean isValid() {
   try {
     return Boolean.TRUE;
   } catch (Exception e) {
     if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
         abcs.logic.communication.log.config.type.LogConfigType.VIEWERROR)) {
       LogUtil.put(LogFactory.getInstance("Failed to validate", this, "isValid()", e));
     }
     return Boolean.FALSE;
   }
 }
Exemplo n.º 17
0
  protected void startApp() {
    try {
      GameAdState gameAdState = GameAdStateFactory.getInstance().getCurrentInstance();

      gameAdState.getAdvertisements().startAll();

      final String START_APP = "startApp";

      LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, START_APP));
      // PreLogUtil.put(CommonStrings.getInstance().START, this, START_APP);

      GameCanvasRunnableInterface gameCanvasRunnableInterface =
          this.allbinaryGameCanvasRunnableInterface;

      // If the first time/null then start demo or unpausing
      // thus start up only occurs one time ever otherwise this is just unpause
      if (gameCanvasRunnableInterface == null) {
        gameMidletStateFactory.setCurrentGameState(GameState.NO_GAME_STATE);
        this.setDemo();
      } else {
        LogUtil.put(
            LogFactory.getInstance("GameCanvasRunnableInterface is available", this, START_APP));

        // Starting midlet after a previous start means that we only unpause the
        // GameCanvasRunnableInterface if it is currently displayed
        if (gameCanvasRunnableInterface == this.getCurrentDisplayable()) {
          this.unPauseAppBackground(false);
        } else {
          LogUtil.put(
              LogFactory.getInstance(
                  "GameCanvasRunnableInterface is not current displayable", this, START_APP));
        }
      }
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "startApp", e));
      destroyApp(false);
      // TWB - Only remove from context when multiple midlets share the same emulator
      notifyDestroyed();
    }
  }
  public void init() throws Exception {
    LogUtil.put(LogFactory.getInstance("Start", this, "init"));

    PCKeyFactory.getInstance();

    super.init();

    if (this.getTotalMapped() == 0 || this.isDefaultNew()) {
      this.getInputMapping().add(this.getDefault());
      this.save();
    }
  }
  public Object getInstance(HashMap hashMap, PageContext pageContext) throws LicensingException {
    try {
      return new BasketRequestHelper(hashMap, pageContext);
    } catch (Exception e) {
      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.TAGHELPERFACTORYERROR)) {
        String error = "Failed To Get Instance";

        LogUtil.put(LogFactory.getInstance(error, this, "getInstance(HashMap, PageContext)", e));
      }
      return null;
    }
  }
Exemplo n.º 20
0
  protected void unPauseAppBackground(boolean background) {
    final String METHOD_NAME = "unPauseAppBackground";
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, METHOD_NAME));
    // PreLogUtil.put(CommonStrings.getInstance().START, this, METHOD_NAME);

    AllBinarySensorManager.getInstance().init();

    GameCanvasRunnableInterface gameCanvasRunnableInterface =
        this.allbinaryGameCanvasRunnableInterface;

    if (gameCanvasRunnableInterface != null) {
      gameCanvasRunnableInterface.unPause();
      /*
      if (gameCanvasRunnableInterface.isPaused())
      {
          gameCanvasRunnableInterface.unPause();
      }
      */
    } else {
      LogUtil.put(LogFactory.getInstance("<<<<<< Null", this, METHOD_NAME));
    }
  }
Exemplo n.º 21
0
  protected void stopGameCanvasRunnableInterface() throws Exception {
    LogUtil.put(
        LogFactory.getInstance(
            CommonStrings.getInstance().START, this, "stopGameCanvasRunnableInterface"));

    GameNotificationEventHandler.getInstance().removeAllListeners();
    ColorChangeEventHandler.getInstance().removeAllListeners();
    GameEventHandlerUtil.removeAllListeners();

    // TWB- Depends on the phone - emulators like it without but i think my
    // sprint phone needed a null canvas
    // this.setDisplay((Displayable) new ProgressCanvas(this));

    GameCanvasRunnableInterface gameCanvasRunnableInterface =
        this.allbinaryGameCanvasRunnableInterface;
    if (gameCanvasRunnableInterface != null) {
      LogUtil.put(
          LogFactory.getInstance("Set Running False", this, "stopGameCanvasRunnableInterface"));
      gameCanvasRunnableInterface.setRunning(false);
    } else {
      LogUtil.put(
          LogFactory.getInstance(
              "StopGame - Could Not Stop", this, "stopGameCanvasRunnableInterface"));
    }

    // Wait for the thread to end then continue
    ThreadUtil.getInstance().join(this.thread);

    if (Features.getInstance().isFeature(MainFeatureFactory.getInstance().LOAD_ALL)) {
      ProgressCanvasFactory.getInstance().addPortion(50, "Stopped Game Runnable");
    } else {
      ProgressCanvasFactory.getInstance().addPortion(50, "Stopped Main Runnable");
    }

    LogUtil.put(
        LogFactory.getInstance(
            CommonStrings.getInstance().END, this, "stopGameCanvasRunnableInterface"));
  }
Exemplo n.º 22
0
 public boolean atEnd(String text) {
   try {
     FileOutputStream idFile = new FileOutputStream(this.fileName);
     DataOutputStream idOutData = new DataOutputStream(idFile);
     idOutData.writeBytes(this.string + text);
     return true;
   } catch (Exception e) {
     if (org.allbinary.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
         org.allbinary.logic.communication.log.config.type.LogConfigType.IDLOGGING)) {
       LogUtil.put(
           LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "insertAtEnd", e));
     }
     return false;
   }
 }
  public void init() throws Exception {
    LogUtil.put(LogFactory.getInstance("Start", this, "init"));

    PCKeyFactory.getInstance();
    TouchMotionGestureFactory.getInstance();
    TrackballMotionGestureFactory.getInstance();
    // OrientationMotionGestureFactory.getInstance();
    BasicTouchInputFactory.getInstance();

    super.init();

    if (this.getTotalMapped() == 0 || this.isDefaultNew()) {
      this.getInputMapping().add(this.getDefault());
      this.save();
    }
  }
Exemplo n.º 24
0
  public String validationInfo() {
    try {
      StringBuffer stringBuffer = new StringBuffer();

      stringBuffer.append("Please Contact Administrator");

      return stringBuffer.toString();
    } catch (Exception e) {
      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.VIEWERROR)) {
        LogUtil.put(
            LogFactory.getInstance(
                "Failed to generate validation error info", this, "validationInfo()", e));
      }
      return "Error Getting Validation Info";
    }
  }
Exemplo n.º 25
0
  public Hashtable getCurrentStateHashtable() throws Exception {
    LogUtil.put(
        LogFactory.getInstance(
            CommonStrings.getInstance().START, this, "getCurrentStateHashtable"));
    Hashtable hashtable = new Hashtable();

    if (this.allbinaryGameCanvasRunnableInterface != null) {
      Hashtable currentHashtable =
          this.allbinaryGameCanvasRunnableInterface.getCurrentStateHashtable();
      Enumeration enumeration = currentHashtable.keys();
      while (enumeration.hasMoreElements()) {
        Object key = enumeration.nextElement();
        hashtable.put(key, currentHashtable.get(key));
      }
    }

    return hashtable;
  }
Exemplo n.º 26
0
  protected void startGameCanvasRunnableInterface() throws Exception {
    // LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this,
    // "startGameCanvasRunnableInterface"));
    thread =
        thread =
            ThreadFactoryUtil.getInstance().getInstance(this.allbinaryGameCanvasRunnableInterface);

    LogUtil.put(
        LogFactory.getInstance(
            "Thread Priority: " + thread.getPriority(), this, "startGameCanvasRunnableInterface"));

    // canvasThread.setPriority(Thread.NORM_PRIORITY + 2);
    // thread.setPriority(Thread.MAX_PRIORITY);

    this.allbinaryGameCanvasRunnableInterface.setThread(thread);

    thread.start();
  }
  private NoGameNotificationHudSingleton() {
    try {
      BasicHudFactory basicHudFactory = BasicHudFactory.getInstance();

      this.gameNotificationHud =
          new GameNotificationHud(
              basicHudFactory.TOPCENTER,
              basicHudFactory.HORIZONTAL,
              14,
              40,
              2,
              BasicColorFactory.getInstance().RED);
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(
              CommonStrings.getInstance().EXCEPTION,
              this,
              CommonStrings.getInstance().CONSTRUCTOR,
              e));
    }
  }
  public void processInput(AllBinaryLayerManager layerManager) throws Exception {
    try {
      int size = inputList.size();
      int key = 0;

      for (int index = 0; index < size; index++) {
        GameKeyEvent gameKeyEvent = (GameKeyEvent) inputList.get(index);
        key = gameKeyEvent.getKey();

        this.processInput(key);
      }

      if (isSingleKeyProcessing) {
        this.clear();
      } else {
        this.update();
      }

    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "processInput", e));
    }
  }
Exemplo n.º 29
0
  public String email() throws Exception {
    try {
      final QuoteRequestEntity quoteRequestEntity =
          QuoteRequestEntityFactory.getInstance().getQuoteRequestEntityInstance();

      final String userName = this.weblisketSession.getUserName();

      Vector vector = quoteRequestEntity.getIds(userName);

      int id = 0;

      // get last quote request
      for (int index = 0; index < vector.size(); index++) {
        int nextId = ((Integer) vector.get(index)).intValue();
        if (id < nextId) {
          id = nextId;
        }
      }

      QuoteRequest quoteRequest = quoteRequestEntity.get(userName, id);

      if (quoteRequest != null) {
        this.emailUser(quoteRequest);
        this.emailAdmins(quoteRequest);

        return "Thank You For Your Business.<p/>";
      } else {
        throw new Exception("No Quote Request");
      }
    } catch (Exception e) {
      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.EMAILLOGGINGERROR)) {
        LogUtil.put(LogFactory.getInstance(this.commonStrings.FAILURE, this, "email", e));
      }
      return "Thank You For Your Business.<p>";
    }
  }
  public Boolean isValid() {
    try {
      String command = (String) this.getRequestHashMap().get(GLOBALS.ADMINCOMMAND);

      if (command == null || command.compareTo(UPDATEPRODUCT) != 0) {
        if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
            abcs.logic.communication.log.config.type.LogConfigType.VIEW)) {
          LogUtil.put(LogFactory.getInstance("Invalid AdminCommand=" + command, this, "isValid()"));
        }
        return Boolean.FALSE;
      }

      if (new BasicItemValidation(this.itemInterface).isValid() == Boolean.FALSE) {
        if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
            abcs.logic.communication.log.config.type.LogConfigType.VIEW)) {
          LogUtil.put(LogFactory.getInstance("BasicItem is not valid", this, "isValid()"));
        }
        return Boolean.FALSE;
      }

      StoreFrontInterface storeFrontInterface =
          StoreFrontFactory.getInstance(this.getWeblisketSession().getStoreName());

      StringBuffer stringBuffer = new StringBuffer();

      stringBuffer.append(URLGLOBALS.getWebappPath());
      stringBuffer.append(storeFrontInterface.getCurrentHostNamePath());
      // storeFrontInterface.getCategoryPath() +
      stringBuffer.append(this.itemInterface.getCategory());

      String fullCategory = stringBuffer.toString();

      AbFile categoryFile = new AbFile(fullCategory);
      if (!categoryFile.isDirectory()) {
        if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
            abcs.logic.communication.log.config.type.LogConfigType.VIEW)) {
          LogUtil.put(
              LogFactory.getInstance(
                  "Category Does Not Exist: " + fullCategory, this, "isValid()"));
        }
        return Boolean.FALSE;
      }

      InventoryEntity inventoryEntity =
          InventoryEntityFactory.getInstance().getInventoryEntityInstance();

      if (inventoryEntity.getItem(this.itemInterface.getId()) == null) {
        return Boolean.FALSE;
      }

      Object object = this.getRequestHashMap().get(BasicItemData.IMAGE);

      if (HttpFileUploadUtil.getInstance().isValid(object)) {
        FileItem fileItem = (FileItem) object;

        long size = fileItem.getSize();
        String fileName = fileItem.getName();

        HttpFileUploadUtil.log(fileItem);

        if (this.isValid(fileName, size) == Boolean.FALSE) {
          return Boolean.FALSE;
        }
      }

      return Boolean.TRUE;
    } catch (Exception e) {
      if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          abcs.logic.communication.log.config.type.LogConfigType.VIEW)) {
        LogUtil.put(LogFactory.getInstance("Exception in validation", this, "isValid()", e));
      }

      return Boolean.FALSE;
    }
  }