Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9118515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:10:22+00:00 2026-06-17T05:10:22+00:00

I have written custom DAO to Add /Update/Delete specific records for my Binaries in

  • 0

I have written custom DAO to Add/Update/Delete specific records for my Binaries in my persistence type of storage extension in Tridion 2011.

Below is sample code where I am trying to use my custom DAO class/interface (PublishActionDAO and PublishAction) in my custom binary DAO (JPABinaryDAOExtension).

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());
        PublishActionDAO publishActionDAO = (PublishActionDAO) StorageManagerFactory.getDefaultDAO("PublishAction");
        PublishAction publishAction = new PublishAction();
        publishAction.setAction("Add");
        publishAction.setUrl(url);
        publishAction.setTcmUri(tcmURI);
        publishActionDAO.store(publishAction);
    }
}

Above is sample code for Add when a new binary is created and same goes for Update and Delete, I am going to store Action as Add, binary publish URL, its TCMURI. I can get these data easily in above code. Now the problem which I am facing is that I just need to store records for PDFs types of Binaries only and for other type of binaries like (JPG/Word etc.) no record entry.

Edit: Is below solution will work for me or making object for binaries it will slow down the performance.

ItemDAO item = (ItemDAO) StorageManagerFactory.getDAO(binaryContent.getPublicationId(),StorageTypeMapping.BINARY_META);
BinaryMeta binarymeta = (BinaryMeta) item.findBinaryByPrimaryKey(binaryContent.getPublicationId(),binaryContent.getBinaryId());
binarymeta.getBinaryType();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:10:23+00:00Added an answer on June 17, 2026 at 5:10 am

    Strictly checking for the type can be done by verifying the extension of the relativePath in your create method:

        if (!relativePath.toLowerCase().endsWith(".pdf")) { return; }
    

    However, there is a better way of handling this — in your cd_storage_conf.xml, map the Binary type using a specific extension. Then the CD storage framework will only call your DAO if the extension matches:

        <Item typeMapping="Binary" itemExtension=".pdf" storageId="myStorage"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have succesfully able to populate the my storage extension table using my custom
I have written a custom REST compensation framework in spring which records a REST
I have written a Custom Delegating Handler which add custom headers to the response
I have written a custom class to handle database queries to a remote and
I have written a custom class for overriding the seek method of QSlider. Basically
I have written a custom Django Model Field to store dateutil.relativedelta 's. The field
I have written a custom Windows Service that writes data to a custom Event
I have written a custom server control which (pseudo-code) looks like public class MyCustomCtrl
I have written a custom request handler in solr to meet my business requirements.
I'm using nant to build our product and have written a custom task to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.