Package com.agiletec.plugins.jacms.aps.system.services.resource.model

Examples of com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface


      throw t;
    } finally {
      resources = _resourceManager.searchResourcesId(type, descr, null, null);
      if (null != resources && resources.size() > 0) {
        for (int i = 0; i < resources.size(); i++) {
          ResourceInterface resource = _resourceManager.loadResource(resources.get(i));
          _resourceManager.deleteResource(resource);
        }
      }
    }
  }
View Full Code Here


        if (null == value) return;
        JAXBResourceValue jaxbImageValue = value.getImage();
        if (null == jaxbImageValue) return;
        try {
            IResourceManager resourceManager = this.getResourceManager();
            ResourceInterface resource = resourceManager.loadResource(jaxbImageValue.getResourceId().toString());
            if (null != resource) {
                this.setResource(resource, this.getDefaultLangCode());
            }
      if (null != value.getAreas()) {
        for (int i = 0; i < value.getAreas().size(); i++) {
View Full Code Here

      // add the resource
      this._resourceManager.addResource(bean);
      List<String> resources = this._resourceManager.searchResourcesId(resourceType, resDescrToAdd, categoryCodeToAdd, groups);
      assertEquals(1, resources.size());
     
      ResourceInterface resource = _resourceManager.loadResource(resources.get(0));
      assertNotNull(resource);

      // move into the trash
      _resourceManager.deleteResource(resource);

      // load from Trash
      ResourceInterface resourceLoadedFromTrash = this._trashedResourceManager.loadTrashedResource(resource.getId());
      assertNotNull(resourceLoadedFromTrash);
      assertEquals(resDescrToAdd, resourceLoadedFromTrash.getDescr());
      assertEquals(mainGroup, resourceLoadedFromTrash.getMainGroup());
      assertEquals(resourceType, resourceLoadedFromTrash.getType());
     
      // del from trash
      this._trashedResourceManager.removeFromTrash(resource.getId());
    } catch (Throwable t) {
      List<String> resources = this._resourceManager.searchResourcesId(resourceType, resDescrToAdd, categoryCodeToAdd, groups);
      if (null != resources && resources.size() > 0) {
        for (int i = 0; i < resources.size(); i++) {
          String id = resources.get(i);
          this._trashedResourceManager.removeFromTrash(id);
          ResourceInterface resource = this._resourceManager.loadResource(id);
          this._resourceManager.deleteResource(resource);
        }
      }
      throw t;
    }
View Full Code Here

      this._resourceManager.addResource(bean);
      List<String> resources = this._resourceManager.searchResourcesId(resourceType, resDescrToAdd, categoryCodeToAdd, groups);
      assertEquals(1, resources.size());
     
      String resourceId = resources.get(0);
      ResourceInterface resource = this._resourceManager.loadResource(resourceId);
      assertNotNull(resource);
     
      // move into the trash
      this._resourceManager.deleteResource(resource);
      resources = _resourceManager.searchResourcesId(resourceType, resDescrToAdd, categoryCodeToAdd, groups);
      assertEquals(0, resources.size());
     
      // restore from Trash
      this._trashedResourceManager.restoreResource(resourceId);
      resources = this._resourceManager.searchResourcesId(resourceType, resDescrToAdd, categoryCodeToAdd, groups);
      assertEquals(1, resources.size());
      resource = this._resourceManager.loadResource(resources.get(0));
      // delete from archive and from trash
      _resourceManager.deleteResource(resource);
      resources = _resourceManager.searchResourcesId(resourceType, resDescrToAdd, categoryCodeToAdd, groups);
      assertEquals(0, resources.size());
      this._trashedResourceManager.removeFromTrash(resource.getId());
    } catch (Throwable t) {
      List<String> resources = this._resourceManager.searchResourcesId(resourceType, resDescrToAdd, categoryCodeToAdd, groups);
      if (null != resources && resources.size() > 0) {
        for (int i = 0; i < resources.size(); i++) {
          String id = resources.get(i);
          this._trashedResourceManager.removeFromTrash(id);
          ResourceInterface resource = this._resourceManager.loadResource(id);
          this._resourceManager.deleteResource(resource);
        }
      }
      throw t;
    }
View Full Code Here

 
  @Override
  public void validate() {
    if (ApsAdminSystemConstants.ADD == this.getStrutsAction()) {
      String resourceType = this.getResourceType();
      ResourceInterface resourcePrototype = this.getResourceManager().createResourceType(resourceType);
      this.clearFieldErrors();
      this.loadExternalResource();
      if (this.hasFieldErrors()) return;
      this.checkRightFileType(resourcePrototype);
      if (this.hasFieldErrors()) return;
View Full Code Here

    assertEquals(Action.SUCCESS, result);
    trashedResources = ((ITrashedResourceAction) this.getAction()).getTrashedResources();
    assertEquals(1, trashedResources.size());
    assertEquals("66", trashedResources.get(0));
   
    ResourceInterface trashedResource = ((ITrashedResourceAction) this.getAction()).getTrashedResource("70");
    assertEquals("tux", trashedResource.getDescr());
    assertEquals("Image", trashedResource.getType());
    assertEquals("free", trashedResource.getMainGroup());
    assertNotNull(trashedResource.getXML());

  }
View Full Code Here

  }
 
  public void testRemoveFromTrash() throws Throwable{
    String resourceId = "22";
    try {
      ResourceInterface resource = this._resourceManager.loadResource(resourceId);
      this._trashedResourceDAO.addTrashedResource(resource);
     
      String result = this.executeList("admin", "Image");
      assertEquals(Action.SUCCESS, result);
      List<String> trashedResources = ((ITrashedResourceAction) this.getAction()).getTrashedResources();
View Full Code Here

    }
  }
 
  public void testRestoreFromTrash() throws Throwable{
    String resourceId = "70";
    ResourceInterface originaryResourceInterface = this._trashedResourceManager.loadTrashedResource(resourceId);
    assertNotNull(originaryResourceInterface);
    try {
      String result = this.executeRestore("admin", "Image", resourceId);
      assertEquals(Action.SUCCESS, result);
      ResourceInterface resourceInterface = this._resourceManager.loadResource(resourceId);
      assertEquals("tux", resourceInterface.getDescr());
      assertEquals("Image", resourceInterface.getType());
      assertEquals(resourceId, resourceInterface.getId());
     
      this._resourceManager.deleteResource(resourceInterface);
     
      ResourceRecordVO recordVO = _trashedResourceDAO.getTrashedResource(resourceId);
      assertNotNull(recordVO);
View Full Code Here

  @Override
  public void validate() {
    if (ApsAdminSystemConstants.ADD == this.getStrutsAction()) {
      String resourceType = this.getResourceType();
      ResourceInterface resourcePrototype = this.getResourceManager().createResourceType(resourceType);
      this.clearFieldErrors();
      this.loadExternalResource();
      if (this.hasFieldErrors()) return;
      this.checkRightFileType(resourcePrototype);
      if (this.hasFieldErrors()) return;
View Full Code Here

    return SUCCESS;
  }

  public String saveOnEditContent() {
    try {
      ResourceInterface resource = this.getResourceManager().addResource(this);
      //this.setResourceLangCode(this.getCurrentAttributeLang());
      ResourceAttributeActionHelper.joinResource(resource, this.getRequest());
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "save");
      return FAILURE;
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface

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.