How to define a NotesXspDocument Object in JAVA - java

In a JAVA bean that I am working on I want to pass a NotesXspDocument (could use a NotesDocument) to a method which looks like this:
public List<String> getReaders(NotesXspDocument thisXspDoc){
// do some stuff
}
But JAVA does not recognize the NotesXspDocument definition. I have imported the following packages:
import lotus.domino.NotesException;
import lotus.domino.Session;
import lotus.domino.Database;
import lotus.domino.View;
import lotus.domino.Document;
Is there a further package to import to make use the NotesXspDocument?

To elaborate on Jesses answer: in your case you need to do this to work with the XPages version of Document:
import com.ibm.xsp.model.domino.wrapped.DominoDocument;
public List<String> getReaders(DominoDocument thisXspDoc){
// do some stuff
}

NotesXspDocument is an SSJS-only alias; the real class is com.ibm.xsp.model.domino.wrapped.DominoDocument: http://public.dhe.ibm.com/software/dw/lotus/Domino-Designer/JavaDocs/DesignerAPIs/com/ibm/xsp/model/domino/wrapped/DominoDocument.html

Related

Groovy not compiling correct class in Intellij

I have a class named "OrderBy" localized on package "br.com.petrobras.sddi.domain.".
Groovy has a class named "OrderBy" too, on package "groovy.util"
I have the class above:
//.. something
import br.com.petrobras.sddi.domain.*
// other imports
abstract class BaseJPARepository {
protected OrderSpecifier getSortedColumn(OrderBy order) {
//..something
}
}
When I compiled my program and open BaseJPARepository.class the imports contains
import br.com.petrobras.sddi.domain.FindAllPredicate;
import br.com.petrobras.sddi.domain.IEntity;
import br.com.petrobras.sddi.domain.PagedList;
import br.com.petrobras.sddi.domain.Pagination;
import com.querydsl.core.types.Order;
// others
import groovy.util.OrderBy;
// others...
So, when compiling, my class OrderBy wasn't imported.
How can I fix that? (I want to use the "*" when importing)
AFAIK, groovy loads all groovy.util.* and java.lang.* etc classes automatically. So, in order to be able to use your class you have to use it's full name in the code:
protected OrderSpecifier getSortedColumn( br.com.petrobras.sddi.domain.OrderBy order) {
//..something
}

How to access AEM Core models in a Sling model

Specifically, I am trying to enable .SVG files to be usable by the core image component.
Right now I am making a sling model that ideally I would like to access the returned values of the getSrc() and getFileReference() classes in the core AEM Component interface located here.
I am very new to AEM development and Sling models. Am I missing some vital functionality that would let me do this?
Here is my code, which probably isn't at all helpful at this point.
package com.site.core.models;
import com.adobe.cq.wcm.core.components.models.Image;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.models.annotations.*;
import org.apache.sling.models.annotations.injectorspecific.*;
import org.apache.sling.settings.SlingSettingsService;
import javax.jcr.Node;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.inject.Inject;
#Model(adaptables = SlingHttpServletRequest.class)
public class ImageModel {
private String src = Image.getSrc();
return src;
}
As I mentioned in my comment, the link you are referring to is an interface, the implementation of that interface is here
In order to use your own implementation, you have two options:
In the image component html, change the data-sly-use to refer to your impl: com.site.core.models.ImageModel
Create a separate model that implements the Image interface and give it a high ranking to be picked up instead of the existing impl.
Disclaimer: I have not tested #2 but the documentation suggests that it's possible.

Can't resolve symbol toJson

I'm using json4s in a play project, and I'm also using a library called sbt-buildinfo which generates Scala source from your build definitions.
Now, in the sbt-buildinfo library the say you need to add some line of code: buildInfoOptions += BuildInfoOption.ToJson so you can use .toJson, but from some reason I can use .toJson.
this is how I do it:
import _root_.util.{AuthenticatedAction}
import buildinfo.BuildInfo
import com.google.inject.Inject
import org.json4s.BuildInfo
import play.api._
import play.api.mvc._
class AppInfo #Inject()(implicit configuration: Configuration) extends Controller {
def appVerion = AuthenticatedAction {
Ok(BuildInfo.toJson)
}
but the import buildinfo.BuildInfo stays gray....so it looks like I'm not using it. I refreshed the build.sbt and all, what could it be?
You have multiple imports to a BuildInfo object. org.json4s.BuildInfo will probably shadow your buildInfo.BuildInfo import and therefore, it does not have the required member. Try writing out the entire package name that you need:
Ok(buildinfo.BuildInfo.toJson)

java.lang.NoClassDefFoundError: io/dropwizard/jetty/RequestLogFactory when using dropwizard

When I changed from Hibernate to JDBI, and tried to launch my application, error below occured
java.lang.NoClassDefFoundError: io/dropwizard/jetty/RequestLogFactory
Stack trace says, that the cause of this problem is in my configuration class, at the class definition. But i have no idea what's wrong. Anyone had this problem?
MyConfiguration.java
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import io.dropwizard.db.DataSourceFactory;
import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
public class MyConfiguration extends Configuration {
#JsonProperty
#NotNull
private DataSourceFactory database;
#JsonProperty
#NotEmpty
private String someString;
public DataSourceFactory getDataSourceFactory() {
return database;
}
public String getSomeString() {
return someString;
}
}
EDIT
I'm using dropwizard 1.0.0 and RequestLogFactory is neither in the given package nor Intellij couldn't find that class.
You aren't using the RequestLogFactory directly, but it seems one of the classes you're importing is and that jar needs to be present on your classpath for these classes you're importing to work appropriately at runtime. You should track down the jar which you need to include on your classpath that includes the RequestLogFactory class.
My best guess would be you're missing an import statement for the RequestLogFactory class:
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import io.dropwizard.db.DataSourceFactory;
import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
You probably need to include:
import io.dropwizard.jetty.RequestLogFactory;
or simply (if you have more classes inside of jetty):
import io.dropwizard.jetty.*;

LinkedList in Java and imports

I'm trying to make a linked list in Java, but there is an issue.
I thought that Link is in java.util.Link,but when I tried to do something like
Link nextLink;
Eclipse wanted to
import sun.awt.image.ImageWatched.Link;
I think that this import is different from what I expect and if I import java.util.Link it gives error.
use
import java.util.LinkedList;
Do you need something like this?
import java.util.LinkedList;
public class LinkTest {
private LinkedList<Object> list = new LinkedList<Object>();
}

Categories

Resources