Package com.claymus

Examples of com.claymus.User


  }

  @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

  protected void doRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    String uri = req.getRequestURI();
    Page page = null;
    List<List<Content>> contents = null;
    User user = UserData.getUser();
    UserRole userRole = user.getRole();
    Key userRoleKey = userRole.getKey();

    if(uri.startsWith("/_ah/")) { // Administer pages
      String str = uri.substring(5);
      String moduleId = str.split("/")[0];
View Full Code Here

  public Date getCreated() {
    return this.created;
  }

  public User getCreator() {
    User user = UserData.getUser(this.creator);
    return user == null ? UserData.getSystem() : user;
  }
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

  }

  @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


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

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

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

  public Date getAdded() {
    return this.added;
  }

  public User getOwner() {
    User user = UserData.getUser(this.owner);
    return user == null ? UserData.getSystem() : user;
  }
View Full Code Here

  public Date getAdded() {
    return this.added;
  }

  public User getOwner() {
    User user = UserData.getUser(this.owner);
    return user == null ? UserData.getSystem() : user;
  }
View Full Code Here

TOP

Related Classes of com.claymus.User

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.