Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGIllegalArgumentException


    }

    public synchronized void insertPortlet(WGPortlet portlet) throws WGAPIException {
       
        if (portlet.isRoot()) {
            throw new WGIllegalArgumentException("Cannot insert a root portlet");   
        }

       
       
        List portletKeys = getPortletIds(portlet.getApplicationDb());
View Full Code Here


    }

    public void removePortlet(WGPortlet portlet) throws WGAPIException {
       
        if (portlet.isRoot()) {
            throw new WGIllegalArgumentException("Cannot remove the root portlet");   
        }
       
        // First unregister child portlets
        Iterator<WGPortlet> children = getChildPortlets(portlet).iterator();
        while (children.hasNext()) {
View Full Code Here

    @Override
    public void updatePortlet(WGPortlet portletToUpdate) throws WGIllegalArgumentException {
       
        if (portletToUpdate.isRoot()) {
            throw new WGIllegalArgumentException("Cannot update the root portlet");   
        }
       
        List regs = _profile.getPortletkeys();
        for (int idx=0; idx < regs.size(); idx++) {
            String reg = (String) regs.get(idx);
            WGPortlet portlet = deserializePortlet(reg, portletToUpdate.getApplicationDb());
           
            // We do not need to check appDb here bc. in this portlet registry impl the appDb is implicitly contained in the portlet key
            if (portlet.getKey().equals(portletToUpdate.getKey())) {
                regs.set(idx, serializePortlet(portletToUpdate));
                return;
            }
        }
       
        throw new WGIllegalArgumentException("No portlet of id '" + portletToUpdate.getKey() + "' has yet been registered");
    }
View Full Code Here

            // See if a file of that name is already attached
            String convertedFileName = _parent.convertFileNameForAttaching(file.getName());
            if (_content != null) {
                if (_content.getFiles().containsKey(convertedFileName)) {
                  // B0000471E
                    throw new WGIllegalArgumentException("A file with the same name '" + convertedFileName + "' is already attached on this document, please remove it first.");
                }
            }
            else {
                FileContainer cont = (FileContainer) _entity;
                if (cont.getFiles().containsKey(convertedFileName)) {
                  // B0000471E
                  throw new WGIllegalArgumentException("A file with the same name '" + convertedFileName + "' is already present in this file container, please remove it first.");
                }
            }
           
            // Load the data
            InputStream in = new BufferedInputStream(new FileInputStream(file));
            Blob blob = Hibernate.createBlob(in);

            // Create entity and attach to parent entity
            // TB
            if (_content != null) {
                ContentFile fileAtt = new ContentFile();
                fileAtt.setParentcontent(_content);
                fileAtt.setName(convertedFileName);
                fileAtt.setData(blob);
               
                ContentFile oldFile = (ContentFile) _content.getFiles().put(convertedFileName, fileAtt);
                if (oldFile != null && oldFile != fileAtt) {
                    _parent.getSession().evict(oldFile);
                }
            }
            else {
                FileContainer cont = (FileContainer) _entity;
                ContainerFile fileAtt = new ContainerFile();
                fileAtt.setParentcontainer(cont);
                fileAtt.setName(convertedFileName);
                fileAtt.setData(blob);
                ContainerFile oldFile = (ContainerFile) cont.getFiles().put(convertedFileName, fileAtt);
                if (oldFile != null && oldFile != fileAtt) {
                    _parent.getSession().evict(oldFile);
                }
            }
        }
        catch (FileNotFoundException e) {
            throw new WGIllegalArgumentException("Error attaching file - not found.", e);
        }
        catch (IOException e) {
            throw new WGBackendException("Error attaching file.", e);
        }
  }
View Full Code Here

      String convertedFileName = _parent.convertFileNameForAttaching(file
          .getName());
      if (_content != null) {
        if (_content.getFiles().containsKey(convertedFileName)) {
          // B0000471E
          throw new WGIllegalArgumentException(
              "A file with the same name '"
                  + convertedFileName
                  + "' is already attached on this document, please remove it first.");
        }
      } else {
        FileContainer cont = (FileContainer) _entity;
        if (cont.getFiles().containsKey(convertedFileName)) {
          // B0000471E
          throw new WGIllegalArgumentException(
              "A file with the same name '"
                  + convertedFileName
                  + "' is already present in this file container, please remove it first.");
        }
      }
View Full Code Here

        if ((_entity instanceof Content || _entity instanceof UserProfile) == false) {
            String className = null;
            if (_entity != null) {
                className = _entity.getClass().getName();
            }           
            throw new WGIllegalArgumentException("Cannot remove item on document of type '" + className + "' - doctype has no items.");
        }

        if (_content != null) {
            Hibernate.initialize(_content.getItems());
            ContentItem item = (ContentItem) _content.getItems().get(name);
View Full Code Here

                XStream xstream = new XStream(new Dom4JDriver());
                String serializedValue = xstream.toXML(value);
                item.setText(serializedValue);
                item.setType(ITEMTYPE_SERIALIZED_XSTREAM);
            } catch (Exception e) {
                throw new WGIllegalArgumentException("Unable to serialize item value." , e);
            }
        }
    }
View Full Code Here

                else {
                    try {
                        value = new Integer(String.valueOf(value));
                    }
                    catch (NumberFormatException e) {
                        throw new WGIllegalArgumentException("Cannot parse metadata type'" + name + "' as number. Value:" + value, e);
                    }

                }
            }
           
View Full Code Here

     
      String convertedOldFileName = _parent.convertFileNameForAttaching(oldFileName);
      String convertedNewFileName = _parent.convertFileNameForAttaching(newFileName);
      if (_content != null) {
        if (_content.getFiles().containsKey(convertedNewFileName)) {
          throw new WGIllegalArgumentException("A file with the same name '" + convertedNewFileName + "' is already attached on this document, please remove it first.");
        }
       
        Hibernate.initialize(_content.getFiles());
        ContentFileMeta meta = (ContentFileMeta) _content.getFiles().remove(convertedOldFileName);
        if (meta != null) {
          meta.setName(convertedNewFileName);
          _content.getFiles().put(meta.getName(), meta);
          meta.setLastmodified(new Date());
        }       
      }
      else {
        FileContainer cont = (FileContainer) _entity;
        if (cont.getFiles().containsKey(convertedNewFileName)) {
          throw new WGIllegalArgumentException("A file with the same name '" + convertedNewFileName + "' is already present in this file container, please remove it first.");
        }
       
        Hibernate.initialize(cont.getFiles());
        ContainerFileMeta meta = (ContainerFileMeta) cont.getFiles().remove(convertedOldFileName);
        if (meta != null) {
View Full Code Here

                metaData.setExtensionDataHandler(new FileExtDataHandler(_parent, metaEntity));
            }
            return metaData;
        }
        else {
          throw new WGIllegalArgumentException("Unsupported entity type '" + metaEntity.getClass().getName() + "'.");
        }
      }
     
      else {
        // file not found
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.WGIllegalArgumentException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.