Package com.claymus.site

Examples of com.claymus.site.Module


  }


  @Override
  public BlockDTO get(String encoded) throws UserException {
    Module module = ModuleData.getModule(ModuleHelper.class);
    User user = UserData.getUser();
    Block block = BlockData.getBlock(KeyFactory.stringToKey(encoded));

    int accessLevel = module.getAccessLevel(user.getRole());
    if(accessLevel >= ModuleHelper.ADD_EDIT || (accessLevel == ModuleHelper.ADD && block.getOwner().equals(user))) {
      BlockDTO blockDTO = block.getDTO();
      blockDTO.setLocations(getLocations());
      blockDTO.setRoles(getRoles());
      return blockDTO;
View Full Code Here


  }


  @Override
  public void add(BlockDTO blockDTO) throws ServerException, UserException {
    Module module = ModuleData.getModule(ModuleHelper.class);
    User user = UserData.getUser();

    int accessLevel = module.getAccessLevel(user.getRole());
    if(accessLevel < ModuleHelper.ADD)
      throw new UserException();

    BlockType blockData = BlockData.getBlockType(blockDTO.getClass().getSimpleName().replace("DTO", ""));
    Block block = new Block(blockData, blockDTO.getLocation());
View Full Code Here

      throw new ServerException("Block could not be created. Please try again later.");
  }

  @Override
  public void update(String encoded, BlockDTO blockDTO) throws ServerException, UserException {
    Module module = ModuleData.getModule(ModuleHelper.class);
    User user = UserData.getUser();
    Key key = KeyFactory.stringToKey(encoded);
    Block block = BlockData.getBlock(key);

    int accessLevel = module.getAccessLevel(user.getRole());
    if(accessLevel >= ModuleHelper.ADD_EDIT || (accessLevel == ModuleHelper.ADD && block.getOwner().equals(user))) {
      if(BlockData.updateBlock(key, blockDTO) == null)
        throw new ServerException("Block could not be saved. Please try again later.");
    } else {
      throw new UserException();
View Full Code Here

  }


  @Override
  public void saveOrder(LinkedList<String> locations, LinkedList<String> encodedList) throws ServerException, UserException {
    Module module = ModuleData.getModule(ModuleHelper.class);
    User user = UserData.getUser();

    int accessLevel = module.getAccessLevel(user.getRole());
    if(accessLevel < ModuleHelper.ADD)
      throw new UserException();

    for(int i = 0; i < locations.size(); i++) {
      LinkedList<Block> blocks = new LinkedList<Block>();
View Full Code Here

@SuppressWarnings("serial")
public class AdministerServiceImpl extends RemoteServiceServlet implements AdministerService {

  @Override
  public void setModuleAccessLevel(String moduleId, String encoded, int accessLevel) throws ServerException, UserException {
    Module module = ModuleData.getModule(ModuleHelper.class);
    UserRole userRole = UserData.getUser().getRole();

    if(module.getAccessLevel(userRole) < ModuleHelper.VIEW_N_EDIT)
      throw new UserException();

    module = ModuleData.getModule(moduleId);
    if(module == null)
      throw new ServerException();

    module.setAccessLevel(UserData.getUserRole(KeyFactory.stringToKey(encoded)), accessLevel);
    if(! ModuleData.saveModule(module))
      throw new ServerException();
  }
View Full Code Here

@SuppressWarnings("serial")
public class ThemeServiceImpl extends RemoteServiceServlet implements ThemeService {

  @Override
  public void setActive(String className) throws ServerException, UserException {
    Module module = ModuleData.getModule(ModuleHelper.class);
    UserRole userRole = UserData.getUser().getRole();

    if(module.getAccessLevel(userRole) != ModuleHelper.VIEW_N_CHANGE)
      throw new UserException();

    if(! ThemeData.setTheme(ThemeData.getTheme(className)))
      throw new ServerException("Theme could not be saved. Please try again.");
  }
View Full Code Here

  public ContentType getPageContent(String[] tokens, User user) {
    int accessLevel = getAccessLevel(user.getRole());

    if(tokens.length == 1) {
      if(accessLevel >= ModuleHelper.VIEW_ONLY) {
        Module contentModule = ModuleData.getModule(com.claymus.site.module.content.ModuleHelper.class);
        if(contentModule == null)
          return new ManagePages(accessLevel, Module.NO_ACCESS, user);
        else
          return new ManagePages(accessLevel, contentModule.getAccessLevel(user.getRole()), user);
      } else {
        return new Error401();
      }

    } else if(tokens.length == 2 && tokens[1].equals("new")) {
View Full Code Here

  }


  @Override
  public ContentDTO get(String pageEncoded, String encoded) throws ServerException, UserException {
    Module module = ModuleData.getModule(ModuleHelper.class);
    User user = UserData.getUser();
    Page page = PageData.getPage(KeyFactory.stringToKey(pageEncoded));
    Content content = ContentData.getContent(KeyFactory.stringToKey(encoded));

    if(page.getId() != content.getPageId())
      throw new ServerException();

    int accessLevel = module.getAccessLevel(user.getRole());
    if(accessLevel >= ModuleHelper.ADD_EDIT || (accessLevel == ModuleHelper.ADD && content.getOwner().equals(user))) {
      ContentDTO contentDTO = content.getDTO();
      contentDTO.setLocations(page.getLayout().getLocations());
      contentDTO.setRoles(getRoles());
      return contentDTO;
View Full Code Here

  }


  @Override
  public void add(String pageEncoded, ContentDTO contentDTO) throws ServerException, UserException {
    Module module = ModuleData.getModule(ModuleHelper.class);
    User user = UserData.getUser();

    int accessLevel = module.getAccessLevel(user.getRole());
    if(accessLevel < ModuleHelper.ADD)
      throw new UserException();

    Page page = PageData.getPage(KeyFactory.stringToKey(pageEncoded));
    ContentType contentData = ContentData.getContentType(contentDTO.getClass().getSimpleName().replace("DTO", ""));
View Full Code Here

      throw new ServerException("Content could not be created. Please try again later.");
  }

  @Override
  public void update(String encoded, ContentDTO contentDTO) throws ServerException, UserException {
    Module module = ModuleData.getModule(ModuleHelper.class);
    User user = UserData.getUser();
    Key key = KeyFactory.stringToKey(encoded);
    Content content = ContentData.getContent(key);

    int accessLevel = module.getAccessLevel(user.getRole());
    if(accessLevel >= ModuleHelper.ADD_EDIT || (accessLevel == ModuleHelper.ADD && content.getOwner().equals(user))) {
      if(ContentData.updateContent(key, contentDTO) == null)
        throw new ServerException("Content could not be saved. Please try again later.");
    } else {
      throw new UserException();
View Full Code Here

TOP

Related Classes of com.claymus.site.Module

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.