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 QuoteHelper(HashMap hashMap, PageContext pageContext) { String storeName = (String) hashMap.get(StoreFrontData.getInstance().NAME); if (storeName != null) { this.storeFrontInterface = StoreFrontFactory.getInstance(storeName); } else { this.storeFrontInterface = null; } this.weblisketSession = new WeblisketSession(hashMap, pageContext); this.portion = new Portion(hashMap); }
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; } }