Package org.gatein.mop.api.content

Examples of org.gatein.mop.api.content.Customization


      contentDef.setLastModificationDate(application.getModifiedDate());
   }

   private Application load(ContentDefinition contentDef)
   {
      Customization customization = contentDef.getCustomization();

      //
      ContentType<?> contentType = customization.getType();
      ApplicationType<?> applicationType = ApplicationType.getType(contentType);

      //
      Application application = new Application();
      application.setId(contentDef.getCategory().getName() + "/" + contentDef.getName());
      application.setCategoryName(contentDef.getCategory().getName());
      application.setType(applicationType);
      application.setApplicationName(contentDef.getName());
      application.setIconURL(getApplicationIconURL(contentDef));
      application.setDisplayName(contentDef.getDisplayName());
      application.setDescription(contentDef.getDescription());
      application.setAccessPermissions(new ArrayList<String>(contentDef.getAccessPermissions()));
      application.setCreatedDate(contentDef.getCreationDate());
      application.setModifiedDate(contentDef.getLastModificationDate());
      application.setStorageId(customization.getId());
      application.setContentId(customization.getContentId());
      return application;
   }
View Full Code Here


      }
   }

   private static String getApplicationIconURL(ContentDefinition contentDef)
   {
      Customization customization = contentDef.getCustomization();
      if (customization != null)
      {
         ContentType type = customization.getType();
         String contentId = customization.getContentId();
         if (type == Portlet.CONTENT_TYPE)
         {
            String[] chunks = contentId.split("/");
            if (chunks.length == 2)
            {
View Full Code Here

      {
         Workspace workspace = session.getWorkspace();
         Site site = workspace.getSite(siteType, ownerId);

         //
         Customization customization = null;
         if (site != null)
         {
            if (instanceName.startsWith("@"))
            {
               String id = instanceName.substring(1);
               UIWindow window = session.findObjectById(ObjectType.WINDOW, id);

               // Should check it's pointing to same instance though
               customization = window.getCustomization();
            }
            else
            {
               int pos = instanceName.indexOf("#");
               if (pos != -1)
               {
                  String a = instanceName.substring(0, pos);
                  String b = instanceName.substring(pos + 1);
                  Page page = site.getRootPage().getChild("pages").getChild(b);
                  Customization c = page.getCustomizationContext().getCustomization(a);
                  if (c != null)
                  {
                     c.destroy();
                  }
                  customization =
                     page.getCustomizationContext().customize(a, Portlet.CONTENT_TYPE, applicationName + "/" + portletName,
                        new PortletBuilder().build());
               }
               else
               {
                  Customization c = site.getCustomizationContext().getCustomization(instanceName);
                  if (c != null)
                  {
                     c.destroy();
                  }
                  customization =
                     site.getCustomizationContext().customize(instanceName, Portlet.CONTENT_TYPE, applicationName + "/" + portletName,
                        new PortletBuilder().build());
               }
View Full Code Here

               UIWindow srcWindow = (UIWindow)srcChild;
               UIWindow dstWindow = (UIWindow)dstChild;
               Customization<?> customization = srcWindow.getCustomization();
               ContentType contentType = customization.getType();
               String contentId = customization.getContentId();
               Customization parent = customization.getParent();
               Customization dstParent = null;
               if (parent != null)
               {
                  WorkspaceCustomizationContext parentCtx = (WorkspaceCustomizationContext)parent.getContext();
                  String name = parentCtx.nameOf(parent);
                  if (parentCtx == srcPage)
                  {
                     dstParent = dstPage.getCustomizationContext().getCustomization(name);
                     if (dstParent == null)
                     {
                        Object state = parent.getVirtualState();
                        dstParent = dstPage.getCustomizationContext().customize(name, contentType, contentId, state);
                     }
                  }
                  if (dstParent != null)
                  {
                     Object state = customization.getState();
                     Customization dstCustomization = dstWindow.customize(dstParent);
                     dstCustomization.setState(state);
                  }
                  else
                  {
                     Object state = customization.getVirtualState();
                     dstWindow.customize(contentType, contentId, state);
View Full Code Here

                UIWindow srcWindow = (UIWindow) srcChild;
                UIWindow dstWindow = (UIWindow) dstChild;
                Customization<?> customization = srcWindow.getCustomization();
                ContentType contentType = customization.getType();
                String contentId = customization.getContentId();
                Customization parent = customization.getParent();
                Customization dstParent = null;
                if (parent != null) {
                    WorkspaceCustomizationContext parentCtx = (WorkspaceCustomizationContext) parent.getContext();
                    String name = parentCtx.nameOf(parent);
                    if (parentCtx == srcPage) {
                        dstParent = dstPage.getCustomizationContext().getCustomization(name);
                        if (dstParent == null) {
                            Object state = parent.getVirtualState();
                            dstParent = dstPage.getCustomizationContext().customize(name, contentType, contentId, state);
                        }
                    }
                    if (dstParent != null) {
                        Object state = customization.getState();
                        Customization dstCustomization = dstWindow.customize(dstParent);
                        dstCustomization.setState(state);
                    } else {
                        Object state = customization.getVirtualState();
                        dstWindow.customize(contentType, contentId, state);
                    }
                } else {
View Full Code Here

        contentDef.setCreationDate(application.getCreatedDate());
        contentDef.setLastModificationDate(application.getModifiedDate());
    }

    private Application load(ContentDefinition contentDef) {
        Customization customization = contentDef.getCustomization();

        //
        ContentType<?> contentType = customization.getType();
        ApplicationType<?> applicationType = ApplicationType.getType(contentType);

        //
        Application application = new Application();
        /**
         * Apps ID has a "/" character that is rendered into id markup.
         * We need to workaround it to be W3C compliant.
         */
        application.setId(contentDef.getCategory().getName() + "_slash_" + contentDef.getName());
        application.setCategoryName(contentDef.getCategory().getName());
        application.setType(applicationType);
        application.setApplicationName(contentDef.getName());
        application.setIconURL(getApplicationIconURL(contentDef));
        application.setDisplayName(contentDef.getDisplayName());
        application.setDescription(contentDef.getDescription());
        application.setAccessPermissions(new ArrayList<String>(contentDef.getAccessPermissions()));
        application.setCreatedDate(contentDef.getCreationDate());
        application.setModifiedDate(contentDef.getLastModificationDate());
        application.setStorageId(customization.getId());
        application.setContentId(customization.getContentId());
        return application;
    }
View Full Code Here

            return localizedString.getDefaultString();
        }
    }

    private static String getApplicationIconURL(ContentDefinition contentDef) {
        Customization customization = contentDef.getCustomization();
        if (customization != null) {
            ContentType type = customization.getType();
            String contentId = customization.getContentId();
            if (type == Portlet.CONTENT_TYPE) {
                String[] chunks = contentId.split("/");
                if (chunks.length == 2) {
                    return "/" + chunks[0] + "/skin/DefaultSkin/portletIcons/" + chunks[1] + ".png";
                }
View Full Code Here

                UIWindow srcWindow = (UIWindow) srcChild;
                UIWindow dstWindow = (UIWindow) dstChild;
                Customization<?> customization = srcWindow.getCustomization();
                ContentType contentType = customization.getType();
                String contentId = customization.getContentId();
                Customization parent = customization.getParent();
                Customization dstParent = null;
                if (parent != null) {
                    WorkspaceCustomizationContext parentCtx = (WorkspaceCustomizationContext) parent.getContext();
                    String name = parentCtx.nameOf(parent);
                    if (parentCtx == srcPage) {
                        dstParent = dstPage.getCustomizationContext().getCustomization(name);
                        if (dstParent == null) {
                            Object state = parent.getVirtualState();
                            dstParent = dstPage.getCustomizationContext().customize(name, contentType, contentId, state);
                        }
                    }
                    if (dstParent != null) {
                        Object state = customization.getState();
                        Customization dstCustomization = dstWindow.customize(dstParent);
                        dstCustomization.setState(state);
                    } else {
                        Object state = customization.getVirtualState();
                        dstWindow.customize(contentType, contentId, state);
                    }
                } else {
View Full Code Here

        //
        Workspace workspace = session.getWorkspace();

        //
        Customization customization = workspace.getCustomizationContext().getCustomization(definitionName);

        //
        if (customization == null) {
            workspace.getCustomizationContext().customize(definitionName, contentType, contentId, null);
        } else if (customization.getContentId().equals(contentId)) {
            // Do nothing here
        } else {
            throw new IllegalArgumentException("Cannot create a content with a content id " + contentId
                    + " with an existing different content id " + customization.getContentId());
        }

        //
        ContentDefinition content = create();
View Full Code Here

        contentDef.setCreationDate(application.getCreatedDate());
        contentDef.setLastModificationDate(application.getModifiedDate());
    }

    private Application load(ContentDefinition contentDef) {
        Customization customization = contentDef.getCustomization();

        //
        ContentType<?> contentType = customization.getType();
        ApplicationType<?> applicationType = ApplicationType.getType(contentType);

        //
        Application application = new Application();
        application.setId(contentDef.getCategory().getName() + "/" + contentDef.getName());
        application.setCategoryName(contentDef.getCategory().getName());
        application.setType(applicationType);
        application.setApplicationName(contentDef.getName());
        application.setIconURL(getApplicationIconURL(contentDef));
        application.setDisplayName(contentDef.getDisplayName());
        application.setDescription(contentDef.getDescription());
        application.setAccessPermissions(new ArrayList<String>(contentDef.getAccessPermissions()));
        application.setCreatedDate(contentDef.getCreationDate());
        application.setModifiedDate(contentDef.getLastModificationDate());
        application.setStorageId(customization.getId());
        application.setContentId(customization.getContentId());
        return application;
    }
View Full Code Here

TOP

Related Classes of org.gatein.mop.api.content.Customization

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.