Package com.dotcms.publisher.bundle.bean

Examples of com.dotcms.publisher.bundle.bean.Bundle


    publisherEndPointAPI.saveEndPoint( receivingFromEndpoint );

    /*
     * Find the bundle
     */
    Bundle bundle = APILocator.getBundleAPI().getBundleById( bundleId );
    PublisherConfig basicConfig = new PublisherConfig();
    basicConfig.setId( bundleId );
    File bundleRoot = BundlerUtil.getBundleRoot( basicConfig );
    File bundleFile = new File( bundleRoot + File.separator + ".." + File.separator + bundle.getId() + ".tar.gz" );
    assertTrue( bundleFile.exists() );

    /*
     * Rename the bundle file
     */
    String newBundleId = UUID.randomUUID().toString();
    File newBundleFile = new File( bundleRoot + File.separator + ".." + File.separator + newBundleId + ".tar.gz" );
    Boolean success = bundleFile.renameTo( newBundleFile );
    assertTrue( success );
    assertTrue( newBundleFile.exists() );

    /*
     * Prepare the post request
     */
    ClientConfig cc = new DefaultClientConfig();
    Client client = Client.create( cc );

    FormDataMultiPart form = new FormDataMultiPart();
    form.field( "AUTH_TOKEN", PublicEncryptionFactory.encryptString( (PublicEncryptionFactory.decryptString( receivingFromEndpoint.getAuthKey().toString() )) ) );
    form.field( "GROUP_ID", UtilMethods.isSet( receivingFromEndpoint.getGroupId() ) ? receivingFromEndpoint.getGroupId() : receivingFromEndpoint.getId() );
    form.field( "BUNDLE_NAME", bundle.getName() );
    form.field( "ENDPOINT_ID", receivingFromEndpoint.getId() );
    form.bodyPart( new FileDataBodyPart( "bundle", newBundleFile, MediaType.MULTIPART_FORM_DATA_TYPE ) );

    /* TODO: We have the improve this test because of the new license updates
     *
 
View Full Code Here


    receivingFromEndpoint.setGroupId( environment.getId() );
    //Save the endpoint.
    publisherEndPointAPI.saveEndPoint( receivingFromEndpoint );

    //Find the bundle
    Bundle bundle = APILocator.getBundleAPI().getBundleById( bundleId );
    PublisherConfig basicConfig = new PublisherConfig();
    basicConfig.setId( bundleId );
    File bundleRoot = BundlerUtil.getBundleRoot( basicConfig );
    File bundleFile = new File( bundleRoot + File.separator + ".." + File.separator + bundle.getId() + ".tar.gz" );
   
    //lets wait one minute
    Thread.sleep( 60000 );
   
    assertTrue( bundleFile.exists() );

    //Rename the bundle file
    String newBundleId = UUID.randomUUID().toString();
    File newBundleFile = new File( bundleRoot + File.separator + ".." + File.separator + newBundleId + ".tar.gz" );
    Boolean success = bundleFile.renameTo( newBundleFile );
    assertTrue( success );
    assertTrue( newBundleFile.exists() );

    //Prepare the post request
    ClientConfig cc = new DefaultClientConfig();
    Client client = Client.create( cc );

    FormDataMultiPart form = new FormDataMultiPart();
    form.field( "AUTH_TOKEN", PublicEncryptionFactory.encryptString( (PublicEncryptionFactory.decryptString( receivingFromEndpoint.getAuthKey().toString() )) ) );
    form.field( "GROUP_ID", UtilMethods.isSet( receivingFromEndpoint.getGroupId() ) ? receivingFromEndpoint.getGroupId() : receivingFromEndpoint.getId() );
    form.field( "BUNDLE_NAME", bundle.getName() );
    form.field( "ENDPOINT_ID", receivingFromEndpoint.getId() );
    form.bodyPart( new FileDataBodyPart( "bundle", newBundleFile, MediaType.MULTIPART_FORM_DATA_TYPE ) );

    //Sending bundle to endpoint
    WebResource resource = client.resource( receivingFromEndpoint.toURL() + "/api/bundlePublisher/publish" );
View Full Code Here

      Date publishDate = dateFormat.parse(_contentPushPublishDate+"-"+_contentPushPublishTime);

      List<String> identifiers = new ArrayList<String>();
      identifiers.add(ref.getIdentifier());

      Bundle bundle = new Bundle(null, publishDate, null, processor.getUser().getUserId(), forcePush);
          APILocator.getBundleAPI().saveBundle(bundle, envsToSendTo);

      publisherAPI.addContentsToPublish(identifiers, bundle.getId(), publishDate, processor.getUser());
      if(!_contentPushNeverExpire && (!"".equals(_contentPushExpireDate.trim()) && !"".equals(_contentPushExpireTime.trim()))){
        Date expireDate = dateFormat.parse(_contentPushExpireDate+"-"+_contentPushExpireTime);
        bundle = new Bundle(null, publishDate, expireDate, processor.getUser().getUserId(), forcePush);
              APILocator.getBundleAPI().saveBundle(bundle, envsToSendTo);
        publisherAPI.addContentsToUnpublish(identifiers, bundle.getId(), expireDate, processor.getUser());
      }
    } catch (DotPublisherException e) {
      Logger.debug(PushPublishActionlet.class, e.getMessage());
      throw new  WorkflowActionFailureException(e.getMessage());
    } catch (ParseException e){
View Full Code Here

            PublishAuditStatus status = PublishAuditAPI.getInstance().updateAuditTable( mySelf.getId(), mySelf.getId(), bundleFolder, true );

            if(bundleName.trim().length()>0) {
          // save bundle if it doesn't exists
                Bundle foundBundle = APILocator.getBundleAPI().getBundleById( bundleFolder );
                if ( foundBundle == null || foundBundle.getId() == null ) {
                    Bundle b = new Bundle();
                    b.setId(bundleFolder);
                    b.setName(bundleName);
                    b.setPublishDate(Calendar.getInstance().getTime());
                    b.setOwner(APILocator.getUserAPI().getSystemUser().getUserId());
                    APILocator.getBundleAPI().saveBundle(b);
          }
      }

      //Write file on FS
View Full Code Here

 
      if(!UtilMethods.isSet(bundleId)) {
              return responseResource.response( "false" );
      }
 
      Bundle bundle = APILocator.getBundleAPI().getBundleById(bundleId);
      bundle.setName(bundleName);
      APILocator.getBundleAPI().updateBundle(bundle);
 
    } catch (DotDataException e) {
      Logger.error(getClass(), "Error trying to update Bundle. Bundle ID: " + bundleId);
          return responseResource.response( "false" );
View Full Code Here

TOP

Related Classes of com.dotcms.publisher.bundle.bean.Bundle

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.