0

작은 배포자 확장을 작성하려고했는데 사용자가 게시판에서 페이지/구성 요소/이진을 게시/게시 취소하면 해당 레코드가 특정 스토리지 확장을 사용하는 테이블.작성 방법 tridion에서 배포자 확장의 구성 요소 배포 취소 및 이원 배포 해제 기능

스토리지 확장 부분이 이미 완료되었습니다! 내가 com.tridion.deployer.modules에서 이러한 클래스를 가지고로

이 잘 나는 쉽게 PageDeploy/ComponentDeploy 및 BinaryDeploy를 작성할 수 있습니다.

우리는 쉽게 사용자 정의 페이지 배포 취소 클래스를 작성할 수 있지만, 클래스가 없으므로 이진 배포 해제 구성 요소를 작성하는 데 어려움이 있습니다.

가능한지 여부를 제안하십시오. 그렇다면 클래스 나 메소드를 작성하여 작성하십시오.

감사합니다.

답변

4

그래도 혼자서 발견 한 구성 요소 배포 취소 또는 이진 배포 취소는 없습니다.

Frank는 배치 해제 이벤트 here을 추적하기 위해 바이너리 저장소를 확장하는 방법에 대한 좋은 예가 있으며, 구성 요소의 경우 대신 ComponentPresentationUndeploy를 사용해야합니다.

+0

@Nuno을 삭제 .. 답변 감사합니다!! 목표는 이전에 ITEM 테이블에 사용자 정의 트리거를 사용하여 ITEM 테이블에 삽입/업데이트/삭제가있을 때마다 새로운 테이블 PUBLISH_ACTION을 업데이트하여 페이지, 컴포넌트 및 바이너리의 모든 항목을 가져 오는 것이 었습니다. 이것은 올바른 접근 방식으로 지원 계약을 망칠 수 없기 때문에 스토리지 확장을 사용하여 스토리지 확장을 이미 완료했습니다. 이제 DAO 클래스에 값을 추가하기 위해 전개자를 작성했습니다. PAGE가 완료되었습니다. 배포 및 배치 방법 모두, bianry 및 componentm에 대한 고민, 제발 sugest !! –

+0

또한 JPAComponentPresentationDAO를 확장하고 ComponentPresentationDAO를 구현하여 구성 요소 추가/삭제/업데이트 작업을 수행하고 이러한 값을 저장소 확장을 사용하여 새 데이터베이스 테이블에 저장하는 JPAComponentDAOExtension과 같은 사용자 지정 저장소 확장 클래스를 만들 수 있습니까? –

1

다음은 DAO의 구성 요소 및 이진을 추적하는 샘플 코드입니다.

구성 요소 : 샘플 코드를 추가하는 방법과 동일하게 업데이트를 진행하고

@Component("JPAComponentDAOExtension") 
@Scope("prototype") 

public class JPAComponentDAOExtension extends JPAComponentPresentationDAO implements ComponentPresentationDAO 
{ 

    public JPAComponentDAOExtension(String storageId, EntityManagerFactory entityManagerFactory, String storageName) 
    { 
     super(storageId, entityManagerFactory, storageName); 
    } 

    public JPAComponentDAOExtension(String storageId, EntityManagerFactory entityManagerFactory, EntityManager entityManager, String storageName) 
    { 
     super(storageId, entityManagerFactory, entityManager, storageName); 
    } 

    public void create(ComponentPresentation itemToCreate, ComponentPresentationTypeEnum componentPresentationType) throws StorageException 
    { 
     super.create(itemToCreate,componentPresentationType); 
     String tcmURI = Integer.toString(itemToCreate.getComponentId()); 
     ItemDAO item = (ItemDAO) StorageManagerFactory.getDAO(itemToCreate.getPublicationId(),StorageTypeMapping.COMPONENT_META); 
     ComponentMeta meta = (ComponentMeta) item.findByPrimaryKey(itemToCreate.getPublicationId(),itemToCreate.getComponentId()); 
     String schemaID = Integer.toString(meta.getSchemaId()) ; 

     PublishActionDAO publishActionDAO = (PublishActionDAO) StorageManagerFactory.getDefaultDAO("PublishAction"); 
     PublishAction publishAction = new PublishAction(); 
     publishAction.setAction("ADD"); 
     publishAction.setTcmUri(tcmURI); 
     publishAction.setSchemaID(schemaID); 
     publishActionDAO.store(publishAction); 

    } 
} 

진 삭제 : 샘플 코드 추가와 같은 업데이트를 진행하고

@Component("JPABinaryDAOExtension") 
@Scope("prototype") 

public class JPABinaryDAOExtension extends JPABinaryContentDAO implements BinaryContentDAO 
{ 

    public JPABinaryDAOExtension(String storageId, EntityManagerFactory entityManagerFactory, String storageName) 
    { 
     super(storageId, entityManagerFactory, storageName); 
    } 

    public JPABinaryDAOExtension(String storageId, EntityManagerFactory entityManagerFactory, EntityManager entityManager, String storageName) 
    { 
     super(storageId, entityManagerFactory, entityManager, storageName); 
    } 

    public void create(final BinaryContent binaryContent, final String relativePath) throws StorageException 
    { 
     super.create(binaryContent, relativePath); 
     String url = relativePath; 
     String tcmURI = Integer.toString(binaryContent.getBinaryId()); 

     ItemDAO item = (ItemDAO) StorageManagerFactory.getDAO(binaryContent.getPublicationId(),StorageTypeMapping.BINARY_META); 
     BinaryMeta binarymeta = (BinaryMeta) item.findBinaryByPrimaryKey(binaryContent.getPublicationId(),binaryContent.getBinaryId()); 
     binarymeta.getBinaryType();//to get the binary type 

     //You can also check the Relative path as below for specific binary type entries as suggested by Mihai 
     if (relativePath.toLowerCase().endsWith(".pdf")) //Looking for PDFs only 
     { 
      PublishActionDAO publishActionDAO = (PublishActionDAO) StorageManagerFactory.getDefaultDAO("PublishAction"); 
      PublishAction publishAction = new PublishAction(); 
      publishAction.setAction("ADD"); 
      publishAction.setUrl(url); 
      publishAction.setTcmUri(tcmURI); 
      publishActionDAO.store(publishAction); 
     } 
    } 
}