Example usage for org.jfree.util Log warn

List of usage examples for org.jfree.util Log warn

Introduction

In this page you can find the example usage for org.jfree.util Log warn.

Prototype

public static void warn(final Object message) 

Source Link

Document

A convenience method for logging a 'warning' message.

Usage

From source file:com.doculibre.constellio.feedprotocol.model.impl.FeedRecordImpl.java

public FeedRecordImpl(String datasource, String feedtype, String groupActionStr, String url, String displayurl,
        String action, String mimetype, String lastModified, String lock, String authmethod,
        List<FeedContent> contents, List<FeedMetadata> metadatas) throws ParseFeedException {
    if (StringUtils.isBlank(datasource)) {
        throw new ParseFeedException("Blank datasource");
    }//from   ww w. j  a  v  a 2  s .  c om

    if (StringUtils.isBlank(feedtype)) {
        throw new ParseFeedException("Blank feedType");
    } else if (!feedtype.equals(FeedImpl.FULL) && !feedtype.equals(FeedImpl.INCREMENTAL)
            && !feedtype.equals(FeedImpl.METADATA_AND_URL)) {
        throw new ParseFeedException("Invalid feedType: " + feedtype);
    }

    if (StringUtils.isBlank(url)) {
        throw new ParseFeedException("Blank url");
    }
    this.url = url;

    this.displayurl = url;

    if (action == null) {
        this.action = null;
    } else if (action.equals(ADD)) {
        this.action = ACTION.ADD;
    } else if (action.equals(DELETE)) {
        this.action = ACTION.DELETE;
    } else {
        throw new ParseFeedException("Invalid action: " + action);
    }

    this.mimetype = mimetype;

    if (lastModified != null) {
        Calendar calendar = null;
        try {
            calendar = Value.iso8601ToCalendar(lastModified);
        } catch (ParseException e) {
            try {
                calendar = new GregorianCalendar();
                calendar.setTime(RFC822DateUtil.parse(lastModified));
            } catch (Exception ee) {
                Log.warn("Cannot parse last-modified with ISO 8601 OR RFC822 date format: " + lastModified);
            }
        }
        this.lastModified = calendar;
    } else {
        //Implied if null
        this.lastModified = new GregorianCalendar();
    }

    if (lock == null) {
        this.locked = false;
    } else {
        this.locked = Boolean.parseBoolean(lock);
    }

    if (authmethod == null) {
        this.authmethod = AUTHMETHOD.NONE;
        this.publicRecord = true;
    } else if (authmethod.equals(NONE)) {
        this.authmethod = AUTHMETHOD.NONE;
        this.publicRecord = true;
    } else if (authmethod.equals(NTLM)) {
        this.authmethod = AUTHMETHOD.NTLM;
        this.publicRecord = false;
    } else if (authmethod.equals(HTTPBASIC)) {
        this.authmethod = AUTHMETHOD.HTTPBASIC;
        this.publicRecord = false;
    } else if (authmethod.equals(HTTPSSO)) {
        this.authmethod = AUTHMETHOD.HTTPSSO;
        this.publicRecord = false;
    } else {
        throw new ParseFeedException("Invalid authmethod: " + authmethod);
    }

    List<FeedContent> contentsTemp = new ArrayList<FeedContent>();
    contentsTemp.addAll(contents);
    this.contents = Collections.unmodifiableList(contentsTemp);

    List<FeedMetadata> metadatasTemp = new ArrayList<FeedMetadata>();
    metadatasTemp.addAll(metadatas);
    this.metadatas = Collections.unmodifiableList(metadatasTemp);

    validateAction(datasource, feedtype, groupActionStr);
}

From source file:com.pedra.core.setup.CoreSystemSetup.java

/**
 * Helper method for checking setting of a String setup parameter.
 * /*from w w w .j  a v a  2 s .c o m*/
 * @param context
 * @param key
 * @return true if parameter is set to Yes
 */
protected String getStringSystemSetupParameter(final SystemSetupContext context, final String key) {
    final String parameterValue = context.getParameter(context.getExtensionName() + "_" + key);
    if (parameterValue != null) {
        return parameterValue;
    }
    // Have not been able to determine value from context, fallback to default value
    Log.warn("Missing setup parameter for key [" + key + "], falling back to null");
    return null;
}

From source file:com.pedra.core.setup.CoreSystemSetup.java

private File getProjectdataUpdateDirectory(String relativeUpdateDirectory) {
    if (relativeUpdateDirectory == null) {
        relativeUpdateDirectory = "";
    }/*from   w  ww.j  ava 2s  .com*/
    String projectdataUpdateFolderProperty = Config.getString("projectdata.update.folder",
            "/pedracore/import/versions");
    projectdataUpdateFolderProperty = projectdataUpdateFolderProperty + relativeUpdateDirectory;
    File projectdataUpdateFolder = null;
    try {
        projectdataUpdateFolder = new File(getClass().getResource(projectdataUpdateFolderProperty).toURI());
    } catch (final URISyntaxException e) {
        Log.error("error finding project data update directory[" + projectdataUpdateFolderProperty + "]", e);
        return null;
    }
    if (!projectdataUpdateFolder.exists()) {
        Log.warn("project data update directory [" + projectdataUpdateFolderProperty + "] does not exist");
        return null;
    } else if (ArrayUtils.isEmpty(projectdataUpdateFolder.listFiles())) {
        Log.info("Project datad update directory[" + projectdataUpdateFolderProperty + "] is empty");
    }
    return projectdataUpdateFolder;
}

From source file:gr.abiss.calipso.domain.CustomAttribute.java

@Override
public boolean equals(Object o) {
    if (o == null) {

        //logger.info(this.toString() +" NOT (1) equals "+ o.toString());
        return false;
    }/*from w  ww.j a v  a2s.com*/
    if (o == this) {
        //logger.info(this.toString() +" equals (2) "+ o.toString());
        return true;
    }

    CustomAttribute other = null;
    try {

        other = (CustomAttribute) o;
    } catch (ClassCastException e) {
        Log.warn(e);
    } finally {
        if (other == null) {
            return false;
        }
    }
    boolean equals = new EqualsBuilder().append(this.getName(), other.getName()).isEquals();

    //logger.info(this.toString() +" equals "+ o.toString()+": "+equals);
    return equals;
}

From source file:org.geopublishing.geopublisher.AMLExporter.java

/**
 * Creates an < aml:desc > JDOM {@link Node} for the given
 * {@link Translation}//from w w  w . j  a  v  a  2 s .c o m
 */
private final Element exportTranslation(final Document document, final String tagname,
        final Translation translation) {
    final Element element = document.createElementNS(AMLUtil.AMLURI, tagname);

    // Creating a sequence of <aml:translation> tags, minOccurs=1
    if (translation == null) {
        final String warning = "No translation given for " + tagname
                + "\nAtlasMarkupLanguage will probably not be valid.";
        if (statusWindow != null) {
            statusWindow.warningOccurred(this.getClass().getSimpleName(), null, warning);
        } else
            Log.warn(warning);
    } else {
        if (translation.size() == 0) {
            for (final String code : getAce().getLanguages()) {
                translation.put(code, "");
            }

        }
        for (final String key : translation.keySet()) {
            final Element descTranslation = document.createElementNS(AMLUtil.AMLURI, "translation");
            descTranslation.setAttribute("lang", key);
            String string = translation.get(key);
            if (string == null)
                string = "";
            descTranslation.appendChild(document.createTextNode(string));
            element.appendChild(descTranslation);
        }
    }
    return element;
}

From source file:org.projectforge.framework.persistence.history.DisplayHistoryEntry.java

private Object getObjectValue(Session session, HistProp prop) {
    if (prop == null) {
        return null;
    }/*from w w w .  j  a v  a2s.c o  m*/
    if (StringUtils.isBlank(prop.getValue()) == true) {
        return prop.getValue();
    }
    String type = prop.getType();
    if (String.class.getName().equals(type) == true) {
        return prop.getValue();
    }
    if (Date.class.getName().equals(type) == true) {
        // TODO RK implement parsing
    }

    EntityMetadata emd = PfEmgrFactory.get().getMetadataRepository().findEntityMetadata(prop.getType());
    if (emd == null) {
        return prop.getValue();
    }
    String[] sa = StringUtils.split(prop.getValue(), ", ");
    if (sa == null || sa.length == 0) {
        return Collections.emptyList();
    }
    List<Object> ret = new ArrayList<>();
    for (String pks : sa) {
        try {
            int pk = Integer.parseInt(pks);
            Object ent = session.get(emd.getJavaType(), pk);
            if (ent != null) {
                ret.add(ent);
            }
        } catch (NumberFormatException ex) {
            Log.warn("Cannot parse pk: " + prop);
        }
    }
    return ret;
}

From source file:ubic.gemma.core.genome.gene.service.GeneSetServiceImpl.java

@Override
@Transactional//  w ww .  j a  v  a2 s .  c  o  m
public GeneSetValueObject createDatabaseEntity(GeneSetValueObject geneSetVo) {
    GeneSet newGeneSet = GeneSet.Factory.newInstance();
    newGeneSet.setName(geneSetVo.getName());
    newGeneSet.setDescription(geneSetVo.getDescription());

    Collection<Long> geneIds = geneSetVo.getGeneIds();

    // If no gene Ids just create group and return.
    if (geneIds != null && !geneIds.isEmpty()) {
        Collection<Gene> genes = geneService.load(geneIds);

        if (geneIds.size() != genes.size()) {
            Log.warn("Not all genes were found by id: " + geneIds.size() + " ids, " + genes.size()
                    + " genes fetched");
        }

        Collection<GeneSetMember> geneMembers = new HashSet<>();
        for (Gene g : genes) {
            GeneSetMember gmember = GeneSetMember.Factory.newInstance();
            gmember.setGene(g);
            gmember.setScore(GeneSetServiceImpl.DEFAULT_SCORE);
            geneMembers.add(gmember);
        }

        newGeneSet.setMembers(geneMembers);
    }

    GeneSet gset = this.create(newGeneSet);

    // make groups private by default
    // can't do this to newGeneSet variable because the entity's id needs to be non-null
    if (geneSetVo.getIsPublic()) {
        securityService.makePublic(gset);
    } else {
        securityService.makePrivate(gset);
    }

    return geneSetValueObjectHelper.convertToValueObject(this.load(gset.getId()));
}

From source file:ubic.gemma.genome.gene.service.GeneSetServiceImpl.java

/**
 * @param geneSetVo/*from www .j  ava 2 s .co  m*/
 * @return
 */
@Override
public GeneSetValueObject createDatabaseEntity(GeneSetValueObject geneSetVo) {
    GeneSet newGeneSet = GeneSet.Factory.newInstance();
    newGeneSet.setName(geneSetVo.getName());
    newGeneSet.setDescription(geneSetVo.getDescription());

    Collection<Long> geneIds = geneSetVo.getGeneIds();

    // If no gene Ids just create group and return.
    if (geneIds != null && !geneIds.isEmpty()) {
        Collection<Gene> genes = geneService.loadMultiple(geneIds);

        if (geneIds.size() != genes.size()) {
            Log.warn("Not all genes were found by id: " + geneIds.size() + " ids, " + genes.size()
                    + " genes fetched");
        }

        Collection<GeneSetMember> geneMembers = new HashSet<GeneSetMember>();
        for (Gene g : genes) {
            GeneSetMember gmember = GeneSetMember.Factory.newInstance();
            gmember.setGene(g);
            gmember.setScore(DEFAULT_SCORE);
            geneMembers.add(gmember);
        }

        newGeneSet.setMembers(geneMembers);
    }

    GeneSet gset = create(newGeneSet);

    // make groups private by default
    // can't do this to newGeneSet variable because the entity's id needs to be non-null
    if (geneSetVo.getIsPublic()) {
        securityService.makePublic(gset);
    } else {
        securityService.makePrivate(gset);
    }

    return geneSetValueObjectHelper.convertToValueObject(load(gset.getId()));
}