Examples of Image


Examples of org.openbravo.model.ad.utility.Image

        log4j.debug("InitialClientSetup - createClient - m_info: " + m_info.toString());
      // Add images
      Client newClient = OBDal.getInstance().get(Client.class, AD_Client_ID);
      SystemInformation sys = OBDal.getInstance().get(SystemInformation.class, "0");
      if (sys.getYourCompanyBigImage() != null) {
        Image yourCompanyBigImage = OBProvider.getInstance().get(Image.class);
        yourCompanyBigImage.setClient(newClient);
        yourCompanyBigImage.setBindaryData(sys.getYourCompanyBigImage().getBindaryData());
        yourCompanyBigImage.setName(sys.getYourCompanyBigImage().getName());
        newClient.getClientInformationList().get(0).setYourCompanyBigImage(yourCompanyBigImage);
        OBDal.getInstance().save(yourCompanyBigImage);
      }

      if (sys.getYourCompanyDocumentImage() != null) {
        Image yourCompanyDocumentImage = OBProvider.getInstance().get(Image.class);
        yourCompanyDocumentImage.setClient(newClient);
        yourCompanyDocumentImage.setBindaryData(sys.getYourCompanyDocumentImage().getBindaryData());
        yourCompanyDocumentImage.setName(sys.getYourCompanyBigImage().getName());
        newClient.getClientInformationList().get(0).setYourCompanyDocumentImage(
            yourCompanyDocumentImage);
        OBDal.getInstance().save(yourCompanyDocumentImage);
      }

      if (sys.getYourCompanyMenuImage() != null) {
        Image yourCompanyMenuImage = OBProvider.getInstance().get(Image.class);
        yourCompanyMenuImage.setClient(newClient);
        yourCompanyMenuImage.setBindaryData(sys.getYourCompanyMenuImage().getBindaryData());
        yourCompanyMenuImage.setName(sys.getYourCompanyMenuImage().getName());
        newClient.getClientInformationList().get(0).setYourCompanyMenuImage(yourCompanyMenuImage);
        OBDal.getInstance().save(yourCompanyMenuImage);
      }

      OBDal.getInstance().save(newClient);
View Full Code Here

Examples of org.opendope.SmartArt.dataHierarchy.SmartArtDataHierarchy.Images.Image

          String relId = blip.getEmbed();
          //Relationship r = diagramDataPart.getRelationshipsPart().getRelationshipByID(relId);
          BinaryPartAbstractImage bpai = (BinaryPartAbstractImage)diagramDataPart.getRelationshipsPart().getPart(relId);

          // Add it
          Image image = factory.createSmartArtDataHierarchyImagesImage();
          image.setContentType(bpai.getContentType());
          image.setId(imgPt.getModelId());
         
          image.setValue(bpai.getBytes());
         
          images.getImage().add(image);
         
          // reference
          org.opendope.SmartArt.dataHierarchy.ImageRef imageRef = factory.createImageRef();
View Full Code Here

Examples of org.openhab.model.sitemap.Image

 
  /**
   * {@inheritDoc}
   */
  public EList<Widget> renderWidget(Widget w, StringBuilder sb) throws RenderException {
    Image image = (Image) w;
    String snippet = (image.getChildren().size() > 0) ?
        getSnippet("image_link") : getSnippet("image");     

    if(image.getRefresh()>0) {
      snippet = StringUtils.replace(snippet, "%setrefresh%", "<script type=\"text/javascript\">imagesToRefreshOnPage=1</script>");
      snippet = StringUtils.replace(snippet, "%refresh%", "id=\"%id%\" onload=\"setTimeout('reloadImage(\\'%url%\\', \\'%id%\\')', " + image.getRefresh() + ")\"");
    } else {
      snippet = StringUtils.replace(snippet, "%setrefresh%", "");
      snippet = StringUtils.replace(snippet, "%refresh%", "");
    }
   
View Full Code Here

Examples of org.openstack.model.compute.Image

  public Server createInstance(OpenstackCloud cloud, String serverName, MachineCreationRequest request)
      throws OpsException {
    OpenstackComputeClient computeClient = getComputeClient(cloud);

    try {
      Image foundImage = null;

      CloudBehaviours cloudBehaviours = new CloudBehaviours(cloud);
      if (!cloudBehaviours.canUploadImages()) {
        // For now, we presume this is the HP cloud and hard-code the name
        // if (!cloudBehaviours.isHpCloud()) {
        // throw new UnsupportedOperationException();
        // }

        DiskImageRecipe recipe = null;
        if (request.recipeId != null) {
          recipe = platformLayerClient.getItem(request.recipeId, DiskImageRecipe.class);
        }

        OperatingSystemRecipe operatingSystem = null;
        if (recipe != null) {
          operatingSystem = recipe.getOperatingSystem();
        }

        log.info("Listing images to pick best image");
        Iterable<Image> images = computeClient.root().images().list();
        if (cloudBehaviours.isHpCloud()) {
          // TODO: We need a better solution here!!
          Set<String> imageNames = Sets.newHashSet("Debian Squeeze 6.0.3 Server 64-bit 20120123");
          log.warn("Hard coding image name (presuming HP cloud)");

          // TODO: Match OS
          for (Image image : images) {
            if (imageNames.contains(image.getName())) {
              foundImage = image;
              break;
            }
          }
        } else if (cloudBehaviours.isRackspaceCloud()) {
          if (operatingSystem == null) {
            operatingSystem = new OperatingSystemRecipe();
            operatingSystem.setDistribution("debian");
            operatingSystem.setVersion("squeeze");
          }

          for (Image image : images) {
            boolean matchesDistribution = false;
            boolean matchesVersion = false;

            for (Image.ImageMetadata.ImageMetadataItem item : image.getMetadata()) {
              // if (item.getKey().equals("platformlayer.org__type")) {
              // if (item.getValue().equals("base")) {
              // isMatch = true;
              // }
              // }

              if (item.getKey().equals("os_distro")) {
                if (operatingSystem != null && operatingSystem.getDistribution() != null) {
                  if (Comparisons
                      .equalsIgnoreCase(operatingSystem.getDistribution(), item.getValue())) {
                    matchesDistribution = true;
                  }
                }
              }

              if (item.getKey().equals("os_version")) {
                if (operatingSystem != null && operatingSystem.getVersion() != null) {
                  if (Comparisons.equalsIgnoreCase(operatingSystem.getVersion(), item.getValue())) {
                    matchesVersion = true;
                  } else if (Comparisons
                      .equalsIgnoreCase(operatingSystem.getDistribution(), "debian")) {

                    // Lenny is no longer getting security updates
                    // if (Strings.equalsIgnoreCase(operatingSystem.getVersion(), "lenny") &&
                    // Strings.equalsIgnoreCase(item.getValue(), "5")) {
                    // matchesVersion = true;
                    // } else

                    if (Comparisons.equalsIgnoreCase(operatingSystem.getVersion(), "squeeze")
                        && Comparisons.equalsIgnoreCase(item.getValue(), "6")) {
                      matchesVersion = true;
                    } else {
                      matchesVersion = false;
                    }
                  } else if (Comparisons
                      .equalsIgnoreCase(operatingSystem.getDistribution(), "ubuntu")) {
                    if (Comparisons.equalsIgnoreCase(operatingSystem.getVersion(), "lucid")
                        && Comparisons.equalsIgnoreCase(item.getValue(), "10.04LTS")) {
                      matchesVersion = true;
                    } else {
                      matchesVersion = false;
                    }
                  } else {
                    matchesVersion = false;
                  }
                }
              }
            }

            if (matchesDistribution && matchesVersion) {
              foundImage = image;
              break;
            }
          }
        } else {
          for (Image image : images) {
            boolean isMatch = false;

            for (Image.ImageMetadata.ImageMetadataItem item : image.getMetadata()) {
              // if (item.getKey().equals(Tag.IMAGE_TYPE)) {
              // if (item.getValue().equals("base")) {
              // isMatch = true;
              // }
              // }

              if (item.getKey().equals(Tag.IMAGE_OS_DISTRIBUTION)) {
                if (operatingSystem != null && operatingSystem.getDistribution() != null) {
                  if (!Comparisons.equalsIgnoreCase(operatingSystem.getDistribution(),
                      item.getValue())) {
                    isMatch = false;
                  }
                }
              }

              if (item.getKey().equals(Tag.IMAGE_OS_VERSION)) {
                if (operatingSystem != null && operatingSystem.getVersion() != null) {
                  if (!Comparisons.equalsIgnoreCase(operatingSystem.getVersion(), item.getValue())) {
                    isMatch = false;
                  }
                }
              }
            }

            if (isMatch) {
              foundImage = image;
              break;
            }
          }
        }

        if (foundImage == null) {
          throw new IllegalArgumentException("Could not find image");
        }
      } else {
        List<ImageFormat> formats = Collections.singletonList(ImageFormat.DiskQcow2);
        CloudImage image = imageFactory.getOrCreateImageId(cloud, formats, request.recipeId);

        String imageId = image.getId();
        log.info("Getting image details for image: " + imageId);
        foundImage = computeClient.root().images().image(imageId).show();
        if (foundImage == null) {
          throw new IllegalArgumentException("Could not find image: " + imageId);
        }
      }

      SecurityGroup createdSecurityGroup = null;
      if (cloudBehaviours.supportsSecurityGroups()) {
        SecurityGroup createTemplate = new SecurityGroup();
        createTemplate.setName(SECURITY_GROUP_PREFIX + serverName);
        createTemplate.setDescription("Security group for instance: " + serverName);
        try {
          log.info("Creating security group: " + createTemplate.getName());
          createdSecurityGroup = computeClient.root().securityGroups().create(createTemplate);
        } catch (OpenstackException e) {
          for (SecurityGroup candidate : computeClient.root().securityGroups().list()) {
            if (Objects.equal(candidate.getName(), createTemplate.getName())) {
              createdSecurityGroup = candidate;
              break;
            }
          }

          if (createdSecurityGroup != null) {
            // Ignore
            log.warn("Ignoring 'security group already exists' error: " + e.getMessage());
          } else {
            throw new OpsException("Error creating security group", e);
          }
        }
        {
          CreateSecurityGroupRuleRequest newRule = new CreateSecurityGroupRuleRequest();
          newRule.setCidr("0.0.0.0/0");
          newRule.setFromPort(22);
          newRule.setToPort(22);
          newRule.setIpProtocol("tcp");
          newRule.setParentGroupId(createdSecurityGroup.getId());

          try {
            log.info("Creating security group rule for port: " + newRule.getToPort());
            SecurityGroupRule createdRule = computeClient.root().securityGroupRules().create(newRule);
          } catch (OpenstackException e) {
            String message = e.getMessage();
            if (message != null && message.contains("This rule already exists")) {
              log.warn("Ignoring 'rule already exists': " + e.getMessage());
            } else {
              throw new OpsException("Error creating security group access", e);
            }
          }
        }
      }

      AsyncServerOperation createServerOperation;
      {
        ServerForCreate create = new ServerForCreate();

        create.setName(serverName);

        if (request.sshPublicKey != null) {
          if (cloudBehaviours.supportsPublicKeys()) {
            OpenstackCloudHelpers cloudHelpers = new OpenstackCloudHelpers();
            KeyPair keyPair = cloudHelpers.ensurePublicKeyUploaded(computeClient, request.sshPublicKeyName,
                request.sshPublicKey);
            create.setKeyName(keyPair.getName());
          } else if (cloudBehaviours.supportsFileInjection()) {
            String fileContents = SshKeys.serialize(request.sshPublicKey);
            create.addUploadFile("/root/.ssh/authorized_keys", Utf8.getBytes(fileContents));
          } else {
            throw new OpsException("No supported SSH key mechanism on cloud");
          }
        }

        create.setImageRef(foundImage.getId());

        Flavor flavor = getClosestInstanceType(computeClient, request);
        if (flavor == null) {
          throw new OpsException("Cannot determine instance type for request");
        }
View Full Code Here

Examples of org.pdfclown.documents.contents.entities.Image

    frame.y = blockComposer.getBoundBox().getMaxY() + 30;
    frame.height -= (blockComposer.getBoundBox().getHeight() + 30);

    // Showing the posted image...
    // Instantiate a jpeg image object!
    Image image = null;
    try
    {
      image = Image.get(
        new Buffer(imageFileFormField.get())
        ); // Abstract image (entity).
    }
    catch(Exception e)
    {/* NOOP. */}
    if(image == null)
    {
      blockComposer.begin(frame,AlignmentXEnum.Left,AlignmentYEnum.Top);
      composer.setFont(bodyFont,12);
      composer.setFillColor(new DeviceRGBColor(1,0,0));
      blockComposer.showText("The file you uploaded wasn't a valid JPEG image!");
      blockComposer.end();

      // Move past the closed block!
      frame.y = blockComposer.getBoundBox().getMaxY() + 20;
      frame.height -= (blockComposer.getBoundBox().getHeight() + 20);
    }
    else
    {
      blockComposer.begin(frame,AlignmentXEnum.Left,AlignmentYEnum.Top);
      composer.setFont(bodyFont,12);
      blockComposer.showText("Here it is the image you uploaded: ");
      blockComposer.end();

      // Move past the closed block!
      frame.y = blockComposer.getBoundBox().getMaxY() + 20;
      frame.height -= (blockComposer.getBoundBox().getHeight() + 20);

      double width = image.getWidth(), height = image.getHeight();
      if(width > frame.getWidth())
      {
        height *= frame.getWidth() / width;
        width = frame.getWidth();
      }
      if(height > frame.getHeight() / 2)
      {
        width *= frame.getHeight() / 2 / height;
        height = frame.getHeight() / 2;
      }
      // Show the image!
      composer.showXObject(
        image.toXObject(document),
        new Point2D.Double(
          (pageSize.getWidth() - 90 - width) / 2 + 20,
          blockComposer.getBoundBox().getMaxY() + 20
          ),
        new Dimension(width,height)
View Full Code Here

Examples of org.richfaces.photoalbum.model.Image

    }

    @Test
    public void areCommentsDeletedWithImage() throws Exception {
        String commentById = "select c from Comment c where image_id = :id";
        Image image = helper.getAllImages(em).get(0);

        Assert.assertNotNull(image);

        int allCommentsSize = helper.getAllComments(em).size();
        int commentsSize = em.createQuery(commentById, Comment.class).setParameter("id", image.getId()).getResultList().size();

        ia.deleteImage(image);

        Assert.assertFalse(helper.getAllImages(em).contains(image));

        List<Comment> comments = em.createQuery(commentById, Comment.class).setParameter("id", image.getId()).getResultList();

        Assert.assertTrue(comments.isEmpty());
        Assert.assertEquals(allCommentsSize - commentsSize, helper.getAllComments(em).size());
    }
View Full Code Here

Examples of org.sleuthkit.datamodel.Image

            if (dir != null) {
                actions.add(ExtractAction.getInstance());
            }

            // file search action
            final Image img = this.getLookup().lookup(Image.class);
            if (img != null) {
                actions.add(new FileSearchAction(
                        NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text")));
            }
View Full Code Here

Examples of org.socialmusicdiscovery.server.business.model.core.Image

        return "Track";
    }

    @Override
    protected <T extends SMDIdentity> Image getPersistentImage(T item) {
        Image image = ((TrackEntity)item).getDefaultImage();
        if(image==null && ((TrackEntity) item).getRelease()!=null) {
            image = ((ReleaseEntity)((TrackEntity) item).getRelease()).getDefaultImage();
        }
        return image;
    }
View Full Code Here

Examples of org.springmodules.xt.ajax.component.Image

public class SuccessMessageCallback implements SuccessRenderingCallback, MessageSourceAware {
   
    private MessageSource messageSource;
   
    public AjaxAction[] getSuccessActions(AjaxSubmitEvent ajaxSubmitEvent) {
        Image img = new Image(ajaxSubmitEvent.getHttpRequest().getContextPath() + "/images/ok.gif", "success");
        TaggedText msg = new TaggedText(
                this.messageSource.getMessage("message.successful", null, "Successful", LocaleContextHolder.getLocale()),
                TaggedText.Tag.SPAN);
       
        ReplaceContentAction action1 = new ReplaceContentAction("onSuccessMessage", img, msg);
View Full Code Here

Examples of org.structr.web.entity.Image

  }

  private Image createImageNode(final String uuid, final String name, final String contentType, final long size, final long checksum) throws FrameworkException {

    String relativeFilePath = Image.getDirectoryPath(uuid) + "/" + uuid;
    Image imageNode = app.create(Image.class,
      new NodeAttribute(GraphObject.id, uuid),
      new NodeAttribute(AbstractNode.name, name),
      new NodeAttribute(File.relativeFilePath, relativeFilePath),
      new NodeAttribute(File.contentType, contentType),
      new NodeAttribute(File.size, size),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.