Package com.dotmarketing.business

Examples of com.dotmarketing.business.DotStateException


  public void save(Folder folder, String existingId, User user, boolean respectFrontEndPermissions) throws DotDataException, DotStateException, DotSecurityException {

    Identifier id = APILocator.getIdentifierAPI().find(folder.getIdentifier());
    if(id ==null || !UtilMethods.isSet(id.getId())){
      throw new DotStateException("folder must already have an identifier before saving");
    }

    Host host = APILocator.getHostAPI().find(folder.getHostId(), user, respectFrontEndPermissions);
    Folder parentFolder = findFolderByPath(id.getParentPath(), id.getHostId(), user, respectFrontEndPermissions);
    Permissionable parent = id.getParentPath().equals("/")?host:parentFolder;
    String name = id.getParentPath().equals("/")?host.getHostname():parentFolder.getName();


    if(parent ==null){
      throw new DotStateException("No Folder Found for id: " + id.getParentPath());
    }
    if (!papi.doesUserHavePermission(parent, PermissionAPI.PERMISSION_CAN_ADD_CHILDREN, user,respectFrontEndPermissions)
        || !papi.doesUserHavePermissions(PermissionableType.FOLDERS, PermissionAPI.PERMISSION_EDIT, user)) {
      throw new DotSecurityException("User " + user + " does not have permission to add to " + name);
    }
View Full Code Here


    HttpServletRequest req = ctx.getHttpServletRequest();
    User user = userWebAPI.getLoggedInUser(req);
    boolean respectFrontendRoles = !userWebAPI.isLoggedToBackend(req);
    Host host = hostAPI.find(id, user, respectFrontendRoles);
    if(host.isDefault())
      throw new DotStateException("the default host can't be archived");
    hostAPI.archive(host, user, respectFrontendRoles);
  }
View Full Code Here

    HttpServletRequest req = ctx.getHttpServletRequest();
    User user = userWebAPI.getLoggedInUser(req);
    boolean respectFrontendRoles = !userWebAPI.isLoggedToBackend(req);
    Host host = hostAPI.find(id, user, respectFrontendRoles);
    if(host.isDefault())
      throw new DotStateException("the default host can't be deleted");
    hostAPI.delete(host, user, respectFrontendRoles, true);
  }
View Full Code Here

  @Override
  protected HTMLPage add(HTMLPage htmlPage) throws DotStateException, DotDataException, DotSecurityException {
    String key = primaryGroup + htmlPage.getIdentifier();
   
    if(!htmlPage.isLive()){
      throw new DotStateException("HTMLPageCache is only designed (for now) to store live versions");
    }
   
        // Add the key to the cache
        cache.put(key, htmlPage, primaryGroup);
View Full Code Here

            obj = clazz.newInstance();

            if ( obj instanceof Treeable ) {
                tableName = ((Treeable) obj).getType();
            } else {
                throw new DotStateException( "Unable to getType for child asset" );
            }
        } catch ( InstantiationException e ) {
            throw new DotStateException( "Unable to getType for child asset" );
        } catch ( IllegalAccessException e ) {
            throw new DotStateException( "Unable to getType for child asset" );
        }

        String versionTable = UtilMethods.getVersionInfoTableName( tableName );

        HibernateUtil dh = new HibernateUtil( clazz );
View Full Code Here

      String cInode = req.getParameter("contentlet");
      if(InodeUtils.isSet(cInode)){
        contentlet = conAPI.find(cInode, user, true)
      }
      if(contentlet == null){
        throw new DotStateException("Trying to edit an invalid contentlet - inode:" + cInode);
      }
      Container container = (Container) InodeFactory.getInode(req.getParameter("container"), Container.class);
      HTMLPage htmlPage = (HTMLPage) InodeFactory.getInode(req.getParameter("htmlPage"), HTMLPage.class);

      Logger.debug(DirectorAction.class, "contentlet=" + contentlet.getInode());
View Full Code Here

 
  public PermissionAPI perAPI = APILocator.getPermissionAPI();

  public void createBaseWidgetFields(Structure structurethrows DotDataException,DotStateException {
    if(!InodeUtils.isSet(structure.getInode())){
      throw new DotStateException("Cannot create base widget feilds on a structure that doesn't exist");
    }
    Field preExecute = new Field(WIDGET_PRE_EXECUTE_FIELD_NAME,Field.FieldType.HIDDEN,Field.DataType.TEXT,structure,false,false,false,4,"", "", "", true, true, true);
    preExecute.setFieldContentlet(FieldAPI.ELEMENT_CONSTANT);
    Field codeField = new Field(WIDGET_CODE_FIELD_NAME,Field.FieldType.HIDDEN,Field.DataType.TEXT,structure,false,false,false,3,"", "", "", true, true, true);
    codeField.setFieldContentlet(FieldAPI.ELEMENT_CONSTANT);
View Full Code Here

          }
         for(String title : containersInUse.values()){
           names.append(title).append("</br>");
         }
         if(UtilMethods.isSet(names.toString()))
           throw new DotStateException("Structure " + st.getName() +
                         " can't be deleted because the following containers are using it: " + names);

        // default structure can't be deleted
        if(st.isDefaultStructure())
            throw new DotStateException("Can't delete default structure");

        // deleting fields
        for(Field field : FieldFactory.getFieldsByStructure(st.getInode()))
            FieldFactory.deleteField(field);
View Full Code Here

  public File getFileAsset() {
    try {
      return getBinary(FileAssetAPI.BINARY_FIELD);
    } catch (IOException e) {
      throw new DotStateException("Unable to find the fileAsset for :" + this.getInode());
    }
  }
View Full Code Here

  public PermissionAPI perAPI = APILocator.getPermissionAPI();
  public ContentletAPI conAPI = APILocator.getContentletAPI();

  public void createBaseFormFields(Structure structure) throws DotDataException,DotStateException {
    if(!InodeUtils.isSet(structure.getInode())){
      throw new DotStateException("Cannot create base forms fields on a structure that doesn't exist");
    }

    Field titleField = new Field(FORM_TITLE_FIELD_NAME,Field.FieldType.HIDDEN,Field.DataType.TEXT,structure,false,false,false,1,"", "", "", true, true, true);
    titleField.setFieldContentlet(FieldAPI.ELEMENT_CONSTANT);
    FieldFactory.saveField(titleField);
View Full Code Here

TOP

Related Classes of com.dotmarketing.business.DotStateException

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.